From 66f6ccada12d0075932f62713450d8d3ca166ad6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Hells=C3=A9n?= Date: Fri, 9 Jan 2026 20:43:07 +0100 Subject: [PATCH] Add GitHub Actions workflow --- .github/workflows/docker.yaml | 63 +++++++++++++++++++++++++++++++++++ .vscode/settings.json | 2 ++ 2 files changed, 65 insertions(+) create mode 100644 .github/workflows/docker.yaml diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml new file mode 100644 index 0000000..d62073e --- /dev/null +++ b/.github/workflows/docker.yaml @@ -0,0 +1,63 @@ +name: Test and Build Docker Image + +on: + push: + pull_request: + schedule: + - cron: "0 14 * * *" # Run every day at 14:00 CET + workflow_dispatch: + +jobs: + test: + runs-on: ubuntu-latest + env: + DJANGO_SECRET_KEY: 1234567890 + DJANGO_DEBUG: False + + steps: + - uses: docker/login-action@v3 + if: github.event_name != 'pull_request' + with: + registry: ghcr.io + username: thelovinator1 + password: ${{ secrets.GITHUB_TOKEN }} + - uses: docker/setup-buildx-action@v3 + + - uses: actions/checkout@v6 + + - uses: astral-sh/ruff-action@v3 + with: + version: "latest" + - run: ruff check --exit-non-zero-on-fix --verbose + - run: ruff format --check --verbose + + - run: docker build --check . + - uses: actions/setup-python@v6 + with: + python-version: 3.14 + + - uses: astral-sh/setup-uv@v7 + - run: uv sync --locked --all-extras --dev + - run: uv run pytest + + - run: uv run python manage.py makemigrations --check + - run: uv run python manage.py migrate + - run: uv run python manage.py collectstatic --noinput + - id: meta + uses: docker/metadata-action@v5 + env: + DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index + with: + images: | + ghcr.io/thelovinator1/ttvdrops + tags: | + type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }} + + - uses: docker/build-push-action@v6 + with: + context: . + platforms: linux/amd64 + push: ${{ github.event_name != 'pull_request' }} + labels: ${{ steps.meta.outputs.labels }} + tags: ${{ steps.meta.outputs.tags }} + annotations: ${{ steps.meta.outputs.annotations }} diff --git a/.vscode/settings.json b/.vscode/settings.json index f4d6caa..c96dc5f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,6 +7,7 @@ "appname", "ASGI", "botuser", + "buildx", "collectstatic", "colorama", "createsuperuser", @@ -52,6 +53,7 @@ "staticfiles", "testchannel", "testpass", + "thelovinator", "tqdm", "ttvdrops", "venv",