Skip to content

Commit 8defe70

Browse files
authored
Merge pull request #9 from ScriptRunnerKit/fase-7/hosts-devops
Fase 7: hosts e DevOps — imagens, Aspire, release e arquivos open source (spec 009)
2 parents e1c2ab6 + 3fb20c4 commit 8defe70

60 files changed

Lines changed: 2691 additions & 202 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.dockerignore‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
**/bin/
2+
**/obj/
3+
**/node_modules/
4+
**/.venv/
5+
**/__pycache__/
6+
**/TestResults/
7+
panel/dist/
8+
.git/
9+
.github/
10+
.vs/
11+
.vscode/
12+
.idea/
13+
docs/
14+
tests/
15+
artifacts/
16+
*.user

‎.github/dependabot.yml‎

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Weekly dependency updates (spec 009, D-184): one grouped pull request per ecosystem for minor and patch versions;
2+
# majors arrive one by one so they can be reviewed against the decisions that pinned them.
3+
version: 2
4+
updates:
5+
- package-ecosystem: nuget
6+
directory: /
7+
schedule:
8+
interval: weekly
9+
day: monday
10+
open-pull-requests-limit: 5
11+
groups:
12+
aspire:
13+
patterns: ["Aspire.*"]
14+
update-types: [minor, patch]
15+
dotnet:
16+
patterns: ["Microsoft.*", "System.*", "Npgsql*"]
17+
update-types: [minor, patch]
18+
testing:
19+
patterns: ["xunit*", "Shouldly", "Testcontainers*", "Microsoft.Playwright", "Deque.*"]
20+
update-types: [minor, patch]
21+
other:
22+
patterns: ["*"]
23+
update-types: [minor, patch]
24+
25+
- package-ecosystem: npm
26+
directory: /panel
27+
schedule:
28+
interval: weekly
29+
day: monday
30+
open-pull-requests-limit: 5
31+
groups:
32+
panel:
33+
patterns: ["*"]
34+
update-types: [minor, patch]
35+
36+
- package-ecosystem: uv
37+
directory: /python/psrunner
38+
schedule:
39+
interval: weekly
40+
day: monday
41+
groups:
42+
psrunner-dev:
43+
patterns: ["*"]
44+
update-types: [minor, patch]
45+
46+
- package-ecosystem: github-actions
47+
directory: /
48+
schedule:
49+
interval: weekly
50+
day: monday
51+
groups:
52+
actions:
53+
patterns: ["*"]

‎.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
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Release (psrunner)
2+
3+
# A tag python/vX.Y.Z publishes the psrunner SDK to PyPI with trusted publishing (OIDC, no stored token; spec 009,
4+
# AC-6). The SDK has its own version, compatible with protocol 1 while it is 1.x; the CI must be green on the commit.
5+
on:
6+
push:
7+
tags: ['python/v*']
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
ci:
14+
name: CI
15+
uses: ./.github/workflows/ci.yml
16+
17+
publish:
18+
name: PyPI
19+
needs: ci
20+
runs-on: ubuntu-latest
21+
environment:
22+
name: pypi
23+
url: https://pypi.org/project/psrunner/
24+
permissions:
25+
id-token: write
26+
defaults:
27+
run:
28+
working-directory: python/psrunner
29+
steps:
30+
- uses: actions/checkout@v7
31+
32+
- uses: astral-sh/setup-uv@v10.3.0
33+
34+
- name: Check the version
35+
run: |
36+
expected="${GITHUB_REF_NAME#python/v}"
37+
actual=$(uv run --no-project python -c "exec(open('src/psrunner/_version.py').read()); print(__version__)")
38+
test "$actual" = "$expected" || { echo "src/psrunner/_version.py has $actual, the tag says $expected"; exit 1; }
39+
40+
- name: Build
41+
run: uv build --out-dir dist
42+
43+
- uses: pypa/gh-action-pypi-publish@release/v1
44+
with:
45+
packages-dir: python/psrunner/dist

0 commit comments

Comments
 (0)