|
5 | 5 | branches: [main] |
6 | 6 | pull_request: |
7 | 7 | branches: [main] |
| 8 | + # The release workflow runs the same checks on the tagged commit before publishing anything (spec 009). |
| 9 | + workflow_call: |
8 | 10 |
|
9 | 11 | permissions: |
10 | 12 | contents: read |
|
26 | 28 | os: [ubuntu-latest, windows-latest] |
27 | 29 | runs-on: ${{ matrix.os }} |
28 | 30 | steps: |
| 31 | + # Full history: MinVer computes the package version from the tags (D-179). |
29 | 32 | - uses: actions/checkout@v7 |
| 33 | + with: |
| 34 | + fetch-depth: 0 |
30 | 35 |
|
31 | 36 | - uses: actions/setup-dotnet@v6 |
32 | 37 | with: |
|
48 | 53 | - name: Build |
49 | 54 | run: dotnet build --no-restore --configuration Release |
50 | 55 |
|
| 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 | +
|
51 | 68 | # weasyprint (CS-2 fixture, html-para-pdf) renders with pango. |
52 | 69 | - name: Install pango |
53 | 70 | if: runner.os == 'Linux' |
@@ -82,19 +99,120 @@ jobs: |
82 | 99 | if: runner.os == 'Windows' |
83 | 100 | run: dotnet test --no-build --configuration Release --project tests/PythonScriptRunner.Core.Tests |
84 | 101 |
|
85 | | - format: |
86 | | - name: .NET format |
| 102 | + quality: |
| 103 | + name: Quality |
87 | 104 | runs-on: ubuntu-latest |
88 | 105 | steps: |
89 | 106 | - uses: actions/checkout@v7 |
| 107 | + with: |
| 108 | + fetch-depth: 0 |
90 | 109 |
|
91 | 110 | - uses: actions/setup-dotnet@v6 |
92 | 111 | with: |
93 | 112 | global-json-file: global.json |
94 | 113 |
|
| 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 | + |
95 | 122 | - name: Verify formatting |
96 | 123 | run: dotnet format --verify-no-changes |
97 | 124 |
|
| 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 | + |
98 | 216 | panel: |
99 | 217 | name: Panel (Vue) |
100 | 218 | runs-on: ubuntu-latest |
|
0 commit comments