Add repeatable classroom browser launch gates #125
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| backend: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: api | |
| services: | |
| postgres: | |
| image: postgres:17 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: hafa_code_test | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd="pg_isready -U postgres" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=5 | |
| env: | |
| RAILS_ENV: test | |
| DATABASE_URL: postgres://postgres:postgres@localhost:5432/hafa_code_test | |
| RUBOCOP_CACHE_ROOT: tmp/rubocop | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.3.7" | |
| bundler-cache: true | |
| working-directory: api | |
| - name: Prepare database | |
| run: bin/rails db:prepare | |
| - name: Test | |
| run: bin/rails test | |
| - name: Ruby style | |
| run: bin/rubocop --format github | |
| - name: Static security scan | |
| run: bin/brakeman --no-pager | |
| - name: Dependency security audit | |
| run: bundle exec bundler-audit check --update | |
| frontend: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: web | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .node-version | |
| cache: npm | |
| cache-dependency-path: web/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Test | |
| run: npm test | |
| - name: Lint | |
| run: npm run lint | |
| - name: Build | |
| run: npm run build | |
| - name: Dependency security audit | |
| run: npm audit --audit-level=high | |
| classroom-e2e: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| services: | |
| postgres: | |
| image: postgres:17 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: hafa_code_e2e | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd="pg_isready -U postgres" | |
| --health-interval=10s | |
| --health-timeout=5s | |
| --health-retries=5 | |
| env: | |
| E2E_DATABASE_URL: postgres://postgres:postgres@127.0.0.1:5432/hafa_code_e2e | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.3.7" | |
| bundler-cache: true | |
| working-directory: api | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: .node-version | |
| cache: npm | |
| cache-dependency-path: web/package-lock.json | |
| - name: Install web dependencies | |
| working-directory: web | |
| run: npm ci | |
| - name: Install Chromium | |
| working-directory: web | |
| run: npx playwright install --with-deps chromium | |
| - name: Test classroom workflows in a browser | |
| working-directory: web | |
| run: npm run test:e2e | |
| - name: Upload Playwright report | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: classroom-playwright-report | |
| path: web/playwright-report/ | |
| retention-days: 14 |