Unit Tests #14849
This file contains 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: | |
push: | |
schedule: | |
- cron: '0 8 * * *' | |
jobs: | |
unit-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.9.x' | |
- run: npm ci | |
- run: npm run build-glean | |
# Run the regular tests on push | |
- run: npm test | |
if: github.event_name != 'schedule' | |
# But measure coverage without ignore markers in the nighly job | |
- name: Remove `c8 ignore` markers to output full unit test coverage if on the `report-coverage` branch | |
run: find src/ -type f -name "*.js" -or -name "*.ts" -or -name "*.jsx" -or -name "*.tsx" -exec sed --in-place --expression='s/c8 ignore/c8 TEMPORARILY DO NOT ignore/g' {} \; | |
if: github.event_name == 'schedule' | |
# (and set an arbitrary coverage threshold for that "true" coverage): | |
- run: npm test -- --coverageThreshold='{"global":{"branches":80,"functions":80,"lines":80,"statements":80}}' | |
if: github.event_name == 'schedule' | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: coverage-report | |
path: coverage/ | |
retention-days: 30 |