Close classroom storage and accessibility gaps #137
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 | |
| permissions: | |
| contents: read | |
| jobs: | |
| backend: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: api | |
| services: | |
| postgres: | |
| image: postgres:17@sha256:67f41722b7a8cbdb868a44a4995c846eddfdc2973bccb291ce937dce88ad5675 # 17.11 | |
| 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@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 | |
| - uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # 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@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 | |
| - uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # 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@sha256:67f41722b7a8cbdb868a44a4995c846eddfdc2973bccb291ce937dce88ad5675 # 17.11 | |
| 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@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 | |
| - uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1 | |
| with: | |
| ruby-version: "3.3.7" | |
| bundler-cache: true | |
| working-directory: api | |
| - uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # 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: Verify fixture reset after workflow mutations | |
| if: ${{ !cancelled() }} | |
| working-directory: api | |
| env: | |
| RAILS_ENV: test | |
| DATABASE_URL: ${{ env.E2E_DATABASE_URL }} | |
| run: bundle exec rails e2e:reset | |
| - name: Upload Playwright report | |
| if: ${{ !cancelled() }} | |
| uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5 | |
| with: | |
| name: classroom-playwright-report | |
| path: web/playwright-report/ | |
| retention-days: 14 |