Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
**/bin/
**/obj/
**/node_modules/
**/.venv/
**/__pycache__/
**/TestResults/
panel/dist/
.git/
.github/
.vs/
.vscode/
.idea/
docs/
tests/
artifacts/
*.user
53 changes: 53 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Weekly dependency updates (spec 009, D-184): one grouped pull request per ecosystem for minor and patch versions;
# majors arrive one by one so they can be reviewed against the decisions that pinned them.
version: 2
updates:
- package-ecosystem: nuget
directory: /
schedule:
interval: weekly
day: monday
open-pull-requests-limit: 5
groups:
aspire:
patterns: ["Aspire.*"]
update-types: [minor, patch]
dotnet:
patterns: ["Microsoft.*", "System.*", "Npgsql*"]
update-types: [minor, patch]
testing:
patterns: ["xunit*", "Shouldly", "Testcontainers*", "Microsoft.Playwright", "Deque.*"]
update-types: [minor, patch]
other:
patterns: ["*"]
update-types: [minor, patch]

- package-ecosystem: npm
directory: /panel
schedule:
interval: weekly
day: monday
open-pull-requests-limit: 5
groups:
panel:
patterns: ["*"]
update-types: [minor, patch]

- package-ecosystem: uv
directory: /python/psrunner
schedule:
interval: weekly
day: monday
groups:
psrunner-dev:
patterns: ["*"]
update-types: [minor, patch]

- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
day: monday
groups:
actions:
patterns: ["*"]
122 changes: 120 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
branches: [main]
pull_request:
branches: [main]
# The release workflow runs the same checks on the tagged commit before publishing anything (spec 009).
workflow_call:

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

- uses: actions/setup-dotnet@v6
with:
Expand All @@ -48,6 +53,18 @@ jobs:
- name: Build
run: dotnet build --no-restore --configuration Release

# AC-5 in dry-run: the 7 packages (6 libraries + the psr tool) with one version, symbols included.
- name: Pack (dry run)
if: runner.os == 'Linux'
run: |
dotnet pack PythonScriptRunner.slnx --no-build --configuration Release --output artifacts/packages
ls artifacts/packages
count=$(ls artifacts/packages/*.nupkg | wc -l)
versions=$(ls artifacts/packages/*.nupkg | sed -E 's#.*/PythonScriptRunner(\.[A-Za-z]+)+\.([0-9].*)\.nupkg#\2#' | sort -u | wc -l)
test "$count" -eq 7 || { echo "Expected 7 packages, got $count"; exit 1; }
test "$versions" -eq 1 || { echo "The packages do not share one version"; exit 1; }
test "$(ls artifacts/packages/*.snupkg | wc -l)" -eq 7 || { echo "Missing symbol packages"; exit 1; }

# weasyprint (CS-2 fixture, html-para-pdf) renders with pango.
- name: Install pango
if: runner.os == 'Linux'
Expand Down Expand Up @@ -82,19 +99,120 @@ jobs:
if: runner.os == 'Windows'
run: dotnet test --no-build --configuration Release --project tests/PythonScriptRunner.Core.Tests

format:
name: .NET format
quality:
name: Quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0

- uses: actions/setup-dotnet@v6
with:
global-json-file: global.json

- uses: astral-sh/setup-uv@v10.3.0

- uses: actions/setup-node@v7
with:
node-version-file: panel/.nvmrc
cache: npm
cache-dependency-path: panel/package-lock.json

- name: Verify formatting
run: dotnet format --verify-no-changes

# Dependency audit (spec 009): known vulnerabilities in NuGet packages (transitive included), in the panel's
# runtime npm packages (high and critical) and in the Python SDK's dependencies.
- name: Audit NuGet packages
run: |
dotnet list PythonScriptRunner.slnx package --vulnerable --include-transitive | tee vulnerable.txt
if grep -q "has the following vulnerable packages" vulnerable.txt; then exit 1; fi

- name: Audit npm packages
working-directory: panel
run: npm audit --omit=dev --audit-level=high

- name: Audit Python packages
working-directory: python/psrunner
run: |
uv export --frozen --no-dev --no-emit-project --no-hashes --format requirements-txt > requirements-audit.txt
uvx pip-audit --requirement requirements-audit.txt --no-deps --disable-pip

# 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
# generated by `aspire publish`.
containers:
name: Containers
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0

- uses: actions/setup-dotnet@v6
with:
global-json-file: global.json

- uses: docker/setup-buildx-action@v4

- name: Build the worker image
uses: docker/build-push-action@v7
with:
context: .
file: hosts/PythonScriptRunner.WorkerHost/Dockerfile
tags: psr-worker:ci
load: true
cache-from: type=gha,scope=psr-worker
cache-to: type=gha,scope=psr-worker,mode=max

- name: Build the dashboard image
uses: docker/build-push-action@v7
with:
context: .
file: hosts/PythonScriptRunner.DashboardHost/Dockerfile
tags: psr-dashboard:ci
load: true
cache-from: type=gha,scope=psr-dashboard
cache-to: type=gha,scope=psr-dashboard,mode=max

- name: Install the Aspire CLI
run: dotnet tool install --global Aspire.Cli --version 13.6.2

- name: Test
run: dotnet test --project tests/PythonScriptRunner.Containers.Tests
env:
PSR_TEST_WORKER_IMAGE: psr-worker:ci
PSR_TEST_DASHBOARD_IMAGE: psr-dashboard:ci

# Spec 009, AC-1/AC-2: the Aspire AppHost brings everything up and the author runs CS-1 and CS-2.
apphost:
name: Aspire AppHost
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0

- uses: actions/setup-dotnet@v6
with:
global-json-file: global.json

- uses: astral-sh/setup-uv@v10.3.0

# The panel runs as a Vite app inside the AppHost.
- uses: actions/setup-node@v7
with:
node-version-file: panel/.nvmrc
cache: npm
cache-dependency-path: panel/package-lock.json

# weasyprint (CS-2) renders with pango.
- name: Install pango
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

- name: Test
run: dotnet test --project tests/PythonScriptRunner.AppHost.Tests

panel:
name: Panel (Vue)
runs-on: ubuntu-latest
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/release-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Release (psrunner)

# A tag python/vX.Y.Z publishes the psrunner SDK to PyPI with trusted publishing (OIDC, no stored token; spec 009,
# 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.
on:
push:
tags: ['python/v*']

permissions:
contents: read

jobs:
ci:
name: CI
uses: ./.github/workflows/ci.yml

publish:
name: PyPI
needs: ci
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/psrunner/
permissions:
id-token: write
defaults:
run:
working-directory: python/psrunner
steps:
- uses: actions/checkout@v7

- uses: astral-sh/setup-uv@v10.3.0

- name: Check the version
run: |
expected="${GITHUB_REF_NAME#python/v}"
actual=$(uv run --no-project python -c "exec(open('src/psrunner/_version.py').read()); print(__version__)")
test "$actual" = "$expected" || { echo "src/psrunner/_version.py has $actual, the tag says $expected"; exit 1; }

- name: Build
run: uv build --out-dir dist

- uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: python/psrunner/dist
Loading
Loading