Add benchmark script and expand test coverage to 105 tests #8
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
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| tags-ignore: ['**'] | |
| pull_request: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| settings: | |
| - host: macos-latest | |
| target: aarch64-apple-darwin | |
| build: npx napi build --platform --release --no-dts-header --target aarch64-apple-darwin | |
| - host: macos-latest | |
| target: x86_64-apple-darwin | |
| build: npx napi build --platform --release --no-dts-header --target x86_64-apple-darwin | |
| - host: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| build: npx napi build --platform --release --no-dts-header --target x86_64-unknown-linux-gnu | |
| - host: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| build: | | |
| sudo apt-get update | |
| sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | |
| export CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc | |
| export CXX_aarch64_unknown_linux_gnu=aarch64-linux-gnu-g++ | |
| export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc | |
| npx napi build --platform --release --no-dts-header --target aarch64-unknown-linux-gnu | |
| - host: windows-latest | |
| target: x86_64-pc-windows-msvc | |
| build: npx napi build --platform --release --no-dts-header --target x86_64-pc-windows-msvc | |
| name: Build - ${{ matrix.settings.target }} | |
| runs-on: ${{ matrix.settings.host }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.settings.target }} | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Build native addon | |
| run: ${{ matrix.settings.build }} | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: bindings-${{ matrix.settings.target }} | |
| path: '*.node' | |
| if-no-files-found: error | |
| test: | |
| name: Test - node@${{ matrix.node }} (${{ matrix.os }}) | |
| needs: build | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| node: [22] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Determine artifact name | |
| id: artifact | |
| shell: bash | |
| run: | | |
| if [[ "${{ matrix.os }}" == "macos-latest" ]]; then | |
| echo "name=bindings-aarch64-apple-darwin" >> $GITHUB_OUTPUT | |
| elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then | |
| echo "name=bindings-x86_64-unknown-linux-gnu" >> $GITHUB_OUTPUT | |
| elif [[ "${{ matrix.os }}" == "windows-latest" ]]; then | |
| echo "name=bindings-x86_64-pc-windows-msvc" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ steps.artifact.outputs.name }} | |
| path: . | |
| - name: Run tests | |
| run: npm test |