feat: track script.js in Codecov, fix broken CI badges, add 71 DOM tests #135
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: Unit Tests | |
| on: | |
| schedule: | |
| - cron: '0 9 * * 1' # Every Monday at 09:00 UTC | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| merge_group: | |
| permissions: | |
| contents: read | |
| jobs: | |
| changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| # On scheduled runs there is no diff to compare — always run tests. | |
| # On push/PR, only run when relevant files changed. | |
| code: ${{ github.event_name == 'schedule' || steps.filter.outputs.code == 'true' }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Detect relevant file changes | |
| uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 | |
| if: github.event_name != 'schedule' | |
| id: filter | |
| with: | |
| filters: | | |
| code: | |
| - '**/*.js' | |
| - '**/*.ts' | |
| - '**/*.css' | |
| - 'tests/**' | |
| - 'package*.json' | |
| test: | |
| needs: changes | |
| if: needs.changes.outputs.code == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: ./.github/actions/setup | |
| - name: Build generated files needed for tests | |
| run: npm run build:milestones && npm run build:js | |
| - name: Run type check | |
| run: npm run typecheck | |
| - name: Run tests with coverage | |
| run: npm run test:ci | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| flags: unit | |
| verbose: true | |
| fail_ci_if_error: false | |
| unit-test-status: | |
| needs: [changes, test] | |
| if: always() | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Report status | |
| run: | | |
| if [[ "${{ needs.test.result }}" == "failure" ]]; then | |
| echo "Unit tests failed" | |
| exit 1 | |
| fi | |
| echo "Unit tests passed or were skipped (no relevant files changed)" |