chore: update browserslist db #1809
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 & Release | |
on: | |
# Build on pushes to release branches | |
push: | |
branches: [main] | |
# Build on pull requests targeting release branches | |
pull_request: | |
branches: [main] | |
# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow | |
# https://github.com/sanity-io/semantic-release-preset/actions/workflows/ci.yml | |
workflow_dispatch: | |
inputs: | |
release: | |
description: 'Release new version' | |
required: true | |
default: false | |
type: boolean | |
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 build | |
- run: npm run lint -- --quiet | |
- run: npm run coverage | |
test: | |
name: Node.js ${{ matrix.node }} on ${{ matrix.os }} | |
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 | |
# Test the oldest LTS release of Node that's still receiving bugfixes and security patches, versions older than that have reached End-of-Life | |
node: lts/-1 | |
- 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 | |
# Test the oldest LTS release of Node that's still receiving bugfixes and security patches, versions older than that have reached End-of-Life | |
node: lts/* | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
cache: npm | |
node-version: ${{ matrix.node }} | |
- run: npm i | |
- run: npx ls-engines | |
- run: npm run build | |
- run: npm test | |
# Only run the RSC testing suite if native `fetch` is available | |
- run: node -e "fetch" && npm run test:react-server || true | |
test-esm: | |
name: Test ESM exports | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
cache: npm | |
# The testing suite uses the native test runner introduced in Node.js v18 | |
# https://nodejs.org/api/test.html | |
node-version: lts/* | |
- run: npm ci | |
- run: npm run build | |
- run: npm run test:esm | |
# This test will run both in a CJS and an ESM mode in Node.js to ensure backwards compatibility | |
name: Ensure pkg.exports don't break anything in modern Node.js envs | |
- run: npm run test:esm:browser | |
# This test is just ensuring the pkg.exports defined by 'browser' conditionals don't point to files that don't exist and have valid syntax (no CJS) | |
# Please note that this test DOES support Node.js APIs, we need to test in a Cloudflare Worker v8 runtime, or Vercel Edge Runtime, to fully test e2e | |
name: Test the 'browser' conditional using Node.js | |
test-deno: | |
name: Test Deno | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
cache: npm | |
node-version: lts/* | |
- run: npm ci | |
- run: npm run build | |
- uses: denoland/setup-deno@v1 | |
with: | |
deno-version: vx.x.x | |
- run: npm run test:esm:deno | |
name: Test that Deno can import `get-it` | |
test-browser: | |
name: Test Browser | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
cache: npm | |
node-version: lts/* | |
- run: npm ci | |
- run: npm run test:browser -- run --coverage | |
test-edge: | |
name: Test Edge Runtime | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
cache: npm | |
node-version: lts/* | |
- run: npm ci | |
- run: npm run test:edge-runtime -- run --coverage | |
release: | |
permissions: | |
id-token: write # to enable use of OIDC for npm provenance | |
name: Semantic release | |
runs-on: ubuntu-latest | |
needs: [test, test-esm, test-deno, test-edge, test-browser] | |
if: inputs.release == true | |
steps: | |
- uses: actions/create-github-app-token@v1 | |
id: app-token | |
with: | |
app-id: ${{ secrets.ECOSPARK_APP_ID }} | |
private-key: ${{ secrets.ECOSPARK_APP_PRIVATE_KEY }} | |
- uses: actions/checkout@v4 | |
with: | |
# Need to fetch entire commit history to | |
# analyze every commit since last release | |
fetch-depth: 0 | |
# Uses generated token to allow pushing commits back | |
token: ${{ steps.app-token.outputs.token }} | |
# Make sure the value of GITHUB_TOKEN will not be persisted in repo's config | |
persist-credentials: false | |
- uses: actions/setup-node@v4 | |
with: | |
cache: npm | |
node-version: lts/* | |
- run: npm ci | |
- run: npx semantic-release | |
# Don't allow interrupting the release step if the job is cancelled, as it can lead to an inconsistent state | |
# e.g. git tags were pushed but it exited before `npm publish` | |
if: always() | |
env: | |
NPM_CONFIG_PROVENANCE: true | |
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | |
# Should release fail, dry rerun with debug on for richer logs | |
- run: npx semantic-release --dry-run --debug | |
if: ${{ failure() }} | |
env: | |
NPM_CONFIG_PROVENANCE: true | |
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} |