build(deps): bump fsfe/reuse-action from 4 to 5 #347
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
# Copyright 2022 Leorize <[email protected]> | |
# | |
# SPDX-License-Identifier: MPL-2.0 | |
name: CI | |
on: [push, pull_request] | |
jobs: | |
generate: | |
name: Generate parser | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
cache: "npm" | |
node-version: "20" | |
- run: npm ci | |
- run: npm run build | |
- name: Upload built parser to artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: parser | |
path: src/parser.c | |
compare-parser: | |
needs: [generate] | |
name: Check if generated parser is the same as the PR's | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download generated parser | |
uses: actions/download-artifact@v4 | |
with: | |
name: parser | |
path: src/ | |
- name: Check for differences with git | |
run: | | |
if ! git diff --exit-code src/parser.c; then | |
echo "::error file=src/parser.c,line=1::The generated parser is different from the commit's, please run npm run build and commit the new parser" | |
exit 1 | |
fi | |
tests: | |
needs: [generate] | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
name: Run test suite on ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
cache: "npm" | |
node-version: "20" | |
- name: Download generated parser | |
uses: actions/download-artifact@v4 | |
with: | |
name: parser | |
path: src/ | |
- run: npm ci | |
- name: Run test suite | |
run: npm test | |
shell: bash | |
- name: Test parsing sample Nim files | |
run: npm exec -- tree-sitter parse -s -t -q 'samples/**/*.nim' | |
shell: bash | |
rust: | |
needs: [generate] | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
name: Run rust test build on ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download generated parser | |
uses: actions/download-artifact@v4 | |
with: | |
name: parser | |
path: src/ | |
- name: Install Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Run test build | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
wasm: | |
needs: [generate] | |
runs-on: ubuntu-latest | |
name: Run WASM test build | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download generated parser | |
uses: actions/download-artifact@v4 | |
with: | |
name: parser | |
path: src/ | |
- name: Setup NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
cache: "npm" | |
node-version: "20" | |
- name: Install dependencies | |
run: npm ci | |
- name: Run test build | |
run: npx tree-sitter build --wasm | |
success: | |
needs: | |
- compare-parser | |
- generate | |
- tests | |
- rust | |
- wasm | |
if: always() | |
runs-on: ubuntu-latest | |
name: "All checks passed" | |
steps: | |
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') | |
name: "Previous jobs failed" | |
run: | | |
echo "::error::One of the previous jobs failed" | |
exit 1 |