CI #31
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: | |
push: | |
branches: | |
- "**" | |
tags: | |
- "v**" | |
env: | |
DENO_VERSION: 1.46 | |
jobs: | |
health: | |
name: Health | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: denoland/setup-deno@v1 | |
with: | |
deno-version: ${{ env.DENO_VERSION }} | |
- name: Lint | |
run: deno lint | |
- name: Format | |
run: deno fmt --check | |
- name: Type Check | |
run: deno check src/*.ts | |
node: | |
name: Node.js v${{ matrix.nodejs }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
nodejs: [16, 18, 20, 22] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.nodejs }} | |
- uses: denoland/setup-deno@v1 | |
with: | |
deno-version: ${{ env.DENO_VERSION }} | |
- name: Prepare | |
run: | | |
deno task fixtures | |
deno task build --quiet | |
deno task pretest --quiet | |
- name: Install | |
working-directory: npm | |
run: npm install | |
- name: Run Tests | |
working-directory: npm | |
run: npm test | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: denoland/setup-deno@v1 | |
with: | |
deno-version: ${{ env.DENO_VERSION }} | |
- name: Check Size | |
run: deno task build | |
bench: | |
name: Bench | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: denoland/setup-deno@v1 | |
with: | |
deno-version: ${{ env.DENO_VERSION }} | |
- name: Make Fixtures | |
run: deno task fixtures 12 | |
- name: Run Benchmark | |
run: deno bench --allow-read --no-check | |
# https://jsr.io/docs/publishing-packages#publishing-from-github-actions | |
# https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages#publishing-packages-to-the-npm-registry | |
publish: | |
name: Publish | |
needs: [health, node] | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') | |
permissions: | |
contents: read | |
id-token: write # -> authentication | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: denoland/setup-deno@v1 | |
with: | |
deno-version: ${{ env.DENO_VERSION }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: 'https://registry.npmjs.org' | |
- name: Build | |
run: deno task build --quiet | |
# - name: "Publish → jsr" | |
# if: ${{ !contains(github.ref, '-next.') }} | |
# run: deno publish --no-check -c jsr.json | |
- name: "Publish → npm" | |
if: ${{ !contains(github.ref, '-next.') }} | |
run: npm publish --provenance --access public | |
working-directory: ./npm | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: "Publish → npm (pre-release)" | |
if: ${{ contains(github.ref, '-next.') }} | |
run: npm publish --tag next --provenance --access public | |
working-directory: ./npm | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |