diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index bf030c6..eb2617d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -113,8 +113,8 @@ jobs: ${{ env.APP_NAME }}.*.node ${{ env.APP_NAME }}.*.wasm if-no-files-found: error - test-macOS-windows-binding: - name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }} + test: + name: cargo test - ${{ matrix.settings.target }} needs: - build strategy: @@ -123,106 +123,33 @@ jobs: settings: - host: windows-latest target: x86_64-pc-windows-msvc - architecture: x64 - host: macos-latest target: aarch64-apple-darwin - architecture: arm64 - host: macos-latest target: x86_64-apple-darwin - architecture: x64 - node: - - '22' - - '24' + - host: ubuntu-latest + target: x86_64-unknown-linux-gnu runs-on: ${{ matrix.settings.host }} steps: - uses: actions/checkout@v6 - - name: Setup node - uses: actions/setup-node@v6 - with: - node-version: ${{ matrix.node }} - cache: yarn - architecture: ${{ matrix.settings.architecture }} - - name: Install dependencies - run: yarn install - - name: Download artifacts - uses: actions/download-artifact@v8 - with: - name: bindings-${{ matrix.settings.target }} - path: . - - name: List packages - run: ls -R . - shell: bash - - name: Test bindings - run: yarn test - test-linux-binding: - name: Test ${{ matrix.target }} - node@${{ matrix.node }} - needs: - - build - strategy: - fail-fast: false - matrix: - target: - - x86_64-unknown-linux-gnu - node: - - '22' - - '24' - exclude: - - target: armv7-unknown-linux-gnueabihf - node: '24' - runs-on: ${{ contains(matrix.target, 'aarch64') && 'ubuntu-24.04-arm' || 'ubuntu-latest' }} - steps: - - uses: actions/checkout@v6 - - name: Setup node - uses: actions/setup-node@v6 - with: - node-version: ${{ matrix.node }} - cache: yarn - - name: Output docker params - id: docker - run: | - node -e " - if ('${{ matrix.target }}'.startsWith('aarch64')) { - console.log('PLATFORM=linux/arm64') - } else if ('${{ matrix.target }}'.startsWith('armv7')) { - console.log('PLATFORM=linux/arm/v7') - } else { - console.log('PLATFORM=linux/amd64') - } - " >> $GITHUB_OUTPUT - node -e " - if ('${{ matrix.target }}'.endsWith('-musl')) { - console.log('IMAGE=node:${{ matrix.node }}-alpine') - } else { - console.log('IMAGE=node:${{ matrix.node }}-slim') - } - " >> $GITHUB_OUTPUT - - name: Install dependencies - run: | - yarn config set --json supportedArchitectures.cpu '["current", "arm64", "x64", "arm"]' - yarn config set --json supportedArchitectures.libc '["current", "musl", "gnu"]' - yarn install - - name: Download artifacts - uses: actions/download-artifact@v8 - with: - name: bindings-${{ matrix.target }} - path: . - - name: List packages - run: ls -R . - shell: bash - - name: Set up QEMU - uses: docker/setup-qemu-action@v4 - if: ${{ contains(matrix.target, 'armv7') }} + - name: Install Rust + uses: dtolnay/rust-toolchain@stable with: - platforms: all - - run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes - if: ${{ contains(matrix.target, 'armv7') }} - - name: Test bindings - uses: tj-actions/docker-run@v2 + toolchain: stable + targets: ${{ matrix.settings.target }} + - name: Cache cargo + uses: actions/cache@v5 with: - image: ${{ steps.docker.outputs.IMAGE }} - name: test-bindings-${{ matrix.target }} - options: '-v ${{ github.workspace }}:${{ github.workspace }} -w ${{ github.workspace }} --platform ${{ steps.docker.outputs.PLATFORM }}' - args: yarn test + path: | + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ matrix.settings.target }}-test-${{ matrix.settings.host }} + - name: Run tests + run: cargo test + + # Linux tests are covered by the `test` job above (ubuntu-latest) publish: name: Publish runs-on: ubuntu-latest @@ -231,8 +158,7 @@ jobs: id-token: write needs: - lint - - test-macOS-windows-binding - - test-linux-binding + - test steps: - uses: actions/checkout@v6 - name: Setup node