fix #379
This file contains hidden or 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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
# For more information see: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow | |
name: CI | |
on: | |
push: | |
branches: ["*"] | |
paths: | |
- "recipes/**" | |
- "package.json" | |
- "package-lock.json" | |
- ".github/workflows/*.yml" | |
pull_request: | |
branches: ["*"] | |
paths: | |
- "recipes/**" | |
- "package.json" | |
- "package-lock.json" | |
- ".github/workflows/*.yml" | |
types: | |
- opened | |
- ready_for_review | |
- reopened | |
- synchronize | |
jobs: | |
get-matrix: | |
name: Configure Node LTS environment matrix | |
runs-on: ubuntu-latest | |
outputs: | |
latest: ${{ steps.set-matrix.outputs.requireds }} | |
steps: | |
- uses: ljharb/actions/node/matrix@main | |
id: set-matrix | |
with: | |
versionsAsRoot: true | |
type: majors | |
preset: ">= 22" # glob is not backported below 22.x | |
lint-and-types: | |
name: Lint & types | |
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
show-progress: false | |
- name: Set up Node.js LTS | |
uses: actions/setup-node@v4 | |
with: | |
cache: "npm" | |
check-latest: true | |
node-version-file: ".nvmrc" | |
- run: npm ci | |
- run: node --run lint | |
- run: node --run type-check | |
tests: | |
name: Unit, e2e, coverage | |
if: ${{ github.event_name != 'pull_request' || !github.event.pull_request.draft }} | |
needs: [get-matrix] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: ${{ fromJson(needs.get-matrix.outputs.latest) }} | |
os: | |
- macos-latest | |
- ubuntu-latest | |
- windows-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
show-progress: false | |
- name: Set up Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
cache: "npm" | |
check-latest: true | |
node-version: ${{ matrix.node-version }} | |
- run: npm ci | |
- name: Run recipe tests | |
run: >- | |
node | |
--run test | |
--test-coverage-lines=0.8 | |
--test-reporter-destination=./coverage.lcov | |
--test-reporter=lcov |