Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
156b158
feat: prepare for npm release
ryan-thio Dec 6, 2025
9df7fdd
chore: update ci
ryan-thio Dec 6, 2025
65719b5
chore: update ci and node
owenizedd Dec 6, 2025
609e2fe
chore: install perl make
owenizedd Dec 6, 2025
529cb34
chore: update ci
owenizedd Dec 6, 2025
675f9e7
Fix Windows builds: Use setup-bun action for Windows, dogfood Bum on …
owenizedd Dec 6, 2025
24d0450
chore: test deploy
owenizedd Dec 6, 2025
e5a00d4
Fix build: Separate napi and bin builds to prevent --target conflicts
owenizedd Dec 6, 2025
74ec35c
Fix Alpine builds: Add musl-dev and gcc for libz-ng-sys compilation
owenizedd Dec 6, 2025
1457935
Fix aarch64-musl cross-compile: Set linker and CC to musl-cross toolc…
owenizedd Dec 6, 2025
1a00879
Fix cross-compilation: Switch to rustls-tls and pure Rust zip
owenizedd Dec 6, 2025
80b5bb0
chore: update cargo lock
owenizedd Dec 6, 2025
b1ad29b
Add test job to CI: tests, clippy, and formatting checks
owenizedd Dec 6, 2025
be34863
Add universal-apple-darwin to napi triples config
owenizedd Dec 6, 2025
06354da
Fix universal macOS: Move artifacts to root before napi universal
owenizedd Dec 6, 2025
d54b236
Fix universal macOS: Download artifacts directly to root, add debug l…
owenizedd Dec 6, 2025
ea6ef7e
Fix macOS x64 build: Use macos-13 (Intel) and explicit target
owenizedd Dec 6, 2025
aa7782f
Fix universal: Clean hashed files, use npx napi universal with output…
owenizedd Dec 6, 2025
a2318f9
Fix napi universal: Remove invalid -o flag, add file verification
owenizedd Dec 6, 2025
744def1
Fix universal macOS build: Download to artifacts dir, simplify steps
owenizedd Dec 6, 2025
f018d40
Add cleanup step to remove hashed node files before universal build
owenizedd Dec 6, 2025
af9e404
Add -d flag to napi universal to specify current directory
owenizedd Dec 6, 2025
ea1c90a
Clean up hashed node files before napi artifacts in publish job
owenizedd Dec 6, 2025
863152f
0.7.0
owenizedd Dec 6, 2025
60cddfe
bump version 0.7.0
owenizedd Dec 6, 2025
42af2eb
Enable CI to trigger on version tags
owenizedd Dec 6, 2025
ee96910
Bump version to 0.7.0
owenizedd Dec 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
309 changes: 309 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,309 @@
name: CI
env:
DEBUG: napi:*
APP_NAME: bum
MACOSX_DEPLOYMENT_TARGET: "10.13"
permissions:
contents: write
id-token: write
"on":
push:
branches:
- main
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
pull_request:
paths-ignore:
- "**/*.md"
- LICENSE
- "**/*.gitignore"
- .editorconfig
- docs/**
pull_request: null
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: test-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run tests
run: cargo test --lib
- name: Run clippy
run: cargo clippy -- -D warnings
- name: Check formatting
run: cargo fmt --check

build:
needs: test
strategy:
fail-fast: false
matrix:
settings:
- host: macos-13
target: x86_64-apple-darwin
build: |
bun run build:napi --target x86_64-apple-darwin
bun run build:bin
strip -x *.node
- host: windows-latest
build: bun run build
target: x86_64-pc-windows-msvc
- host: macos-latest
target: aarch64-apple-darwin
build: |
bun run build:napi --target aarch64-apple-darwin
bun run build:bin
strip -x *.node
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
build: |-
set -e &&
corepack enable &&
npm install -g bun &&
bun install &&
bun run build:napi --target x86_64-unknown-linux-gnu &&
bun run build:bin &&
strip *.node
- host: ubuntu-latest
target: x86_64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: |-
set -e &&
corepack enable &&
npm install -g bun &&
bun install &&
bun run build &&
strip *.node
- host: ubuntu-latest
target: aarch64-unknown-linux-gnu
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
build: |-
set -e &&
corepack enable &&
npm install -g bun &&
bun install &&
bun run build:napi --target aarch64-unknown-linux-gnu &&
bun run build:bin &&
aarch64-unknown-linux-gnu-strip *.node
- host: ubuntu-latest
target: aarch64-unknown-linux-musl
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
build: |-
set -e &&
rustup target add aarch64-unknown-linux-musl &&
corepack enable &&
npm install -g bun &&
bun install &&
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc CC_aarch64_unknown_linux_musl=/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc bun run build:napi --target aarch64-unknown-linux-musl &&
bun run build:bin &&
/aarch64-linux-musl-cross/bin/aarch64-linux-musl-strip *.node
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
if: ${{ !matrix.settings.docker }}
with:
node-version: 22
- name: Install Bum (Unix)
if: ${{ !matrix.settings.docker && runner.os != 'Windows' }}
run: |
curl -fsSL https://github.com/owenizedd/bum/raw/main/install.sh | bash
echo "$HOME/.bum/bin" >> $GITHUB_PATH
echo "$HOME/.bun/bin" >> $GITHUB_PATH
shell: bash
- name: Setup Bun (Windows - fallback to official installer)
if: ${{ !matrix.settings.docker && runner.os == 'Windows' }}
uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3.0"
- name: Use Bun via Bum (Unix)
if: ${{ !matrix.settings.docker && runner.os != 'Windows' }}
run: |
export PATH="$HOME/.bum/bin:$PATH"
bum use 1.3.0
shell: bash
- name: Install
uses: dtolnay/rust-toolchain@stable
if: ${{ !matrix.settings.docker }}
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' }}
with:
version: 0.11.0
- name: Setup toolchain
run: ${{ matrix.settings.setup }}
if: ${{ matrix.settings.setup }}
shell: bash
- name: Setup node x86
if: matrix.settings.target == 'i686-pc-windows-msvc'
run: bun config set supportedArchitectures.cpu "ia32"
shell: bash
- name: Setup node x86 architecture
uses: actions/setup-node@v4
if: matrix.settings.target == 'i686-pc-windows-msvc'
with:
node-version: 22
architecture: x86
- name: Install dependencies
run: bun install
if: ${{ !matrix.settings.docker }}
- 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: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.settings.target }}
path: ${{ env.APP_NAME }}.*.node
if-no-files-found: error

universal-macOS:
name: Build universal macOS binary
needs:
- build
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install Bum
run: |
curl -fsSL https://github.com/owenizedd/bum/raw/main/install.sh | bash
echo "$HOME/.bum/bin" >> $GITHUB_PATH
echo "$HOME/.bun/bin" >> $GITHUB_PATH
shell: bash
- name: Use Bun via Bum
run: |
export PATH="$HOME/.bum/bin:$PATH"
bum use 1.3.0
shell: bash
- name: Install dependencies
run: bun install
- name: Download macOS x64 artifact
uses: actions/download-artifact@v4
with:
name: bindings-x86_64-apple-darwin
path: artifacts
- name: Download macOS arm64 artifact
uses: actions/download-artifact@v4
with:
name: bindings-aarch64-apple-darwin
path: artifacts
- name: List downloaded files
run: |
echo "Current directory: $(pwd)"
ls -la artifacts/
- name: Move artifacts to root
run: |
mv artifacts/*.node .
ls -la *.node
- name: Clean up hashed files
run: |
echo "Removing hashed files..."
rm -f bum.darwin-*-*.node
echo "Files after cleanup:"
ls -la *.node
- name: Combine binaries
run: |
bun run universal
ls -la *.node
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bindings-universal-apple-darwin
path: ${{ env.APP_NAME }}.*.node
if-no-files-found: error

publish:
name: Publish
runs-on: ubuntu-latest
needs:
- build
- universal-macOS
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install Bum
run: |
curl -fsSL https://github.com/owenizedd/bum/raw/main/install.sh | bash
echo "$HOME/.bum/bin" >> $GITHUB_PATH
echo "$HOME/.bun/bin" >> $GITHUB_PATH
shell: bash
- name: Use Bun via Bum
run: |
export PATH="$HOME/.bum/bin:$PATH"
bum use 1.3.0
shell: bash
- name: Install dependencies
run: bun install
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Clean up hashed files
run: |
echo "Removing hashed .node files..."
find artifacts -name "*.node" -name "*-*-*.node" -type f -delete
echo "Remaining files:"
find artifacts -name "*.node" -type f
- name: Move artifacts
run: bun 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 }}
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
/target
.DS_Store

# napi-rs
*.node
node_modules
.cargo-cache
dist

# Generated from bin.ts
bin.js
12 changes: 12 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
node_modules
*.node
target
.cargo-cache
dist
npm
*.log

# Source files (ship compiled versions only)
bin.ts
tsconfig.json

Loading