0.1.8 #56
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 | |
env: | |
DEBUG: napi:* | |
APP_NAME: chia-block-listener | |
MACOSX_DEPLOYMENT_TARGET: '10.13' | |
permissions: | |
contents: write | |
id-token: write | |
on: | |
push: | |
branches: | |
- main | |
tags-ignore: | |
- '**' | |
paths-ignore: | |
- '**/*.md' | |
- LICENSE | |
- '**/*.gitignore' | |
- .editorconfig | |
- docs/** | |
pull_request: | |
branches: | |
- '**' | |
jobs: | |
rust-checks: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
- name: Clippy | |
run: cargo clippy --workspace --all-features --all-targets | |
- name: Unused dependencies | |
run: | | |
cargo install cargo-machete --locked | |
cargo machete | |
- name: Fmt | |
run: cargo fmt --all -- --files-with-diff --check | |
build: | |
needs: rust-checks | |
strategy: | |
fail-fast: false | |
matrix: | |
settings: | |
- host: macos-latest | |
target: x86_64-apple-darwin | |
build: npm run build -- --target x86_64-apple-darwin && node scripts/post-build.js | |
- host: windows-latest | |
build: npm run build -- --target x86_64-pc-windows-msvc && node scripts/post-build.js | |
target: x86_64-pc-windows-msvc | |
- host: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
build: | | |
set -e && | |
npm run build -- --target x86_64-unknown-linux-gnu && | |
node scripts/post-build.js && | |
strip *.node | |
- host: macos-latest | |
target: aarch64-apple-darwin | |
build: npm run build -- --target aarch64-apple-darwin && node scripts/post-build.js | |
- host: ubuntu-latest | |
target: aarch64-unknown-linux-gnu | |
setup: | | |
sudo apt-get update | |
sudo apt-get install -y gcc-aarch64-linux-gnu | |
build: | | |
set -e && | |
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc && | |
npm run build -- --target aarch64-unknown-linux-gnu && | |
node scripts/post-build.js | |
name: stable - ${{ matrix.settings.target }} - node@22 | |
runs-on: ${{ matrix.settings.host }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
cache: npm | |
- name: Install | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
targets: ${{ 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 }} | |
- uses: goto-bus-stop/setup-zig@v2 | |
if: ${{ matrix.settings.target == 'armv7-unknown-linux-gnueabihf' || matrix.settings.target == 'armv7-unknown-linux-musleabihf' }} | |
with: | |
version: 0.13.0 | |
- name: Setup toolchain | |
run: ${{ matrix.settings.setup }} | |
if: ${{ matrix.settings.setup }} | |
shell: bash | |
- name: Install dependencies | |
run: npm ci | |
- name: Setup node x86 | |
uses: actions/setup-node@v4 | |
if: matrix.settings.target == 'i686-pc-windows-msvc' | |
with: | |
node-version: 22 | |
cache: npm | |
architecture: x86 | |
- name: Setup toolchain | |
run: ${{ matrix.settings.setup }} | |
if: ${{ matrix.settings.setup }} | |
shell: bash | |
- name: Build | |
run: ${{ matrix.settings.build }} | |
shell: bash | |
- name: List files after build | |
run: | | |
echo "=== Current directory contents ===" | |
ls -la | |
echo "=== Looking for .node files ===" | |
find . -name "*.node" -type f | |
echo "=== Looking for files matching pattern ===" | |
ls -la ${{ env.APP_NAME }}.*.node || echo "No files match the pattern" | |
echo "=== Environment variables ===" | |
echo "APP_NAME: ${{ env.APP_NAME }}" | |
echo "Target: ${{ matrix.settings.target }}" | |
shell: bash | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: bindings-${{ matrix.settings.target }} | |
path: ${{ env.APP_NAME }}.*.node | |
if-no-files-found: error | |
test-macOS-windows-binding: | |
name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }} | |
needs: | |
- build | |
strategy: | |
fail-fast: false | |
matrix: | |
settings: | |
- host: macos-latest | |
target: x86_64-apple-darwin | |
- host: windows-latest | |
target: x86_64-pc-windows-msvc | |
node: | |
- '20' | |
- '22' | |
runs-on: ${{ matrix.settings.host }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: npm | |
architecture: x64 | |
- name: Install dependencies | |
run: npm ci | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: bindings-${{ matrix.settings.target }} | |
path: . | |
- name: Move artifacts | |
run: npm run artifacts | |
- name: List packages | |
run: ls -R . | |
shell: bash | |
- name: Test bindings | |
run: npm test | |
test-linux-x64-gnu-binding: | |
name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }} | |
needs: | |
- build | |
strategy: | |
fail-fast: false | |
matrix: | |
node: | |
- '20' | |
- '22' | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: npm | |
- name: Install dependencies | |
run: npm ci | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: bindings-x86_64-unknown-linux-gnu | |
path: . | |
- name: Install dependencies | |
run: npm ci | |
- name: Move artifacts | |
run: npm run artifacts | |
- name: List packages | |
run: ls -R . | |
shell: bash | |
- name: Test bindings | |
run: npm test | |
test-linux-aarch64-gnu-binding: | |
name: Test bindings on aarch64-unknown-linux-gnu - node@${{ matrix.node }} | |
needs: | |
- build | |
strategy: | |
fail-fast: false | |
matrix: | |
node: | |
- '20' | |
- '22' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: bindings-aarch64-unknown-linux-gnu | |
path: . | |
- name: Install dependencies | |
run: npm ci | |
- name: Move artifacts | |
run: npm run artifacts | |
- name: List packages | |
run: ls -R . | |
shell: bash | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64 | |
- run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
- name: Setup and run tests | |
uses: addnab/docker-run-action@v3 | |
with: | |
image: ubuntu:24.04 | |
options: '--platform linux/arm64 -v ${{ github.workspace }}:/build -w /build' | |
run: | | |
set -e | |
export DEBIAN_FRONTEND=noninteractive | |
apt-get update | |
apt-get install -y curl ca-certificates gnupg | |
# Install Node.js manually to avoid Python segfault issues | |
NODE_VERSION="${{ matrix.node }}" | |
if [ "$NODE_VERSION" = "20" ]; then | |
NODE_DOWNLOAD_URL="https://nodejs.org/dist/v20.18.0/node-v20.18.0-linux-arm64.tar.xz" | |
else | |
NODE_DOWNLOAD_URL="https://nodejs.org/dist/v22.12.0/node-v22.12.0-linux-arm64.tar.xz" | |
fi | |
curl -fsSL "$NODE_DOWNLOAD_URL" | tar -xJ -C /usr/local --strip-components=1 | |
node --version | |
npm --version | |
npm ci | |
npm test | |
ls -la | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- test-macOS-windows-binding | |
- test-linux-x64-gnu-binding | |
- test-linux-aarch64-gnu-binding | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22 | |
cache: npm | |
- name: Install dependencies | |
run: npm ci | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Move artifacts | |
run: npm run artifacts | |
- name: List packages | |
run: ls -R ./npm | |
shell: bash | |
- name: Publish | |
run: | | |
npm config set provenance true | |
if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$"; | |
then | |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc | |
npm publish --access public | |
elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+"; | |
then | |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc | |
npm publish --tag next --access public | |
else | |
echo "Not a release, skipping publish" | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |