Skip to content

Commit a1c98da

Browse files
authored
Merge pull request #10 from PaperMtn/feature/utils-refactor
Feature/utils refactor
2 parents 9027ea2 + 8c72e86 commit a1c98da

27 files changed

Lines changed: 1321 additions & 771 deletions
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Build and Test Docker Image
2+
3+
on:
4+
push:
5+
6+
env:
7+
TEST_TAG: papermountain/gitlab-watchman:test
8+
9+
jobs:
10+
docker:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Set up Docker Buildx
14+
uses: docker/setup-buildx-action@v3
15+
16+
- name: Build
17+
uses: docker/build-push-action@v6
18+
with:
19+
load: true
20+
tags: ${{ env.TEST_TAG }}
21+
22+
- name: Inspect
23+
run: |
24+
docker image inspect ${{ env.TEST_TAG }}
25+
26+
- name: Test
27+
run: |
28+
docker run --rm ${{ env.TEST_TAG }} --version
29+
docker run --rm ${{ env.TEST_TAG }} --help
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
name: ci
1+
name: Publish Docker Image
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [ master, main ]
66

77
jobs:
88
build:
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Test Python Package
2+
3+
on:
4+
push:
5+
branches: [ develop, feature/**, release/**, hotfix/** ]
6+
pull_request:
7+
branches: [ develop, feature/**, release/**, hotfix/** ]
8+
9+
jobs:
10+
build-ubuntu:
11+
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: ["3.10", "3.11", "3.12", "3.13"]
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
- name: Install dependencies
24+
run: |
25+
pip install poetry
26+
poetry install
27+
- name: Test setup & install
28+
run: |
29+
poetry build
30+
python3 -m pip install dist/*.whl
31+
- name: Test run
32+
run: |
33+
gitlab-watchman --version
34+
gitlab-watchman --help
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Poetry Publish
2+
3+
on:
4+
push:
5+
branches: [ master, main ]
6+
7+
jobs:
8+
deploy:
9+
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Set up Python
15+
uses: actions/setup-python@v2
16+
with:
17+
python-version: '3.12'
18+
- name: Install dependencies
19+
run: |
20+
pip install poetry
21+
poetry install
22+
poetry config pypi-token.pypi "${{ secrets.PYPI_TOKEN }}"
23+
- name: Publish package
24+
run: poetry publish --build

.github/workflows/pythonpackage.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

.github/workflows/pythonpublish.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
## [3.1.0] - 2024-11-x
2+
### Changed
3+
- Package management and deployment moved to Poetry
4+
- Docker build process improved using multi-stage builds. The Dockerfile now doesn't contain any unnecessary files, and is much smaller.
5+
- Refactor to separate GitLab client and Watchman processing into modules
6+
7+
### Added
8+
- Signatures now loaded into memory instead of being saved to disk. This allows for running on read-only filesystems.
9+
- Tests for Docker build
10+
11+
### Fixed
12+
- Error when enumerating pages when there is no `X-Total-Pages` header
13+
114
## [3.0.0] - 2023-05-15
215
This major version release brings multiple updates to GitLab Watchman in usability, functionality and behind the scenes improvements.
316
### Added

Dockerfile

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
# syntax=docker/dockerfile:1
2+
FROM python:3.12-slim-bullseye AS builder
3+
WORKDIR /opt/gitlab-watchman
4+
COPY . .
5+
RUN pip install poetry
6+
RUN poetry config virtualenvs.create false && \
7+
poetry install --no-dev && \
8+
poetry build
29

3-
FROM python:3.10
4-
COPY . /opt/gitlab-watchman
10+
FROM python:3.12-slim-bullseye
511
WORKDIR /opt/gitlab-watchman
6-
ENV PYTHONPATH=/opt/gitlab-watchman GITLAB_WATCHMAN_TOKEN="" GITLAB_WATCHMAN_URL=""
7-
RUN pip3 install -r requirements.txt build && \
8-
chmod -R 700 . && \
9-
python3 -m build && \
10-
python3 -m pip install dist/*.whl
12+
COPY --from=builder /opt/gitlab-watchman/dist/*.whl /opt/gitlab-watchman/dist/
13+
COPY --from=builder /opt/gitlab-watchman/pyproject.toml /opt/gitlab-watchman/poetry.lock /opt/gitlab-watchman/
14+
ENV PYTHONPATH=/opt/gitlab-watchman \
15+
GITLAB_WATCHMAN_TOKEN="" \
16+
GITLAB_WATCHMAN_URL=""
17+
RUN pip install dist/*.whl && \
18+
chmod -R 700 .
1119
STOPSIGNAL SIGINT
12-
WORKDIR /opt/gitlab-watchman
1320
ENTRYPOINT ["gitlab-watchman"]

0 commit comments

Comments
 (0)