Merge pull request #11 from glommer/fix-serial #46
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: Build & test pgmicro | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| env: | |
| DEBUG: napi:* | |
| MACOSX_DEPLOYMENT_TARGET: "10.13" | |
| CARGO_INCREMENTAL: "0" | |
| CARGO_NET_RETRY: 10 | |
| concurrency: | |
| group: pgmicro-napi-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-napi: | |
| name: NAPI ${{ matrix.settings.target }} | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| settings: | |
| - host: macos-latest | |
| target: aarch64-apple-darwin | |
| build: | | |
| cd bindings/javascript | |
| npx napi build --platform --esm --features default-postgres \ | |
| --profile release-official \ | |
| --manifest-path ../../bindings/javascript/Cargo.toml \ | |
| --output-dir ../../npm/pgmicro \ | |
| --target aarch64-apple-darwin | |
| python3 ../../npm/rename-node.py ../../npm/pgmicro | |
| - host: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian | |
| build: | | |
| cd bindings/javascript | |
| npx napi build --platform --esm --features default-postgres \ | |
| --profile release-official \ | |
| --manifest-path ../../bindings/javascript/Cargo.toml \ | |
| --output-dir ../../npm/pgmicro \ | |
| --target x86_64-unknown-linux-gnu | |
| python3 ../../npm/rename-node.py ../../npm/pgmicro | |
| - host: ubuntu-24.04-arm | |
| target: aarch64-unknown-linux-gnu | |
| build: | | |
| cd bindings/javascript | |
| npx napi build --platform --esm --features default-postgres \ | |
| --profile release-official \ | |
| --manifest-path ../../bindings/javascript/Cargo.toml \ | |
| --output-dir ../../npm/pgmicro \ | |
| --target aarch64-unknown-linux-gnu | |
| python3 ../../npm/rename-node.py ../../npm/pgmicro | |
| runs-on: ${{ matrix.settings.host }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup node | |
| uses: actions/setup-node@v4 | |
| if: ${{ !matrix.settings.docker }} | |
| with: | |
| node-version: 20 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| if: ${{ !matrix.settings.docker }} | |
| with: | |
| toolchain: stable | |
| targets: ${{ matrix.settings.target }} | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| .cargo-cache | |
| target/ | |
| key: pgmicro-napi-${{ matrix.settings.target }}-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: pgmicro-napi-${{ matrix.settings.target }}- | |
| save-always: true | |
| - name: Install JS dependencies | |
| working-directory: bindings/javascript | |
| run: yarn install | |
| - name: Build common | |
| working-directory: bindings/javascript | |
| run: yarn workspace @tursodatabase/database-common build | |
| - name: Build in docker | |
| if: ${{ matrix.settings.docker }} | |
| working-directory: . | |
| shell: bash | |
| run: | | |
| docker run --rm --user 0:0 \ | |
| -v ${{ github.workspace }}/.cargo-cache/git/db:/usr/local/cargo/git/db \ | |
| -v ${{ github.workspace }}/.cargo/registry/cache:/usr/local/cargo/registry/cache \ | |
| -v ${{ github.workspace }}/.cargo/registry/index:/usr/local/cargo/registry/index \ | |
| -v ${{ github.workspace }}:/build \ | |
| -w /build \ | |
| ${{ matrix.settings.docker }} \ | |
| bash -c "${{ matrix.settings.build }}" | |
| - name: Build | |
| if: ${{ !matrix.settings.docker }} | |
| shell: bash | |
| run: ${{ matrix.settings.build }} | |
| - name: Upload NAPI artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pgmicro-napi-${{ matrix.settings.target }} | |
| path: npm/pgmicro/pgmicro.*.node | |
| if-no-files-found: error | |
| test-napi: | |
| name: Test NAPI bindings | |
| needs: [build-napi] | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install JS dependencies | |
| working-directory: bindings/javascript | |
| run: yarn install | |
| - name: Build database-common | |
| working-directory: bindings/javascript | |
| run: yarn workspace @tursodatabase/database-common build | |
| - name: Download linux-x64 NAPI artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pgmicro-napi-x86_64-unknown-linux-gnu | |
| path: npm/pgmicro/ | |
| - name: Install pgmicro deps and compile TS | |
| working-directory: npm/pgmicro | |
| run: | | |
| npm install | |
| npx tsc | |
| - name: Run tests | |
| working-directory: npm/pgmicro | |
| run: npx vitest --run | |
| build-cli: | |
| name: CLI ${{ matrix.settings.target }} | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| settings: | |
| - host: macos-latest | |
| target: aarch64-apple-darwin | |
| platform-dir: darwin-arm64 | |
| - host: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| platform-dir: linux-x64-gnu | |
| - host: ubuntu-24.04-arm | |
| target: aarch64-unknown-linux-gnu | |
| platform-dir: linux-arm64-gnu | |
| runs-on: ${{ matrix.settings.host }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.settings.target }} | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: pgmicro-cli-${{ matrix.settings.target }}-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: pgmicro-cli-${{ matrix.settings.target }}- | |
| save-always: true | |
| - name: Build pgmicro CLI | |
| run: cargo build -p pgmicro --profile release-official --target ${{ matrix.settings.target }} | |
| - name: Upload CLI artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pgmicro-cli-${{ matrix.settings.target }} | |
| path: target/${{ matrix.settings.target }}/release-official/pgmicro | |
| if-no-files-found: error |