Bulk update dependencies #17465
Workflow file for this run
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: JavaScript Unit Tests | |
on: | |
push: | |
# Only run if JS-related files changed. | |
paths: | |
- '**.js' | |
- '**.cjs' | |
- '**.ts' | |
- '**.tsx' | |
- '**/package.json' | |
- 'package-lock.json' | |
- 'packages/templates/src/raw/**' | |
- 'packages/text-sets/src/raw/**' | |
- 'patches/**' | |
- 'packages/fonts/src/fonts.json' | |
branches: | |
- main | |
- release/* | |
pull_request: | |
# Only run if JS-related files changed. | |
paths: | |
- '**.js' | |
- '**.cjs' | |
- '**.ts' | |
- '**.tsx' | |
- '**/package.json' | |
- 'package-lock.json' | |
- 'packages/templates/src/raw/**' | |
- 'packages/text-sets/src/raw/**' | |
- 'patches/**' | |
- 'packages/fonts/src/fonts.json' | |
permissions: | |
contents: read | |
# Cancels all previous workflow runs for pull requests that have not completed. | |
concurrency: | |
# The concurrency group contains the workflow name and the (target) branch name. | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
unit-js: | |
name: Unit Tests (${{ matrix.shard }}) | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
strategy: | |
matrix: | |
# We want to split up the tests into 2 parts running in parallel. | |
shard: ['1/2', '2/2'] | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 | |
with: | |
disable-sudo: true | |
disable-file-monitoring: true | |
egress-policy: audit | |
allowed-endpoints: > | |
cdn.ampproject.org:443 | |
codecov.io:443 | |
github.com:443 | |
raw.githubusercontent.com:443 | |
registry.npmjs.org:443 | |
storage.googleapis.com:443 | |
uploader.codecov.io:443 | |
fonts.gstatic.com:443 | |
- name: Checkout | |
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 | |
- name: Setup Node | |
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d | |
with: | |
node-version-file: '.nvmrc' | |
cache: npm | |
- name: Setup Jest cache | |
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 | |
with: | |
path: .jest-cache | |
key: ${{ runner.os }}-${{ env.NVMRC }}-jest | |
# Rollup is needed for tests in `packages/migration/src` expecting `module.js` | |
- name: Install dependencies | |
run: | | |
npm ci | |
npx rollup --config packages/migration/rollup.config.js | |
env: | |
PUPPETEER_SKIP_DOWNLOAD: true | |
- name: Download AMP validator JS | |
id: amp_validator | |
run: | | |
cd $RUNNER_TEMP && curl -O -f -s -S https://cdn.ampproject.org/v0/validator_wasm.js | |
AMP_VALIDATOR_FILE="${RUNNER_TEMP}/validator_wasm.js" | |
echo "validator_file=$AMP_VALIDATOR_FILE" >> $GITHUB_ENV | |
- name: Run JavaScript unit tests | |
run: npm run test:js -- --runInBand --ci --cacheDirectory="$HOME/.jest-cache" --collectCoverage --shard=$SHARD | |
env: | |
SHARD: ${{ matrix.shard }} | |
AMP_VALIDATOR_FILE: ${{ env.validator_file }} | |
- name: Upload code coverage report | |
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d | |
with: | |
file: build/logs/lcov.info | |
flags: unittests |