chore: fixing the toolchain version #25
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: CI | |
on: | |
push: | |
# tags: | |
# - 'v[0-9]+.[0-9]+.[0-9]+' | |
env: | |
DEBUG: napi:* | |
APP_NAME: scylla_pg_js | |
MACOSX_DEPLOYMENT_TARGET: '10.13' | |
jobs: | |
npm_build: | |
uses: ./.github/workflows/npm_build.yml | |
rust_build: | |
uses: ./.github/workflows/rust_build.yml | |
build: | |
# multiple needs | |
needs: | |
- npm_build | |
- rust_build | |
# if all needs pass | |
if: | |
always() && needs.npm_build.result == 'success' && needs.rust_build.result == 'success' | |
strategy: | |
fail-fast: false | |
matrix: | |
settings: | |
- host: macos-latest | |
target: x86_64-apple-darwin | |
build: | | |
cd scylla_pg_js && npm run build -- --target x86_64-apple-darwin | |
- host: macos-latest | |
target: aarch64-apple-darwin | |
build: | | |
cd scylla_pg_js && npm run build -- --target aarch64-apple-darwin | |
- host: windows-latest | |
build: cd scylla_pg_js && npm run build -- --target x86_64-pc-windows-msvc | |
target: x86_64-pc-windows-msvc | |
- host: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian | |
build: |- | |
set -e && | |
cd scylla_pg_js && npm run build -- --target x86_64-unknown-linux-gnu | |
- host: ubuntu-latest | |
target: x86_64-unknown-linux-musl | |
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine | |
build: |- | |
set -e && | |
rustup target add x86_64-unknown-linux-musl && | |
cd scylla_pg_js && npm run build -- --target x86_64-unknown-linux-musl | |
- host: ubuntu-latest | |
target: aarch64-unknown-linux-musl | |
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine | |
build: |- | |
set -e && | |
cd scylla_pg_js && | |
rustup target add aarch64-unknown-linux-musl && | |
npm run build -- --target aarch64-unknown-linux-musl && | |
/aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node | |
# TODO add aarch64-unknown-linux-gnu | |
# - host: ubuntu-latest | |
# target: aarch64-unknown-linux-gnu | |
# docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64 | |
# build: |- | |
# set -e && | |
# PATH=$PATH:$(pwd) chmod -R 555 $PATH && | |
# cd scylla_pg_js && npm run build -- --target aarch64-unknown-linux-gnu && | |
# aarch64-unknown-linux-gnu-strip *.node | |
name: stable - ${{ matrix.settings.target }} - node@18 | |
runs-on: ${{ matrix.settings.host }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
if: ${{ !matrix.settings.docker }} | |
with: | |
node-version: 18 | |
check-latest: true | |
- name: Install toolchain | |
uses: dtolnay/[email protected] | |
if: ${{ !matrix.settings.docker }} | |
with: | |
toolchain: 1.75.0 | |
target: ${{ matrix.settings.target }} | |
- name: Cache cargo | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
.cargo-cache | |
target/ | |
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }} | |
- name: Install dependencies | |
run: cd scylla_pg_js && npm install | |
- name: Build in docker | |
uses: addnab/docker-run-action@v3 | |
if: ${{ matrix.settings.docker }} | |
with: | |
image: ${{ matrix.settings.docker }} | |
options: '--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' | |
run: ${{ matrix.settings.build }} | |
- name: Build | |
run: ${{ matrix.settings.build }} | |
if: ${{ !matrix.settings.docker }} | |
shell: bash | |
# - name: setup docker container env for macos | |
# run: brew install colima docker docker-compose | |
# if: ${{ matrix.settings.host == 'macos-latest' }} | |
# - name: colima start for macos | |
# run: colima start | |
# if: ${{ matrix.settings.host == 'macos-latest' }} | |
# - name: Set up Database | |
# run: docker-compose up -d | |
# if: ${{ matrix.settings.host != 'windows-latest' }} | |
# - name: Sleep for 30s | |
# uses: juliangruber/[email protected] | |
# with: | |
# time: 30s | |
# - name: Run Migrations | |
# run: PATH=$PATH:$(pwd) bin/component-test-setup.sh | |
# if: ${{ matrix.settings.host != 'windows-latest' }} | |
# - name: component lib test | |
# run: make withenv RECIPE=test.component.lib | |
# if: ${{ matrix.settings.host != 'windows-latest' }} | |
- name: List packages | |
run: ls -R . | |
shell: bash | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: bindings-${{ matrix.settings.target }} | |
path: scylla_pg_js/${{ env.APP_NAME }}.*.node | |
if-no-files-found: error | |
npm-publish: | |
name: npm publish | |
runs-on: macos-latest | |
environment: publish | |
env: | |
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
needs: | |
- build | |
if: needs.build.result == 'success' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
check-latest: true | |
- name: Install dependencies | |
run: cd scylla_pg_js && npm install | |
- name: Download all artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: scylla_pg_js/artifacts | |
- run: cd scylla_pg_js/artifacts && cp -R **/*.node . | |
- run: cd scylla_pg_js && npm run universal | |
- name: Move artifacts | |
run: cd scylla_pg_js && npm run artifacts | |
- run: ls -R ./scylla_pg_js/npm | |
- run: ls -R ./scylla_pg_js/artifacts | |
# - name: Publish | |
# run: PATH=$PATH:$(pwd) bin/npm-release.sh # only run on release created or tag |