Skip to content

chore(release): publish and debug ci #59

chore(release): publish and debug ci

chore(release): publish and debug ci #59

Workflow file for this run

name: Build rsapi
env:
DEBUG: 'napi:*'
MACOSX_DEPLOYMENT_TARGET: '10.13'
NODE_OPTIONS: '--max-old-space-size=3072'
CARGO_UNSTABLE_TARGET_APPLIES_TO_HOST: true
CARGO_TARGET_APPLIES_TO_HOST: false
on:
push:
branches:
- master
# tags-ignore:
# - '**'
# paths:
# - 'packages/rsapi'
# - 'sync'
pull_request:
# paths:
# - 'packages/rsapi'
# - 'sync'
jobs:
build-freebsd:
runs-on: macos-12
if: "startsWith(github.event.head_commit.message, 'chore(release): publish')"
name: Build FreeBSD
steps:
- uses: actions/checkout@v3
- name: Build
id: build
uses: cross-platform-actions/[email protected]
env:
DEBUG: 'napi:*'
RUSTUP_HOME: /home/runner/rustup
CARGO_HOME: /home/runner/cargo
RUSTUP_IO_THREADS: 1
with:
operating_system: freebsd
version: '13.2'
memory: 13G
cpu_count: 3
hypervisor: qemu
environment_variables: 'DEBUG RUSTUP_IO_THREADS'
shell: bash
run: |
env | sort
sudo pkg install -y -f curl node libnghttp2 npm
sudo npm install -g yarn --ignore-scripts
curl https://sh.rustup.rs -sSf --output rustup.sh
sh rustup.sh -y --default-toolchain nightly-2024-12-09
source "$HOME/.cargo/env"
echo "~~~~ rustc --version ~~~~"
rustc --version
echo "~~~~ node -v ~~~~"
node -v
echo "~~~~ yarn --version ~~~~"
yarn --version
pwd
ls -lah
whoami
env
freebsd-version
yarn install --immutable --mode=skip-build
yarn build
strip -x packages/*/*.node
rm -rf node_modules
rm -rf target
rm -rf .yarn/cache
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bindings-freebsd-amd64
path: packages/*/*.node
if-no-files-found: error
build:
if: "!contains(github.event.head_commit.message, 'skip ci')"
strategy:
fail-fast: false
matrix:
settings:
- host: macos-latest
architecture: x64
target: 'x86_64-apple-darwin'
build: |
yarn build --target x86_64-apple-darwin
strip -x packages/*/*.node
- host: windows-latest
architecture: x64
build: yarn build
target: 'x86_64-pc-windows-msvc'
# Blocked by https://github.com/briansmith/ring/pull/1554
#- host: windows-latest
# architecture: x64
# build: |
# yarn lerna exec "yarn build --target aarch64-pc-windows-msvc" --concurrency 1 --stream --no-prefix
# target: 'aarch64-pc-windows-msvc'
- host: ubuntu-latest
architecture: x64
target: 'x86_64-unknown-linux-gnu'
build: >-
set -e &&
cargo install cargo-zigbuild &&
cargo zigbuild -p rsapi --target x86_64-unknown-linux-gnu.2.17 --release &&
cp -v target/x86_64-unknown-linux-gnu/release/librsapi.so ./packages/rsapi/rsapi.linux-x64-gnu.node &&
strip -x packages/*/*.node
- host: macos-latest
architecture: x64
target: 'aarch64-apple-darwin'
build: |
sudo rm -Rf /Library/Developer/CommandLineTools/SDKs/*;
export CC=$(xcrun -f clang);
export CXX=$(xcrun -f clang++);
SYSROOT=$(xcrun --sdk macosx --show-sdk-path);
export CFLAGS="-isysroot $SYSROOT -isystem $SYSROOT";
yarn build --target aarch64-apple-darwin
strip -x packages/*/*.node
- host: ubuntu-20.04
architecture: x64
target: 'aarch64-unknown-linux-gnu'
setup: |
sudo apt-get update
sudo apt-get install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu -y
build: |
rustup toolchain install $(cat ./rust-toolchain)
rustup target add aarch64-unknown-linux-gnu
yarn lerna exec "yarn build --target aarch64-unknown-linux-gnu" --concurrency 1 --stream --no-prefix
aarch64-linux-gnu-strip packages/*/*.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
cache: yarn
architecture: ${{ matrix.settings.architecture }}
- name: Install
uses: actions-rs/toolchain@v1
if: ${{ !matrix.settings.docker }}
with:
toolchain: nightly-2024-12-09
profile: minimal
override: true
target: ${{ matrix.settings.target }}
- name: Install Zig
uses: goto-bus-stop/setup-zig@v2
- name: Generate Cargo.lock
uses: actions-rs/cargo@v1
if: ${{ !matrix.settings.docker }}
with:
command: generate-lockfile
- name: Cache cargo registry
uses: actions/cache@v2
with:
path: ~/.cargo/registry
key: ${{ matrix.settings.target }}-node@18-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v2
with:
path: ~/.cargo/git
key: ${{ matrix.settings.target }}-node@18-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
- name: Cache NPM dependencies
uses: actions/cache@v2
with:
path: node_modules
key: npm-cache-${{ matrix.settings.target }}-node@18-${{ hashFiles('yarn.lock') }}
- name: Setup toolchain
run: ${{ matrix.settings.setup }}
if: ${{ matrix.settings.setup }}
shell: bash
- name: 'Install dependencies'
run: yarn install --immutable --mode=skip-build
- name: Build in docker
uses: addnab/docker-run-action@v3
if: ${{ matrix.settings.docker }}
with:
image: ${{ matrix.settings.docker }}
options: -v ${{ env.HOME }}/.cargo/git:/root/.cargo/git -v ${{ env.HOME }}/.cargo/registry:/root/.cargo/registry -v ${{ github.workspace }}:/build -w /build
run: ${{ matrix.settings.build }}
- name: 'Or Build without docker'
run: ${{ matrix.settings.build }}
if: ${{ !matrix.settings.docker }}
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.settings.target }}
path: packages/*/*.node
if-no-files-found: error
publish:
name: Publish
if: "startsWith(github.event.head_commit.message, 'chore(release): publish')"
runs-on: ubuntu-latest
needs:
- build
# - build-freebsd
steps:
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
check-latest: true
cache: yarn
- name: Cache NPM dependencies
uses: actions/cache@v2
with:
path: node_modules
key: npm-cache-ubuntu-latest-publish-${{ hashFiles('yarn.lock') }}
- name: Install dependencies
run: yarn install --immutable --mode=skip-build
- name: Download all artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: List artifacts
run: ls -R artifacts
shell: bash
# BUGGY
#- name: Move artifacts
# run: yarn artifacts
- name: Move artifacts manually
run: |
mv artifacts/bindings-x86_64-unknown-linux-gnu/rsapi/rsapi.linux-x64-gnu.node packages/rsapi/npm/linux-x64-gnu/
mv artifacts/bindings-x86_64-pc-windows-msvc/rsapi/rsapi.win32-x64-msvc.node packages/rsapi/npm/win32-x64-msvc/
mv artifacts/bindings-x86_64-apple-darwin/rsapi/rsapi.darwin-x64.node packages/rsapi/npm/darwin-x64/
mv artifacts/bindings-aarch64-apple-darwin/rsapi/rsapi.darwin-arm64.node packages/rsapi/npm/darwin-arm64/
mv artifacts/bindings-aarch64-unknown-linux-gnu/rsapi/rsapi.linux-arm64-gnu.node packages/rsapi/npm/linux-arm64-gnu/
mv artifacts/bindings-freebsd-amd64/rsapi/rsapi.freebsd-x64.node packages/rsapi/npm/freebsd-x64/
- name: List packages
run: ls -R packages
shell: bash
- name: Lerna publish
if: "startsWith(github.event.head_commit.message, 'chore(release): publish')"
run: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
# yarn workspaces foreach -A -j 1 run version --no-gh-release
yarn workspaces foreach -A -j 1 run prepublishOnly --no-gh-release
# yarn lerna publish from-package --yes
# ./scripts/publish.sh
cd packages/rsapi && npm publish --access public
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}