Skip to content

Commit 7fcccac

Browse files
Uno-Takashiclaude
andcommitted
ci: fix failing checks on f/rebuild PR
The monorepo modernization introduced several CI regressions because the backend repo is checked out standalone (the `frontend` submodule is absent) and because tooling/action versions had bit-rotted. - pytest / license-check: `docker compose up -d` built every service, including the new `frontend` (`context: ../frontend`, missing in a backend-only checkout). Start only `django`; postgres/redis come up as deps. Same fix for the trivy build in security.yml (`build django`). - dockle / trivy: pin `image: backend-django` on the django service so the built image name no longer depends on the checkout-directory/project name. - dockerlint: a comment sat inside the multi-line `ENV` continuation ("Empty / bogus instruction on line 13"); moved it above the `ENV`. - hadolint DL3022: `COPY --from=ghcr.io/astral-sh/uv` referenced an external image; introduce a named `FROM ghcr.io/astral-sh/uv:0.9 AS uv` stage. - textlint: `setup-node@v1` + node 15 lacked `node:stream/consumers` (needs Node >=16.7); bump to setup-node@v4 / node 20. - actionlint: bump deprecated runners (checkout@v2/v3 -> v4, setup-node@v1 -> v4, setup-python@v3 -> v5, upload-artifact@v2 -> v4) and fix shellcheck quoting (SC2016/SC2086) in autoblack.yml. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent e8ecde3 commit 7fcccac

9 files changed

Lines changed: 51 additions & 32 deletions

File tree

.github/workflows/autoblack.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
uvx ruff format .
2929
uvx ruff check --fix .
3030
git config --global user.name github-actions || exit 0;
31-
git config --global user.email '${GITHUB_ACTOR}@users.noreply.github.com' || exit 0;
32-
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY || exit 0;
31+
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" || exit 0;
32+
git remote set-url origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY" || exit 0;
3333
git commit -am "style: apply ruff format/fixes" || exit 0;
34-
git push --force origin HEAD:$GITHUB_REF || exit 0;
34+
git push --force origin "HEAD:$GITHUB_REF" || exit 0;

.github/workflows/code-quality-review.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@ jobs:
2222
actionlint:
2323
runs-on: ubuntu-latest
2424
steps:
25-
- uses: actions/checkout@v3
25+
- uses: actions/checkout@v4
2626
- uses: reviewdog/action-actionlint@v1
2727
with:
2828
reporter: "github-pr-review"
2929
textlint:
3030
runs-on: ubuntu-latest
3131
steps:
3232
- name: Checkout
33-
uses: actions/checkout@v2
33+
uses: actions/checkout@v4
3434
with:
3535
submodules: true
3636
- name: Setup node/npm
37-
uses: actions/setup-node@v1
37+
uses: actions/setup-node@v4
3838
with:
39-
node-version: "15"
39+
node-version: "20"
4040
- run: |
4141
npm install --save-dev textlint textlint-rule-write-good
4242
- name: textlint-github-pr-review

.github/workflows/code-quality.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
timeout-minutes: 15
1010
steps:
11-
- uses: actions/checkout@v3
11+
- uses: actions/checkout@v4
1212
- name: Lizard Runner
1313
uses: Uno-Takashi/Lizard-Runner@v3
1414
with:
@@ -19,13 +19,13 @@ jobs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- name: Checkout
22-
uses: actions/checkout@v3
22+
uses: actions/checkout@v4
2323
with:
2424
submodules: true
2525
- name: Setup node/npm
26-
uses: actions/setup-node@v1
26+
uses: actions/setup-node@v4
2727
with:
28-
node-version: "15"
28+
node-version: "20"
2929
- name: install dockerlint
3030
run: |
3131
npm install -g dockerlint
@@ -34,15 +34,15 @@ jobs:
3434
hadolint:
3535
runs-on: ubuntu-latest
3636
steps:
37-
- uses: actions/checkout@v3
37+
- uses: actions/checkout@v4
3838
- uses: hadolint/hadolint-action@v2.0.0
3939
with:
4040
dockerfile: ./Django/Dockerfile
4141
ignore: "DL3008,SC2174,DL3009,DL3059,SC3009"
4242
dockle:
4343
runs-on: ubuntu-latest
4444
steps:
45-
- uses: actions/checkout@v3
45+
- uses: actions/checkout@v4
4646
- run: |
4747
docker compose build django
4848
- name: Run Dockle
@@ -54,25 +54,25 @@ jobs:
5454
actionlint:
5555
runs-on: ubuntu-latest
5656
steps:
57-
- uses: actions/checkout@v3
57+
- uses: actions/checkout@v4
5858
- uses: reviewdog/action-actionlint@v1
5959
shellcheck:
6060
name: Shellcheck
6161
runs-on: ubuntu-latest
6262
steps:
63-
- uses: actions/checkout@v3
63+
- uses: actions/checkout@v4
6464
- name: Run ShellCheck
6565
uses: ludeeus/action-shellcheck@master
6666
yamllint:
6767
runs-on: ubuntu-latest
6868
steps:
69-
- uses: actions/checkout@v3
69+
- uses: actions/checkout@v4
7070
- name: yaml-lint
7171
uses: ibiqlik/action-yamllint@v3
7272
# nginx-conf-check:
7373
# runs-on: ubuntu-latest
7474
# steps:
75-
# - uses: actions/checkout@v3
75+
# - uses: actions/checkout@v4
7676
# - name: run docker-compose
7777
# run: |
7878
# docker-compose up -d

.github/workflows/license-check.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@v4
1212
- name: run docker compose
13+
# Only the django service (and its postgres/redis deps) is needed here.
14+
# Starting the whole stack would try to build the `frontend` service,
15+
# whose `context: ../frontend` does not exist in this backend-only
16+
# checkout (it is a sibling submodule of the monorepo).
1317
run: |
14-
docker compose up -d
18+
docker compose up -d django
1519
- name: init containers
1620
run: |
1721
docker compose exec -T django python manage.py makemigrations;

.github/workflows/pytest.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ jobs:
1010
steps:
1111
- uses: actions/checkout@v4
1212
- name: run docker compose
13+
# Only the django service (and its postgres/redis deps) is needed for
14+
# tests. Starting the whole stack would try to build the `frontend`
15+
# service, whose `context: ../frontend` does not exist in this
16+
# backend-only checkout (it is a sibling submodule of the monorepo).
1317
run: |
14-
docker compose up -d
18+
docker compose up -d django
1519
- name: init containers
1620
run: |
1721
docker compose exec -T django python manage.py makemigrations;

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
release:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v4
1818
- name: Create Release
1919
id: create_release
2020
uses: actions/create-release@v1

.github/workflows/security.yml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,19 @@ jobs:
1010
bandit:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/setup-python@v3
13+
- uses: actions/setup-python@v5
1414
with:
1515
python-version: "3.9"
1616
- name: install bandit
1717
run: pip install bandit
1818
- name: Checkout
19-
uses: actions/checkout@v3
19+
uses: actions/checkout@v4
2020
- name: run bandit
2121
run: |
2222
bandit Django -r -o ./bandit.txt -f txt -c ./.github/bandit.yml
2323
- name: Archive bandit log
2424
if: always()
25-
uses: actions/upload-artifact@v2
25+
uses: actions/upload-artifact@v4
2626
with:
2727
name: bandit-report
2828
path: ./bandit.txt
@@ -33,19 +33,19 @@ jobs:
3333
run: |
3434
sudo apt-get update
3535
sudo apt-get install moreutils -y
36-
- uses: actions/setup-python@v3
36+
- uses: actions/setup-python@v5
3737
with:
3838
python-version: "3.9"
3939
- name: install python-taint
4040
run: pip install python-taint
4141
- name: Checkout
42-
uses: actions/checkout@v3
42+
uses: actions/checkout@v4
4343
- name: run pyt
4444
run: |
4545
pyt -a D -o pyt.txt ./Django
4646
- name: Archive pyt log
4747
if: always()
48-
uses: actions/upload-artifact@v2
48+
uses: actions/upload-artifact@v4
4949
with:
5050
name: pyt-report
5151
path: ./pyt.txt
@@ -63,7 +63,7 @@ jobs:
6363
language: ["python"]
6464
steps:
6565
- name: Checkout repository
66-
uses: actions/checkout@v3
66+
uses: actions/checkout@v4
6767
- name: Initialize CodeQL
6868
uses: github/codeql-action/init@v3
6969
with:
@@ -78,8 +78,11 @@ jobs:
7878
steps:
7979
- uses: actions/checkout@v4
8080
- name: run docker compose
81+
# Build only the django image; building the full stack would try to
82+
# build the `frontend` service (`context: ../frontend`), absent in this
83+
# backend-only checkout.
8184
run: |
82-
docker compose build
85+
docker compose build django
8386
- name: Run Trivy vulnerability scanner
8487
uses: aquasecurity/trivy-action@master
8588
with:

Django/Dockerfile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
# syntax=docker/dockerfile:1
2+
3+
# Bring in the uv binary from the official image as a named stage so the COPY
4+
# below references a previously defined FROM alias (hadolint DL3022).
5+
FROM ghcr.io/astral-sh/uv:0.9 AS uv
6+
27
FROM python:3.13-slim-bookworm
38

4-
# Bring in the uv binary from the official image.
5-
COPY --from=ghcr.io/astral-sh/uv:0.9 /uv /uvx /bin/
9+
COPY --from=uv /uv /uvx /bin/
610

11+
# Keep UV_PROJECT_ENVIRONMENT (the virtualenv) outside the app dir so a
12+
# bind-mount over the source (docker-compose) does not shadow the installed
13+
# dependencies.
714
ENV PYTHONDONTWRITEBYTECODE=1 \
815
PYTHONUNBUFFERED=1 \
916
DEBCONF_NOWARNINGS=yes \
1017
UV_COMPILE_BYTECODE=1 \
1118
UV_LINK_MODE=copy \
12-
# Keep the virtualenv outside the app dir so a bind-mount over the source
13-
# (docker-compose) does not shadow the installed dependencies.
1419
UV_PROJECT_ENVIRONMENT=/opt/venv \
1520
PATH="/opt/venv/bin:$PATH"
1621

docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ services:
2323
env_file: *env_file
2424
django:
2525
container_name: django
26+
# Pin the built image name so it does not depend on the compose project
27+
# (checkout-directory) name; dockle/trivy in CI scan `backend-django`.
28+
image: backend-django
2629
build:
2730
context: Django
2831
dockerfile: Dockerfile

0 commit comments

Comments
 (0)