|
| 1 | +name: Accessibility Scanner |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + # TODO: remove push trigger before merging — workflow_dispatch only works from the default branch |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - a11y-scanner-setup |
| 9 | + |
| 10 | +jobs: |
| 11 | + accessibility_scanner: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + permissions: |
| 14 | + contents: read |
| 15 | + packages: read |
| 16 | + env: |
| 17 | + AUTH_INITIAL_ADMIN_USERNAME: admin@example.com |
| 18 | + AUTH_INITIAL_ADMIN_PASSWORD: secret |
| 19 | + steps: |
| 20 | + - name: Create Docker network |
| 21 | + run: docker network create a11y-network |
| 22 | + |
| 23 | + - name: Start database |
| 24 | + run: | |
| 25 | + docker run -d \ |
| 26 | + --network a11y-network \ |
| 27 | + --name postgres \ |
| 28 | + -e POSTGRES_USER=admin \ |
| 29 | + -e POSTGRES_PASSWORD=secret \ |
| 30 | + -e POSTGRES_DB=cccc \ |
| 31 | + pgvector/pgvector:pg16 |
| 32 | +
|
| 33 | + - name: Wait for database |
| 34 | + run: | |
| 35 | + db_ready=false |
| 36 | + for i in $(seq 1 30); do |
| 37 | + if docker exec postgres pg_isready -U admin -d cccc; then |
| 38 | + echo "Database is ready" |
| 39 | + db_ready=true |
| 40 | + break |
| 41 | + fi |
| 42 | + echo "Waiting for database... ($i/30)" |
| 43 | + sleep 1 |
| 44 | + done |
| 45 | +
|
| 46 | + if [ "$db_ready" != "true" ]; then |
| 47 | + echo "Database did not become ready in time" |
| 48 | + exit 1 |
| 49 | + fi |
| 50 | +
|
| 51 | + - name: Start backend |
| 52 | + run: | |
| 53 | + docker run -d \ |
| 54 | + --network a11y-network \ |
| 55 | + --name backend \ |
| 56 | + -e BASE_URL="http://localhost:3080" \ |
| 57 | + -e DB_URL="postgres://admin:secret@postgres:5432/cccc" \ |
| 58 | + -e C4_DB_RETRY_DELAY="6000" \ |
| 59 | + -e NODE_ENV="development" \ |
| 60 | + -e AUTH_ENABLE_PASSWORD="true" \ |
| 61 | + -e AUTH_INITIAL_ADMIN_USERNAME="${{ env.AUTH_INITIAL_ADMIN_USERNAME }}" \ |
| 62 | + -e AUTH_INITIAL_ADMIN_PASSWORD="${{ env.AUTH_INITIAL_ADMIN_PASSWORD }}" \ |
| 63 | + -e SESSION_SECRET="a11y-scanner-session-secret" \ |
| 64 | + ghcr.io/codecentric/c4-genai-suite/backend:latest |
| 65 | +
|
| 66 | + - name: Start frontend |
| 67 | + run: | |
| 68 | + docker run -d \ |
| 69 | + --network a11y-network \ |
| 70 | + --name frontend \ |
| 71 | + ghcr.io/codecentric/c4-genai-suite/frontend:latest |
| 72 | +
|
| 73 | + - name: Start gateway proxy |
| 74 | + run: | |
| 75 | + docker run -d \ |
| 76 | + -p 3080:3080 \ |
| 77 | + --network a11y-network \ |
| 78 | + --name gateway \ |
| 79 | + -e FRONTEND_PORT=3080 \ |
| 80 | + -e PORT=3080 \ |
| 81 | + -e BACKEND_PORT=3000 \ |
| 82 | + ghcr.io/codecentric/c4-genai-suite/dev-helper/caddy-gateway-proxy:latest |
| 83 | +
|
| 84 | + - name: Wait for application |
| 85 | + run: | |
| 86 | + app_ready=false |
| 87 | + for i in $(seq 1 60); do |
| 88 | + if curl -sf http://localhost:3080/api/health > /dev/null 2>&1; then |
| 89 | + echo "Application is ready!" |
| 90 | + app_ready=true |
| 91 | + break |
| 92 | + fi |
| 93 | + echo "Waiting for application... ($i/60)" |
| 94 | + sleep 2 |
| 95 | + done |
| 96 | +
|
| 97 | + if [ "$app_ready" != "true" ]; then |
| 98 | + echo "Application did not become ready in time" |
| 99 | + exit 1 |
| 100 | + fi |
| 101 | +
|
| 102 | + - uses: github/accessibility-scanner@v2 |
| 103 | + with: |
| 104 | + urls: | |
| 105 | + http://localhost:3080 |
| 106 | + http://localhost:3080/chat |
| 107 | + http://localhost:3080/admin/dashboard |
| 108 | + http://localhost:3080/admin/theme |
| 109 | + http://localhost:3080/admin/files |
| 110 | + http://localhost:3080/admin/users |
| 111 | + http://localhost:3080/admin/user-groups |
| 112 | + http://localhost:3080/admin/audit-log |
| 113 | + repository: ${{ github.repository }} |
| 114 | + token: ${{ secrets.GH_TOKEN_A11Y }} |
| 115 | + cache_key: cached_results-c4-local.json |
| 116 | + login_url: http://localhost:3080 # Optional: URL of the login page if authentication is required |
| 117 | + username: ${{ env.AUTH_INITIAL_ADMIN_USERNAME }} # Optional: Username for authentication |
| 118 | + password: ${{ env.AUTH_INITIAL_ADMIN_PASSWORD }} # Optional: Password for authentication (use secrets!) |
| 119 | + open_grouped_issues: true # Optional: Set to true to open an issue grouping individual issues per violation |
| 120 | + # auth_context: # Optional: Stringified JSON object for complex authentication |
| 121 | + # skip_copilot_assignment: false # Optional: Set to true to skip assigning issues to GitHub Copilot (or if you don't have GitHub Copilot) |
| 122 | + # include_screenshots: false # Optional: Set to true to capture screenshots and include links to them in filed issues |
| 123 | + # reduced_motion: no-preference # Optional: Playwright reduced motion configuration option |
| 124 | + # color_scheme: light # Optional: Playwright color scheme configuration option |
| 125 | + # scans: '["axe","reflow-scan"]' # Optional: An array of scans (or plugins) to be performed. If not provided, only Axe will be performed. |
| 126 | + |
| 127 | + - name: Get backend logs |
| 128 | + if: ${{ !cancelled() }} |
| 129 | + run: docker logs backend |
| 130 | + |
| 131 | + - name: Get gateway logs |
| 132 | + if: ${{ !cancelled() }} |
| 133 | + run: docker logs gateway |
0 commit comments