Merge pull request #23 from devopsabcs-engineering/feature/2108-fix-d… #84
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: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| checks: write | |
| pull-requests: write | |
| jobs: | |
| ci: | |
| name: Lint, Test & Build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 25 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - run: npm ci | |
| - name: Lint | |
| run: npm run lint | |
| - name: Test with coverage | |
| run: npm run test:ci | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: test-results | |
| path: test-results/ | |
| retention-days: 30 | |
| - name: Upload coverage | |
| uses: actions/upload-artifact@v4 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: coverage | |
| path: coverage/ | |
| retention-days: 30 | |
| - name: Test report | |
| uses: dorny/test-reporter@v2 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: 'Unit Tests' | |
| path: test-results/junit.xml | |
| reporter: java-junit | |
| fail-on-error: true | |
| - name: Coverage report | |
| uses: davelosert/vitest-coverage-report-action@v2 | |
| if: always() | |
| with: | |
| name: 'Coverage' | |
| file-coverage-mode: 'changes' | |
| - name: Cache Next.js build | |
| uses: actions/cache@v4 | |
| with: | |
| path: .next/cache | |
| key: nextjs-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('src/**') }} | |
| restore-keys: | | |
| nextjs-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}- | |
| nextjs-${{ runner.os }}- | |
| - name: Build | |
| run: npm run build | |
| - name: Install Playwright Chromium | |
| run: npx playwright install --with-deps chromium | |
| - name: Self-scan accessibility tests | |
| run: npm run test:a11y | |
| - name: Upload accessibility report | |
| uses: actions/upload-artifact@v4 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: a11y-results | |
| path: | | |
| playwright-report/ | |
| test-results/a11y-junit.xml | |
| retention-days: 30 | |
| - name: Accessibility test report | |
| uses: dorny/test-reporter@v2 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: 'Accessibility Tests' | |
| path: test-results/a11y-junit.xml | |
| reporter: java-junit | |
| fail-on-error: true |