chore(deps): update actions/cache action to v4 (#494) #1473
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: CI | |
on: | |
merge_group: | |
pull_request: | |
push: | |
branches: [main] | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
permissions: | |
contents: read # for checkout | |
jobs: | |
build: | |
name: Build, lint and test coverage | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
cache: npm | |
node-version: lts/* | |
- run: npm ci | |
- run: npx ls-engines | |
- run: npm run prepublishOnly | |
- name: Register Problem Matcher for ESLint that handles --report-unused-disable-directives | |
run: echo "::add-matcher::.github/eslint-compact.json" | |
- run: npm run lint -- --report-unused-disable-directives -f compact | |
- run: npm run coverage | |
- uses: actions/upload-artifact@v3 | |
name: Cache build output | |
with: | |
name: build-output | |
path: | | |
dist/ | |
umd/ | |
test: | |
needs: build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
# Run the testing suite on each major OS with the latest LTS release of Node.js | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
node: [lts/*] | |
# It makes sense to also test the oldest, and latest, versions of Node.js, on ubuntu-only since it's the fastest CI runner | |
include: | |
- os: ubuntu-latest | |
# Also test the previous LTS release | |
node: lts/-1 | |
# @TODO re-enable after the nightly builds work with vitest once again | |
# - os: ubuntu-latest | |
# # Test the actively developed version that will become the latest LTS release next October | |
# node: current | |
# The `build` job already runs the testing suite in ubuntu and lts/* | |
exclude: | |
- os: ubuntu-latest | |
node: lts/* | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
cache: npm | |
node-version: ${{ matrix.node }} | |
- run: npm install | |
- run: npx ls-engines | |
- run: npm run coverage | |
prod-deps: | |
name: Cache production dependencies | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- id: prod-deps | |
uses: actions/cache@v4 | |
with: | |
path: ./node_modules | |
key: prod-deps-${{ runner.os }}-${{ hashFiles('package-lock.json') }} | |
- if: steps.prod-deps.outputs.cache-hit != 'true' | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- if: steps.prod-deps.outputs.cache-hit != 'true' | |
run: npm install --omit=dev --ignore-scripts | |
edge-runtime: | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
cache: npm | |
node-version: lts/* | |
- run: npm install | |
- uses: actions/download-artifact@v3 | |
name: Restore build output | |
with: | |
name: build-output | |
- run: npm run test:edge-runtime -- --coverage | |
browser-runtime: | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
cache: npm | |
node-version: lts/* | |
- run: npm install | |
- uses: actions/download-artifact@v3 | |
name: Restore build output | |
with: | |
name: build-output | |
- run: npm run test:browser -- --coverage | |
deno-runtime: | |
runs-on: ubuntu-latest | |
needs: [build, prod-deps] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
name: Install only production dependencies | |
with: | |
path: ./node_modules | |
key: prod-deps-${{ runner.os }}-${{ hashFiles('package-lock.json') }} | |
- uses: actions/download-artifact@v3 | |
name: Restore build output | |
with: | |
name: build-output | |
- uses: denoland/setup-deno@v1 | |
with: | |
deno-version: vx.x.x | |
- run: npm run test:deno | |
bun-runtime: | |
runs-on: ubuntu-latest | |
needs: [build, prod-deps] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
name: Install only production dependencies | |
with: | |
path: ./node_modules | |
key: prod-deps-${{ runner.os }}-${{ hashFiles('package-lock.json') }} | |
- uses: actions/download-artifact@v3 | |
name: Restore build output | |
with: | |
name: build-output | |
- uses: antongolub/action-setup-bun@cd8fde41d342e75098c67856ffc9c6cf6c1217e6 # v1 | |
- run: npm run test:bun | |
node-runtimes: | |
runs-on: ubuntu-latest | |
needs: [build, prod-deps] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v4 | |
name: Install only production dependencies | |
with: | |
path: ./node_modules | |
key: prod-deps-${{ runner.os }}-${{ hashFiles('package-lock.json') }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- uses: actions/download-artifact@v3 | |
name: Restore build output | |
with: | |
name: build-output | |
- run: npm run test:node-runtimes |