Skip to content

0.1.9

0.1.9 #62

Workflow file for this run

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 }}:/workspace -w /workspace'
run: |
set -e
export DEBIAN_FRONTEND=noninteractive
apt-get update
apt-get install -y curl ca-certificates xz-utils
# Install Node.js using a different approach - download pre-built binary directly
NODE_VERSION="${{ matrix.node }}"
case "$NODE_VERSION" in
"20")
FULL_VERSION="20.18.0"
;;
"22")
FULL_VERSION="22.11.0" # Use slightly older version of 22 for stability
;;
*)
echo "Unsupported Node version: $NODE_VERSION"
exit 1
;;
esac
# Download and install Node.js binary
cd /tmp
curl -fsSL "https://nodejs.org/dist/v${FULL_VERSION}/node-v${FULL_VERSION}-linux-arm64.tar.xz" -o node.tar.xz
tar -xf node.tar.xz
cp -r "node-v${FULL_VERSION}-linux-arm64"/* /usr/local/
rm -rf node.tar.xz "node-v${FULL_VERSION}-linux-arm64"
# Return to workspace
cd /workspace
# Verify we're in the right directory and have the required files
pwd
ls -la
echo "Looking for package-lock.json:"
ls -la package-lock.json || echo "package-lock.json not found"
node --version
npm --version
npm ci
npm test
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 }}