Skip to content
Open
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
21 changes: 2 additions & 19 deletions .github/workflows/client-participation-alpha-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,8 @@ jobs:
cache: "npm"
cache-dependency-path: client-participation-alpha/package-lock.json

- name: Install dependencies
run: npm ci
working-directory: client-participation-alpha

- name: Check formatting
run: npm run format -- --check
working-directory: client-participation-alpha

- name: Run linter
run: npm run lint
working-directory: client-participation-alpha

- name: Run tests with coverage
run: npm run test:coverage
working-directory: client-participation-alpha

- name: Build
run: npm run build
working-directory: client-participation-alpha
- name: Install, check and test (ci/local/client-alpha.sh)
run: make check-client-alpha

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
Expand Down
54 changes: 9 additions & 45 deletions .github/workflows/collective-statement-recordings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,18 @@ jobs:
fetch-depth: 0
persist-credentials: false
- name: The collective-statement recordings never change together with the code they record
run: sh ci/collective_statement_golden_guard.sh "origin/${{ github.base_ref }}"
env:
BASE_REF: origin/${{ github.base_ref }}
run: make check-collective-statement-guard

replay:
runs-on: ubuntu-24.04
timeout-minutes: 20
services:
postgres:
image: postgres:17.11@sha256:f4c66b820c6f974249089d3d16d86a3698eae11e8746eb6644b2271031e91232
env:
POSTGRES_PASSWORD: generatedlocal
ports: ["127.0.0.1:5481:5432"]
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 2s --health-timeout 2s --health-retries 30
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

# Started by hand rather than as a service: -sharedDb needs a command
# argument, and without it DynamoDB Local keys its data by access key.
- name: Start DynamoDB Local
run: docker run -d --name csrec-dynamodb -p 127.0.0.1:8481:8000 amazon/dynamodb-local:3.3.1@sha256:ff89bd48ff32cd8d9be5fee8873b65b8854dc408f1afe881be6eb00247bc0dab -jar DynamoDBLocal.jar -sharedDb -inMemory

- uses: actions/setup-node@v4
with:
# The recordings were made on this Node; V8's error wording can
Expand All @@ -72,33 +60,9 @@ jobs:
with:
python-version: "3.12"

- name: Install server dependencies and the reset routine's boto3 (delphi's locked versions)
run: |
npm ci --prefix server --no-audit --no-fund
python -m pip install --quiet boto3==1.34.70 botocore==1.34.162 s3transfer==0.10.4

- name: The harness's own rules (expected differences, refusal of foreign stores)
working-directory: server
run: node --test characterization/collective-statement/expected.test.cjs characterization/collective-statement/safety.test.cjs

- name: Replay every recorded case against the current routes
working-directory: server
env:
CSREC_PG_ADMIN_URL: postgres://postgres:generatedlocal@127.0.0.1:5481/postgres
DYNAMODB_ENDPOINT: http://127.0.0.1:8481
CSREC_PYTHON: python
TZ: UTC
run: node characterization/collective-statement/main.cjs replay

- name: Every listed mutation of the route fails exactly its named cases
working-directory: server
env:
CSREC_PG_ADMIN_URL: postgres://postgres:generatedlocal@127.0.0.1:5481/postgres
DYNAMODB_ENDPOINT: http://127.0.0.1:8481
CSREC_PYTHON: python
TZ: UTC
run: node characterization/collective-statement/mutations.cjs

- name: Remove DynamoDB Local
if: always()
run: docker rm -f csrec-dynamodb
# PostgreSQL 17.11 (host port 5481) and DynamoDB Local (8481), both pinned
# by digest, the server modules, the reset routine's boto3 (delphi's locked
# versions), the harness's own rules, the replay and the mutation check live
# in ci/local/collective-statement.sh: `make check-collective-statement`.
- name: Harness rules, replay of every recorded case, every listed mutation
run: make check-collective-statement
159 changes: 5 additions & 154 deletions .github/workflows/cypress-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,159 +34,15 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Install mkcert
run: |
# Install mkcert for certificate generation
curl -JLO "https://dl.filippo.io/mkcert/latest?for=linux/amd64"
chmod +x mkcert-v*-linux-amd64
sudo cp mkcert-v*-linux-amd64 /usr/local/bin/mkcert

# Install CA in system trust store
mkcert -install

- name: Generate certificates
run: |
# Create certificate directory in workspace (not home directory)
mkdir -p ./.simulacrum/certs
cd ./.simulacrum/certs

# Generate certificates for all required hostnames
mkcert -cert-file localhost.pem -key-file localhost-key.pem \
localhost 127.0.0.1 ::1 oidc-simulator host.docker.internal

# Copy mkcert root CA for other containers
cp "$(mkcert -CAROOT)/rootCA.pem" ./rootCA.pem

# List generated files for debugging
echo "Generated certificates:"
ls -la

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Create test.env with CI-specific paths
run: |
# Update AUTH_CERTS_PATH to use workspace-relative path
sed -i 's|AUTH_CERTS_PATH=.*|AUTH_CERTS_PATH=./.simulacrum/certs|' test.env

# Copy test.env to .env for docker-compose variable interpolation
cp test.env .env

# Show relevant env vars for debugging
echo "Auth-related environment variables:"
grep -E "AUTH_|CERT|DATABASE_URL|POSTGRES_" test.env || true

- name: Build Docker images
run: |
# Build postgres with --no-cache to ensure latest migrations are used
# Docker layer caching can cause old migration files to persist
docker compose -f docker-compose.test.yml --env-file test.env build --no-cache postgres

# Build remaining services (caching OK for these)
docker compose -f docker-compose.test.yml --env-file test.env build

- name: Start services
run: |
# Start all services in detached mode
docker compose -f docker-compose.test.yml --env-file test.env up -d

# Wait for services to be ready
echo "Waiting for services to start..."
sleep 30

# Show running containers
docker compose -f docker-compose.test.yml ps

- name: Run Database Migrations
env:
DATABASE_URL: postgres://postgres:PdwPNS2mDN73Vfbc@localhost:5432/polis-test
POSTGRES_DB: polis-test
POSTGRES_HOST: postgres:5432
POSTGRES_PASSWORD: PdwPNS2mDN73Vfbc
POSTGRES_PORT: 5432
POSTGRES_USER: postgres
run: |
echo "Installing postgres-client..."
sudo apt-get update && sudo apt-get install -y postgresql-client

echo "Making migration script executable..."
chmod +x server/bin/run-migrations.sh

echo "Running migrations..."
./server/bin/run-migrations.sh

- name: Check service health
run: |
# Check if key services are responding
echo "Checking postgres..."
docker compose -f docker-compose.test.yml exec -T postgres pg_isready -U postgres || true

echo "Checking oidc-simulator..."
curl -k -f https://localhost:3000/.well-known/jwks.json || true

echo "Checking server API..."
curl -f http://localhost/api/v3/participationInit || true

- name: Show postgres initialization logs
if: always()
run: |
echo "=== Postgres container logs (shows migration execution) ==="
docker compose -f docker-compose.test.yml logs postgres | head -200

- name: Show service logs
if: always()
run: |
# Show logs from critical services for debugging
echo "=== NGINX Proxy logs ==="
docker compose -f docker-compose.test.yml logs nginx-proxy || true

echo "=== OIDC Simulator logs ==="
docker compose -f docker-compose.test.yml logs oidc-simulator || true

echo "=== Server logs ==="
docker compose -f docker-compose.test.yml logs server || true

- name: Run auth setup test
run: |
cd e2e
npm install dotenv

# Copy test.env to e2e directory for Cypress to read
cp ../test.env .env

# Update AUTH_CERTS_PATH to be relative to e2e directory
sed -i 's|AUTH_CERTS_PATH=.*|AUTH_CERTS_PATH=../.simulacrum/certs|' .env

# Set environment variables for the test script
export AUTH_CERTS_PATH=../.simulacrum/certs
export CYPRESS_BASE_URL=http://localhost
export AUTH_ISSUER=https://localhost:3000/

# Run the validation script
node test-auth-setup.js

- name: Install Cypress dependencies
run: |
cd e2e
npm ci

# Certificates, the edited test.env, the image builds (postgres without the
# cache), the stack with readiness waits, the migration re-run, the auth
# setup check, Cypress and teardown all live in ci/local/e2e.sh, so
# `make check-e2e` gives the same verdict on any Docker host.
- name: Run Cypress E2E tests
run: |
cd e2e

# Set environment variables for Cypress
export NODE_EXTRA_CA_CERTS=$(pwd)/../.simulacrum/certs/rootCA.pem
export CYPRESS_BASE_URL=http://localhost
export AUTH_ISSUER=https://localhost:3000/
export AUTH_CERTS_PATH=$(pwd)/../.simulacrum/certs

# Run all Cypress tests
npm test

- name: Show math engine logs
if: failure()
run: |
docker compose -f docker-compose.test.yml logs --tail 300 math-python || true
run: make check-e2e

- name: Upload Cypress screenshots
if: failure()
Expand All @@ -203,8 +59,3 @@ jobs:
name: cypress-videos
path: e2e/cypress/videos
if-no-files-found: ignore

- name: Clean up
if: always()
run: |
docker compose -f docker-compose.test.yml down -v
48 changes: 6 additions & 42 deletions .github/workflows/delphi-characterization.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,11 @@ jobs:
replay:
runs-on: ubuntu-24.04
timeout-minutes: 20
services:
postgres:
image: postgres:17.11
env:
POSTGRES_PASSWORD: generatedlocal
ports: ["5472:5432"]
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 2s --health-timeout 2s --health-retries 30
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false

# Started by hand rather than as a service: -sharedDb needs a command
# argument, and without it DynamoDB Local keys its data by access key.
- name: Start DynamoDB Local
run: docker run -d --name p2zero-dynamodb -p 127.0.0.1:8472:8000 amazon/dynamodb-local:3.3.1@sha256:ff89bd48ff32cd8d9be5fee8873b65b8854dc408f1afe881be6eb00247bc0dab -jar DynamoDBLocal.jar -sharedDb -inMemory

- uses: actions/setup-node@v4
with:
node-version: "22"
Expand All @@ -55,31 +41,9 @@ jobs:
with:
python-version: "3.12"

- name: Install server dependencies
working-directory: server
run: npm ci --no-audit --no-fund

- name: Codec golden test (Python writes, reads the file Node wrote)
working-directory: delphi
run: |
python -m pip install --quiet pyyaml
python -m unittest tests.test_delphi_storage_codec -v

- name: Codec golden test (Node reads the files Python wrote, writes the cross file)
working-directory: server
run: npx jest --config characterization/delphi/jest.codec.config.json

- name: Fixtures regenerate byte for byte
run: python3 server/characterization/delphi/generate.py --check

- name: Replay every recorded case against the current routes
working-directory: server
env:
P2ZERO_PG_ADMIN_URL: postgres://postgres:generatedlocal@127.0.0.1:5472/postgres
DYNAMODB_ENDPOINT: http://127.0.0.1:8472
TZ: UTC
run: node characterization/delphi/main.cjs replay

- name: Remove DynamoDB Local
if: always()
run: docker rm -f p2zero-dynamodb
# PostgreSQL 17.11 (host port 5472) and DynamoDB Local pinned by digest
# (8472, -sharedDb -inMemory), the server modules, the codec tests in both
# languages, the fixture regeneration check and the replay live in
# ci/local/delphi-characterization.sh: `make check-delphi-characterization`.
- name: Codec, fixtures and replay of every recorded case
run: make check-delphi-characterization
9 changes: 2 additions & 7 deletions .github/workflows/jest-client-admin-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,8 @@ jobs:
cache: 'npm'
cache-dependency-path: client-admin/package-lock.json

- name: Install dependencies
run: npm ci
working-directory: client-admin

- name: Run Jest tests with coverage
run: npm run test:coverage
working-directory: client-admin
- name: Install, check and test (ci/local/client-admin.sh)
run: make check-client-admin

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/jest-client-report-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,5 @@ jobs:
with:
node-version: '24'

- name: Install dependencies
run: npm install
working-directory: client-report

- name: Run Jest tests
run: npm test
working-directory: client-report
- name: Install and run the Jest tests (ci/local/client-report.sh)
run: make check-client-report
Loading
Loading