ci: CI on both Node v20-22 and Deno v2 #141
Workflow file for this run
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 ] | |
jobs: | |
build_node: | |
name: "Build" | |
strategy: | |
matrix: | |
runtime: [ 'Node.js' ] | |
version: [20, 22, 23] | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Clone repository' | |
uses: actions/checkout@v4 | |
- name: 'Install Node.js' | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.version }} | |
cache: 'npm' | |
- name: 'npm ci' | |
run: npm ci | |
- name: 'npm run check-types' | |
run: npm run check-types | |
- name: 'npm run lint' | |
run: npm run lint | |
- name: 'npm run test' | |
run: npm run test:ci | |
# todo: convert test:ci to a convention for env var detection "e.g. CI=true" | |
- name: 'Publish coverage badge' | |
uses: wjervis7/vitest-badge-action@v1.0.0 | |
with: | |
result-type: lines | |
gist-token: ${{ secrets.RELEASE_PLEASE_TOKEN }} # if you want to upload badge to gist | |
gist-url: https://gist.github.com/dirkluijk/db6fbd0d0d4c138655a89386c5bdbe41 | |
upload-badge: ${{ github.ref == 'refs/heads/main' }} | |
badge-text: 'coverage' | |
build_deno: | |
name: "Build" | |
strategy: | |
matrix: | |
runtime: [ 'Deno' ] | |
version: ['v2.x'] | |
runs-on: ubuntu-latest | |
env: | |
DENO_DIR: '/tmp/.deno' | |
steps: | |
- name: 'Clone repository' | |
uses: actions/checkout@v4 | |
- name: 'Install Deno' | |
uses: denoland/setup-deno@v2 | |
with: | |
deno-version: ${{ matrix.version }} | |
- name: 'restore .deno dir' | |
uses: actions/cache/restore@v4 | |
with: | |
path: ${{ env.DENO_DIR }} | |
key: deno_dir | |
- name: 'deno install' | |
run: deno install | |
- name: 'cache .deno dir' | |
uses: actions/cache/save@v4 | |
with: | |
path: ${{ env.DENO_DIR }} | |
key: deno_dir | |
- name: 'deno check' | |
run: deno check **/*.ts | |
- name: 'deno lint' | |
run: deno run lint | |
- name: 'deno test' | |
# todo: use "deno run test:ci" when released: | |
# https://github.com/denoland/deno/pull/26836 | |
run: deno run test |