Skip to content

feat: add strict mode switcher (#31) #182

feat: add strict mode switcher (#31)

feat: add strict mode switcher (#31) #182

Workflow file for this run

# This is a Github Workflow that runs tests on any push or pull request.
# If the tests pass and this is a push to the master branch it also runs Semantic Release.
name: CI
on: [push, pull_request]
env:
npm_config_audit: false
npm_config_fund: false
npm_config_save: false
npm_config_package_lock: false
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- name: Use Node.js 24
uses: actions/setup-node@v5
with:
node-version: 24
cache: 'npm'
- run: npm ci
- run: npm run build
- uses: actions/upload-artifact@v4
with:
name: build
path: |
target
package.json
package-main.json
jsr.json
retention-days: 1
test:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 24
cache: 'npm'
- uses: actions/download-artifact@v5
with:
name: build
- name: Fetch deps
run: npm ci
- name: Run tests
run: npm run test
- uses: actions/upload-artifact@v4
with:
name: coverage
path: |
target/coverage
package.json
retention-days: 1
release:
name: Release ${{ github.ref }}
needs: test
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
# if: github.event_name == 'turned-off-temporary'
runs-on: ubuntu-latest
permissions:
checks: read
statuses: write
contents: write
packages: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version: 24
cache: 'npm'
- uses: actions/download-artifact@v5
with:
merge-multiple: true
- name: Run release
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_PROVENANCE: true
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_USER: 'x-access-token'
GIT_BRANCH: 'main'
GIT_AUTHOR_NAME: ${{ vars.GIT_AUTHOR_NAME }}
GIT_AUTHOR_EMAIL: ${{ vars.GIT_AUTHOR_EMAIL }}
GIT_COMMITTER_NAME: ${{ vars.GIT_COMMITTER_NAME }}
GIT_COMMITTER_EMAIL: ${{ vars.GIT_COMMITTER_EMAIL }}
run: npx zx-semrel
# run: |
# mv -f package-main.json package.json
# npx zx-semrel
- name: Push docs and coverage
env:
GIT_COMMITTER_NAME: ${{ vars.GIT_COMMITTER_NAME }}
GIT_COMMITTER_EMAIL: ${{ vars.GIT_COMMITTER_EMAIL }}
DEBUG: true
run: |
npx ggcp target/coverage/lcov.info target/coverage/${{ github.sha }}.lcov.info
npx ggcp "target/coverage>*.info" https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git/coverage --message='chore: add coverage for ${{ github.sha }}'
npx ggcp target/docs https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git/gh-pages --message='chore: update docs'
smoke-node:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
needs: build
name: smoke-node${{ matrix.node-version }}
strategy:
matrix:
node-version: [10, 12, 18, 24]
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- uses: actions/download-artifact@v5
with:
name: build
- name: Run smoke:esm tests
if: matrix.node-version >= 12
run: npm run smoke:esm
- name: Run smoke:cjs tests
run: npm run smoke:cjs
smoke-node-win32:
if: github.event_name == 'pull_request'
runs-on: windows-latest
needs: build
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- name: Setup Node.js 24
uses: actions/setup-node@v5
with:
node-version: 24
cache: 'npm'
- uses: actions/download-artifact@v5
with:
name: build
- name: Run smoke:esm tests
run: npm run smoke:esm
- name: Run smoke:cjs tests
run: npm run smoke:cjs
smoke-browser:
if: github.event_name == 'pull_request'
timeout-minutes: 5
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- name: Setup Node.js 24
uses: actions/setup-node@v5
with:
node-version: 24
cache: 'npm'
- uses: actions/download-artifact@v5
with:
name: build
- run: |
npm ci
npx playwright install --with-deps chromium
npm run smoke:browser
smoke-bun:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- name: Setup Bun
uses: antongolub/action-setup-bun@f0b9f339a7ce9ba1174a58484e4dc9bbd6f7b133 # v1.13.2
- uses: actions/download-artifact@v5
with:
name: build
- run: |
bun ./src/test/smoke/node.test.cjs
bun ./src/test/smoke/node.test.mjs
smoke-deno:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
name: smoke-deno${{ matrix.deno-version }}
needs: build
strategy:
matrix:
deno-version: [ 1, 2 ]
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- name: Setup Deno
uses: denoland/setup-deno@909cc5acb0fdd60627fb858598759246509fa755 # v2.0.2
with:
deno-version: ${{ matrix.deno-version }}
- run: deno install npm:types/node
- uses: actions/download-artifact@v5
with:
name: build
- run: deno test ./src/test/smoke/deno.test.js