ci: use ubuntu 24.04 #588
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: Tests | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
branches: [ master ] | |
repository_dispatch: | |
types: [semantic-release] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
issues: write | |
pull-requests: write | |
jobs: | |
installtest: | |
name: installtest | |
timeout-minutes: 20 | |
runs-on: ubuntu-24.04 | |
container: | |
image: mcr.microsoft.com/playwright:v1.48.2-noble | |
env: | |
HUSKY: 0 | |
PLAYWRIGHT_BROWSERS_PATH: 0 | |
permissions: | |
contents: write # to be able to publish a GitHub release | |
issues: write # to be able to comment on released issues | |
pull-requests: write # to be able to comment on released pull requests | |
id-token: write # to enable use of OIDC for npm provenance | |
steps: | |
# - uses: google/wireit@setup-github-actions-caching/v2 | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
- uses: actions/cache/restore@v4 | |
id: cache-node-modules | |
with: | |
path: | | |
./node_modules | |
key: modules-1-${{ hashFiles('./package-lock.json') }} | |
- name: Install dependencies | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: npm clean-install && npx playwright-install --with-deps | |
- name: Test exports | |
run: npm run test:exports | |
- name: Unit tests | |
run: npm run test:unit | |
- name: Run codacy-coverage-reporter | |
uses: codacy/codacy-coverage-reporter-action@v1.3.0 | |
continue-on-error: true | |
with: | |
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} | |
coverage-reports: coverage-reports/lcov.info | |
- name: Cache dependencies | |
uses: actions/cache/save@v4 | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
with: | |
path: | | |
./node_modules | |
key: modules-1-${{ hashFiles('./package-lock.json') }} | |
build: | |
name: build | |
needs: [installtest] | |
timeout-minutes: 20 | |
runs-on: ubuntu-24.04 | |
container: | |
image: mcr.microsoft.com/playwright:v1.48.2-noble | |
permissions: | |
contents: write # to be able to publish a GitHub release | |
issues: write # to be able to comment on released issues | |
pull-requests: write # to be able to comment on released pull requests | |
id-token: write # to enable use of OIDC for npm provenance | |
env: | |
HUSKY: 0 | |
PLAYWRIGHT_BROWSERS_PATH: 0 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: actions/cache/restore@v4 | |
id: cache-node-modules | |
with: | |
path: | | |
./node_modules | |
key: modules-1-${{ hashFiles('./package-lock.json') }} | |
- name: Install dependencies | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: npm clean-install && npx playwright-install --with-deps | |
- name: build packages | |
run: npx cross-env TEST=true npm run build:packages | |
- name: Cache dependencies | |
id: cache | |
uses: actions/cache/save@v4 | |
if: always() | |
with: | |
path: | | |
./dist | |
./packages/example-react-router6/dist | |
./packages/example-react-router6/package.json | |
./packages/example-react/dist | |
./packages/example-react/package.json | |
./packages/example-nextjs14/package.json | |
./packages/example-nextjs14/.next | |
./packages/example-nextjs15/package.json | |
./packages/example-nextjs15/.next | |
key: modules-2-${{ github.sha }}-${{ github.run_id }} | |
testint: | |
needs: [build] | |
name: testint | |
runs-on: ubuntu-24.04 | |
timeout-minutes: 30 | |
container: | |
image: mcr.microsoft.com/playwright:v1.48.2-noble | |
strategy: | |
fail-fast: false | |
matrix: | |
shardIndex: [1, 2] | |
shardTotal: [2] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: actions/cache/restore@v4 | |
id: cache-node-modules | |
with: | |
path: | | |
./node_modules | |
key: modules-1-${{ hashFiles('./package-lock.json') }} | |
- uses: actions/cache/restore@v4 | |
id: cache | |
with: | |
path: | | |
./dist | |
./packages/example-react-router6/dist | |
./packages/example-react-router6/package.json | |
./packages/example-react/dist | |
./packages/example-react/package.json | |
./packages/example-nextjs14/package.json | |
./packages/example-nextjs14/.next | |
./packages/example-nextjs15/package.json | |
./packages/example-nextjs15/.next | |
key: modules-2-${{ github.sha }}-${{ github.run_id }} | |
- name: Run Playwright tests | |
run: | | |
npm run start:ci & \ | |
npx wait-on http://localhost:3000 && \ | |
npx wait-on http://localhost:3001 && \ | |
npm run test:int:ci -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: blob-report-${{ matrix.shardIndex }} | |
path: blob-report | |
retention-days: 5 | |
merge-reports: | |
# Merge reports after playwright-tests, even if some shards have failed | |
if: ${{ !cancelled() }} | |
needs: [testint] | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
- uses: actions/cache/restore@v4 | |
id: cache-node-modules | |
with: | |
path: | | |
./node_modules | |
key: modules-1-${{ hashFiles('./package-lock.json') }} | |
- name: Install dependencies | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
run: npm clean-install | |
- name: Download blob reports from GitHub Actions Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: all-blob-reports | |
pattern: blob-report-* | |
merge-multiple: true | |
- name: Merge into HTML Report | |
run: npx playwright merge-reports --reporter html ./all-blob-reports | |
- name: Upload HTML report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: html-report--attempt-${{ github.run_attempt }} | |
path: playwright-report | |
retention-days: 14 | |
release: | |
name: release | |
needs: [testint] | |
if: github.ref == 'refs/heads/master' | |
timeout-minutes: 20 | |
runs-on: ubuntu-24.04 | |
container: | |
image: mcr.microsoft.com/playwright:v1.48.2-noble | |
permissions: | |
contents: write # to be able to publish a GitHub release | |
issues: write # to be able to comment on released issues | |
pull-requests: write # to be able to comment on released pull requests | |
id-token: write # to enable use of OIDC for npm provenance | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
registry-url: 'https://registry.npmjs.org' | |
- uses: actions/cache/restore@v4 | |
id: cache-node-modules | |
with: | |
path: | | |
./node_modules | |
key: modules-1-${{ hashFiles('./package-lock.json') }} | |
- uses: actions/cache/restore@v4 | |
id: cache | |
with: | |
path: | | |
./dist | |
./packages/example-react-router6/dist | |
./packages/example-react-router6/package.json | |
./packages/example-react/dist | |
./packages/example-react/package.json | |
./packages/example-nextjs14/package.json | |
./packages/example-nextjs14/.next | |
./packages/example-nextjs15/package.json | |
./packages/example-nextjs15/.next | |
key: modules-2-${{ github.sha }}-${{ github.run_id }} | |
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies | |
run: npm audit signatures | |
# - name: Debug | |
# run: echo `pwd` && echo `ls -a` | |
- name: git config | |
run: git config --global --add safe.directory /__w/state-in-url/state-in-url | |
- name: Initialize Git user | |
run: | | |
git config --global user.email "github-release-bot@example.com" | |
git config --global user.name "Release Workflow" | |
- name: Initialise the NPM config | |
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npx semantic-release | |
cleanup: | |
name: cleanup | |
needs: [release] | |
runs-on: ubuntu-24.04 | |
if: github.ref == 'refs/heads/master' | |
timeout-minutes: 10 | |
permissions: | |
# See also: https://docs.github.com/en/rest/actions/cache?apiVersion=2022-11-28#delete-a-github-actions-cache-for-a-repository-using-a-cache-id | |
actions: write | |
contents: read | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Cleanup | |
run: | | |
set +e | |
echo "Deleting caches..." | |
gh cache delete modules-2-${{ github.sha }}-${{ github.run_id }} | |
echo "Done" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |