Fix #462 #1319
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: Test | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [16.x, lts/*, latest] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- run: npm install | |
- run: npm run build --if-present | |
- run: npm test | |
examples: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- name: Install dependencies | |
run: | | |
npm install | |
npm install -g tsx | |
- run: npm run build | |
- name: Run Examples | |
run: | | |
examples=$(find ./examples -name "*.ts") | |
for example in $examples; do | |
echo "Run example $example" | |
tsx $example > /dev/null | |
exit_code=$? | |
if [ $exit_code -ne 0 ]; then | |
echo "Error executing $example" | |
exit 1 | |
fi | |
done | |
coverage: | |
runs-on: ubuntu-latest | |
needs: | |
- test | |
- examples | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: npm install | |
- name: Coverage | |
run: npm test -- --coverage | |
- name: Upload code coverage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage | |
path: coverage/lcov.info |