Skip to content
63 changes: 63 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,40 @@ jobs:
run: cargo fmt -- --check
- name: Clippy
run: cargo clippy

test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-test-
- name: Run tests with coverage
run: cargo llvm-cov --verbose --workspace --lcov --output-path=lcov.info
- name: Upload coverage to Coveralls
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
uses: coverallsapp/github-action@v2.3.6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: lcov.info
parallel: true
build:
strategy:
fail-fast: false
Expand Down Expand Up @@ -159,6 +193,14 @@ jobs:
shell: bash
- name: Test bindings
run: yarn test
- name: Upload coverage report
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
uses: coverallsapp/github-action@v2.3.6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage/lcov.info
parallel: true
test-linux-binding:
name: Test ${{ matrix.target }} - node@${{ matrix.node }}
needs:
Expand Down Expand Up @@ -225,6 +267,26 @@ jobs:
image: ${{ steps.docker.outputs.IMAGE }}
options: '-v ${{ github.workspace }}:${{ github.workspace }} -w ${{ github.workspace }} --platform ${{ steps.docker.outputs.PLATFORM }}'
run: yarn test
- name: Upload coverage report
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
uses: coverallsapp/github-action@v2.3.6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage/lcov.info
parallel: true
coverage:
name: Report Coverage
runs-on: ubuntu-latest
needs: [test, test-macOS-windows-binding, test-linux-binding]
steps:
- name: Send coverage
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
uses: coverallsapp/github-action@v2.3.6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
publish:
name: Publish
runs-on: ubuntu-latest
Expand All @@ -233,6 +295,7 @@ jobs:
id-token: write
needs:
- lint
- test
- test-macOS-windows-binding
- test-linux-binding
steps:
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"format:rs": "cargo fmt",
"lint": "oxlint .",
"prepublishOnly": "napi prepublish -t npm",
"test": "ava",
"test": "nyc --reporter=lcov ava",
"version": "napi version",
"prepare": "husky"
},
Expand All @@ -66,6 +66,7 @@
"husky": "^9.1.7",
"lint-staged": "^16.1.2",
"npm-run-all2": "^8.0.4",
"nyc": "^17.1.0",
"oxlint": "^1.8.0",
"prettier": "^3.6.2",
"tinybench": "^5.0.0",
Expand Down
Loading
Loading