Skip to content

Commit 98293e1

Browse files
ci: rewrite validate workflow to use just recipes via matrix
Replaces 5 duplicated inline jobs with a single matrix job that calls just validate-* recipes. Adds iot, gpu-ml, and full variants. Single source of truth between local and CI validation. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent d6e5413 commit 98293e1

2 files changed

Lines changed: 21 additions & 190 deletions

File tree

.github/workflows/validate-template.yml

Lines changed: 17 additions & 189 deletions
Original file line numberDiff line numberDiff line change
@@ -10,203 +10,31 @@ permissions:
1010
contents: read
1111

1212
jobs:
13-
validate-standard:
14-
name: Validate (standard defaults)
13+
validate:
14+
name: Validate (${{ matrix.variant }})
1515
runs-on: ubuntu-latest
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
variant:
20+
- standard
21+
- minimal
22+
- cli
23+
- api
24+
- db
25+
- iot
26+
- gpu-ml
27+
- full
1628
steps:
1729
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1830
- uses: astral-sh/setup-uv@94527f2e458b27549849d47d273a16bec83a01e9 # v7
1931
with:
2032
version: "0.11.3"
2133
python-version: "3.12"
34+
- uses: extractions/setup-just@e33e0265a09d0d9e33744104863ef636539f4b97 # v3
2235
- name: Configure git
2336
run: |
2437
git config --global user.name "CI"
2538
git config --global user.email "ci@test.com"
26-
- name: Render template (standard)
27-
run: |
28-
TEMPLATE_DIR=$(mktemp -d)
29-
git archive HEAD | tar -C "$TEMPLATE_DIR" -xf -
30-
uvx copier copy "$TEMPLATE_DIR" /tmp/rendered-project \
31-
--trust \
32-
--defaults \
33-
--overwrite \
34-
--data project_name=my-test-project \
35-
--data description="A test project" \
36-
--data author_name="Test Author" \
37-
--data author_email="test@example.com" \
38-
--data github_user=test-user
39-
- name: Lint
40-
working-directory: /tmp/rendered-project
41-
run: |
42-
uv run ruff check src/ tests/
43-
uv run ruff format --check src/ tests/
44-
- name: Type check
45-
working-directory: /tmp/rendered-project
46-
run: uv run mypy src/
47-
- name: Test
48-
working-directory: /tmp/rendered-project
49-
run: uv run pytest -v --cov=src --cov-report=xml
50-
- name: Audit
51-
working-directory: /tmp/rendered-project
52-
run: uv run pip-audit
53-
54-
validate-minimal:
55-
name: Validate (minimal)
56-
runs-on: ubuntu-latest
57-
steps:
58-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
59-
- uses: astral-sh/setup-uv@94527f2e458b27549849d47d273a16bec83a01e9 # v7
60-
with:
61-
version: "0.11.3"
62-
python-version: "3.12"
63-
- name: Configure git
64-
run: |
65-
git config --global user.name "CI"
66-
git config --global user.email "ci@test.com"
67-
- name: Render template (minimal)
68-
run: |
69-
TEMPLATE_DIR=$(mktemp -d)
70-
git archive HEAD | tar -C "$TEMPLATE_DIR" -xf -
71-
uvx copier copy "$TEMPLATE_DIR" /tmp/rendered-minimal \
72-
--trust \
73-
--defaults \
74-
--overwrite \
75-
--data project_name=minimal-project \
76-
--data description="A minimal project" \
77-
--data author_name="Test Author" \
78-
--data author_email="test@example.com" \
79-
--data github_user=test-user \
80-
--data ci_github=false \
81-
--data security=none \
82-
--data use_docker=none \
83-
--data use_docs=false \
84-
--data testing=minimal \
85-
--data use_ml=false \
86-
--data use_typecheck=false \
87-
--data use_devcontainer=false
88-
- name: Lint
89-
working-directory: /tmp/rendered-minimal
90-
run: |
91-
uv run ruff check src/ tests/
92-
uv run ruff format --check src/ tests/
93-
- name: Test
94-
working-directory: /tmp/rendered-minimal
95-
run: uv run pytest -v
96-
97-
validate-cli:
98-
name: Validate (use_cli)
99-
runs-on: ubuntu-latest
100-
steps:
101-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
102-
- uses: astral-sh/setup-uv@94527f2e458b27549849d47d273a16bec83a01e9 # v7
103-
with:
104-
version: "0.11.3"
105-
python-version: "3.12"
106-
- name: Configure git
107-
run: |
108-
git config --global user.name "CI"
109-
git config --global user.email "ci@test.com"
110-
- name: Render template (cli)
111-
run: |
112-
TEMPLATE_DIR=$(mktemp -d)
113-
git archive HEAD | tar -C "$TEMPLATE_DIR" -xf -
114-
uvx copier copy "$TEMPLATE_DIR" /tmp/rendered-cli \
115-
--trust \
116-
--defaults \
117-
--overwrite \
118-
--data project_name=cli-project \
119-
--data description="A CLI project" \
120-
--data author_name="Test Author" \
121-
--data author_email="test@example.com" \
122-
--data github_user=test-user \
123-
--data use_cli=true
124-
- name: Lint
125-
working-directory: /tmp/rendered-cli
126-
run: |
127-
uv run ruff check src/ tests/
128-
uv run ruff format --check src/ tests/
129-
- name: Type check
130-
working-directory: /tmp/rendered-cli
131-
run: uv run mypy src/
132-
- name: Test
133-
working-directory: /tmp/rendered-cli
134-
run: uv run pytest -v
135-
136-
validate-api:
137-
name: Validate (use_api)
138-
runs-on: ubuntu-latest
139-
steps:
140-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
141-
- uses: astral-sh/setup-uv@94527f2e458b27549849d47d273a16bec83a01e9 # v7
142-
with:
143-
version: "0.11.3"
144-
python-version: "3.12"
145-
- name: Configure git
146-
run: |
147-
git config --global user.name "CI"
148-
git config --global user.email "ci@test.com"
149-
- name: Render template (api)
150-
run: |
151-
TEMPLATE_DIR=$(mktemp -d)
152-
git archive HEAD | tar -C "$TEMPLATE_DIR" -xf -
153-
uvx copier copy "$TEMPLATE_DIR" /tmp/rendered-api \
154-
--trust \
155-
--defaults \
156-
--overwrite \
157-
--data project_name=api-project \
158-
--data description="An API project" \
159-
--data author_name="Test Author" \
160-
--data author_email="test@example.com" \
161-
--data github_user=test-user \
162-
--data use_api=true
163-
- name: Lint
164-
working-directory: /tmp/rendered-api
165-
run: |
166-
uv run ruff check src/ tests/
167-
uv run ruff format --check src/ tests/
168-
- name: Type check
169-
working-directory: /tmp/rendered-api
170-
run: uv run mypy src/
171-
- name: Test
172-
working-directory: /tmp/rendered-api
173-
run: uv run pytest -v --cov=src --cov-report=xml
174-
175-
validate-db:
176-
name: Validate (use_db)
177-
runs-on: ubuntu-latest
178-
steps:
179-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
180-
- uses: astral-sh/setup-uv@94527f2e458b27549849d47d273a16bec83a01e9 # v7
181-
with:
182-
version: "0.11.3"
183-
python-version: "3.12"
184-
- name: Configure git
185-
run: |
186-
git config --global user.name "CI"
187-
git config --global user.email "ci@test.com"
188-
- name: Render template (db)
189-
run: |
190-
TEMPLATE_DIR=$(mktemp -d)
191-
git archive HEAD | tar -C "$TEMPLATE_DIR" -xf -
192-
uvx copier copy "$TEMPLATE_DIR" /tmp/rendered-db \
193-
--trust \
194-
--defaults \
195-
--overwrite \
196-
--data project_name=db-project \
197-
--data description="A DB project" \
198-
--data author_name="Test Author" \
199-
--data author_email="test@example.com" \
200-
--data github_user=test-user \
201-
--data use_db=true
202-
- name: Lint
203-
working-directory: /tmp/rendered-db
204-
run: |
205-
uv run ruff check src/ tests/
206-
uv run ruff format --check src/ tests/
207-
- name: Type check
208-
working-directory: /tmp/rendered-db
209-
run: uv run mypy src/
210-
- name: Test
211-
working-directory: /tmp/rendered-db
212-
run: uv run pytest -v --cov=src --cov-report=xml
39+
- name: Validate ${{ matrix.variant }}
40+
run: just validate-${{ matrix.variant }}

justfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,12 @@ _validate name *data_flags:
2929
echo "{{ name }} passed"
3030

3131
# Validate with standard defaults
32-
validate:
32+
validate-standard:
3333
just _validate standard
3434

35+
# Alias for validate-standard
36+
validate: validate-standard
37+
3538
# Validate minimal config (everything off)
3639
validate-minimal:
3740
just _validate minimal \

0 commit comments

Comments
 (0)