Skip to content

Commit e3176b5

Browse files
net0wellclaude
andcommitted
ci: imagens, AppHost, empacotamento e auditoria de dependências (spec 009)
- O ci.yml fica reutilizável (workflow_call): o release roda as mesmas checagens no commit da tag antes de publicar qualquer coisa. - Checkout com histórico completo, para o MinVer calcular a versão. - AC-5 em modo de teste: `dotnet pack` dos 7 pacotes, conferindo uma versão só e os pacotes de símbolos. - Job Containers: constrói as imagens com cache e roda AC-3 (compose do `aspire publish`), AC-7, AC-8 e AC-30 (cgroup). - Job Aspire AppHost: AC-1 e AC-2 (CS-1 e CS-2 com o e-mail no Mailpit). - O job de formato vira Quality e audita pacotes vulneráveis: NuGet com os transitivos, npm do painel (high e critical) e pip do SDK. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent b410fe2 commit e3176b5

1 file changed

Lines changed: 120 additions & 2 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 120 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
branches: [main]
66
pull_request:
77
branches: [main]
8+
# The release workflow runs the same checks on the tagged commit before publishing anything (spec 009).
9+
workflow_call:
810

911
permissions:
1012
contents: read
@@ -26,7 +28,10 @@ jobs:
2628
os: [ubuntu-latest, windows-latest]
2729
runs-on: ${{ matrix.os }}
2830
steps:
31+
# Full history: MinVer computes the package version from the tags (D-179).
2932
- uses: actions/checkout@v7
33+
with:
34+
fetch-depth: 0
3035

3136
- uses: actions/setup-dotnet@v6
3237
with:
@@ -48,6 +53,18 @@ jobs:
4853
- name: Build
4954
run: dotnet build --no-restore --configuration Release
5055

56+
# AC-5 in dry-run: the 7 packages (6 libraries + the psr tool) with one version, symbols included.
57+
- name: Pack (dry run)
58+
if: runner.os == 'Linux'
59+
run: |
60+
dotnet pack PythonScriptRunner.slnx --no-build --configuration Release --output artifacts/packages
61+
ls artifacts/packages
62+
count=$(ls artifacts/packages/*.nupkg | wc -l)
63+
versions=$(ls artifacts/packages/*.nupkg | sed -E 's#.*/PythonScriptRunner(\.[A-Za-z]+)+\.([0-9].*)\.nupkg#\2#' | sort -u | wc -l)
64+
test "$count" -eq 7 || { echo "Expected 7 packages, got $count"; exit 1; }
65+
test "$versions" -eq 1 || { echo "The packages do not share one version"; exit 1; }
66+
test "$(ls artifacts/packages/*.snupkg | wc -l)" -eq 7 || { echo "Missing symbol packages"; exit 1; }
67+
5168
# weasyprint (CS-2 fixture, html-para-pdf) renders with pango.
5269
- name: Install pango
5370
if: runner.os == 'Linux'
@@ -82,19 +99,120 @@ jobs:
8299
if: runner.os == 'Windows'
83100
run: dotnet test --no-build --configuration Release --project tests/PythonScriptRunner.Core.Tests
84101

85-
format:
86-
name: .NET format
102+
quality:
103+
name: Quality
87104
runs-on: ubuntu-latest
88105
steps:
89106
- uses: actions/checkout@v7
107+
with:
108+
fetch-depth: 0
90109

91110
- uses: actions/setup-dotnet@v6
92111
with:
93112
global-json-file: global.json
94113

114+
- uses: astral-sh/setup-uv@v10.3.0
115+
116+
- uses: actions/setup-node@v7
117+
with:
118+
node-version-file: panel/.nvmrc
119+
cache: npm
120+
cache-dependency-path: panel/package-lock.json
121+
95122
- name: Verify formatting
96123
run: dotnet format --verify-no-changes
97124

125+
# Dependency audit (spec 009): known vulnerabilities in NuGet packages (transitive included), in the panel's
126+
# runtime npm packages (high and critical) and in the Python SDK's dependencies.
127+
- name: Audit NuGet packages
128+
run: |
129+
dotnet list PythonScriptRunner.slnx package --vulnerable --include-transitive | tee vulnerable.txt
130+
if grep -q "has the following vulnerable packages" vulnerable.txt; then exit 1; fi
131+
132+
- name: Audit npm packages
133+
working-directory: panel
134+
run: npm audit --omit=dev --audit-level=high
135+
136+
- name: Audit Python packages
137+
working-directory: python/psrunner
138+
run: |
139+
uv export --frozen --no-dev --no-emit-project --no-hashes --format requirements-txt > requirements-audit.txt
140+
uvx pip-audit --requirement requirements-audit.txt --no-deps --disable-pip
141+
142+
# Spec 009, AC-3/AC-7/AC-8 and spec 001, AC-30: the host images as they run in production, and the docker-compose
143+
# generated by `aspire publish`.
144+
containers:
145+
name: Containers
146+
runs-on: ubuntu-latest
147+
steps:
148+
- uses: actions/checkout@v7
149+
with:
150+
fetch-depth: 0
151+
152+
- uses: actions/setup-dotnet@v6
153+
with:
154+
global-json-file: global.json
155+
156+
- uses: docker/setup-buildx-action@v4
157+
158+
- name: Build the worker image
159+
uses: docker/build-push-action@v7
160+
with:
161+
context: .
162+
file: hosts/PythonScriptRunner.WorkerHost/Dockerfile
163+
tags: psr-worker:ci
164+
load: true
165+
cache-from: type=gha,scope=psr-worker
166+
cache-to: type=gha,scope=psr-worker,mode=max
167+
168+
- name: Build the dashboard image
169+
uses: docker/build-push-action@v7
170+
with:
171+
context: .
172+
file: hosts/PythonScriptRunner.DashboardHost/Dockerfile
173+
tags: psr-dashboard:ci
174+
load: true
175+
cache-from: type=gha,scope=psr-dashboard
176+
cache-to: type=gha,scope=psr-dashboard,mode=max
177+
178+
- name: Install the Aspire CLI
179+
run: dotnet tool install --global Aspire.Cli --version 13.6.2
180+
181+
- name: Test
182+
run: dotnet test --project tests/PythonScriptRunner.Containers.Tests
183+
env:
184+
PSR_TEST_WORKER_IMAGE: psr-worker:ci
185+
PSR_TEST_DASHBOARD_IMAGE: psr-dashboard:ci
186+
187+
# Spec 009, AC-1/AC-2: the Aspire AppHost brings everything up and the author runs CS-1 and CS-2.
188+
apphost:
189+
name: Aspire AppHost
190+
runs-on: ubuntu-latest
191+
steps:
192+
- uses: actions/checkout@v7
193+
with:
194+
fetch-depth: 0
195+
196+
- uses: actions/setup-dotnet@v6
197+
with:
198+
global-json-file: global.json
199+
200+
- uses: astral-sh/setup-uv@v10.3.0
201+
202+
# The panel runs as a Vite app inside the AppHost.
203+
- uses: actions/setup-node@v7
204+
with:
205+
node-version-file: panel/.nvmrc
206+
cache: npm
207+
cache-dependency-path: panel/package-lock.json
208+
209+
# weasyprint (CS-2) renders with pango.
210+
- name: Install pango
211+
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends libpango-1.0-0 libpangoft2-1.0-0 libharfbuzz0b fonts-dejavu-core
212+
213+
- name: Test
214+
run: dotnet test --project tests/PythonScriptRunner.AppHost.Tests
215+
98216
panel:
99217
name: Panel (Vue)
100218
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)