Skip to content

typo

typo #3

Workflow file for this run

name: E2E Tests
on:
push:
branches: [ edge, stable ]
pull_request:
branches: [ edge, stable ]
jobs:
cypress-run:
runs-on: ubuntu-latest
steps:
- 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 to the certs directory for Docker 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 all services defined in test compose file
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: 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 service logs
if: always()
run: |
# Show logs from critical services for debugging
echo "=== OIDC Simulator logs ==="
docker compose -f docker-compose.test.yml logs oidc-simulator | tail -100
echo "=== Server logs ==="
docker compose -f docker-compose.test.yml logs server | tail -100
- 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
- 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: Upload Cypress screenshots
if: failure()
uses: actions/upload-artifact@v4
with:
name: cypress-screenshots
path: e2e/cypress/screenshots
if-no-files-found: ignore
- name: Upload Cypress videos
if: always()
uses: actions/upload-artifact@v4
with:
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