Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
126 changes: 100 additions & 26 deletions .github/workflows/reusable_release_napi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
name: Check version
runs-on: ubuntu-latest
outputs:
version: ${{ env.version }}
version_changed: ${{ steps.version.outputs.changed }}
env:
name: ${{ inputs.name }}
Expand All @@ -32,25 +31,19 @@ jobs:
file-url: https://unpkg.com/oxc-${{ inputs.name }}@latest/package.json
file-name: napi/${{ inputs.name }}/package.json

- name: Set version name
- name: Show version
if: steps.version.outputs.changed == 'true'
env:
VERSION_NUMBER: ${{ steps.version.outputs.version }}
VERSION_TYPE: ${{ steps.version.outputs.version_type }}
run: |
echo "Version change found! New version: ${VERSION_NUMBER} (${VERSION_NUMBER})"
echo "version=${VERSION_NUMBER}" >> $GITHUB_ENV
version: ${{ steps.version.outputs.version }}
run: echo "version=${version}"

build:
needs: check
if: needs.check.outputs.version_changed == 'true'
name: Package ${{ matrix.target }}
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
env:
version: ${{ needs.check.outputs.version }}
name: ${{ inputs.name }}
outputs:
version: ${{ env.version }}
defaults:
run:
shell: bash
Expand All @@ -60,24 +53,69 @@ jobs:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
build: |
pnpm build --target x86_64-pc-windows-msvc

- os: windows-latest
target: aarch64-pc-windows-msvc
build: |
pnpm build --target aarch64-pc-windows-msvc

- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
build: |
pnpm build --target x86_64-unknown-linux-gnu --use-napi-cross

- os: ubuntu-latest
target: x86_64-unknown-linux-musl
build: |
pnpm build --target x86_64-unknown-linux-musl -x

- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
build: |
pnpm build --target aarch64-unknown-linux-gnu --use-napi-cross

- os: ubuntu-latest
target: aarch64-unknown-linux-musl
build: |
pnpm build --target aarch64-unknown-linux-musl -x

- os: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
build: |
pnpm build --target armv7-unknown-linux-gnueabihf --use-napi-cross

- os: macos-latest
target: x86_64-apple-darwin
build: |
pnpm build --target x86_64-apple-darwin

- os: macos-latest
target: aarch64-apple-darwin
build: |
pnpm build --target aarch64-apple-darwin

- os: ubuntu-latest
target: wasm32-wasip1-threads
build: |
pnpm build --target wasm32-wasip1-threads

# Parser raw transfer is not supported on big-endian systems.
# - os: ubuntu-latest
# target: s390x-unknown-linux-gnu
# build: |
# export CFLAGS="-fuse-ld=lld"
# pnpm build --target s390x-unknown-linux-gnu --use-napi-cross

- os: ubuntu-latest
target: riscv64gc-unknown-linux-gnu
build: |
sudo apt-get update
sudo apt-get install gcc-riscv64-linux-gnu g++-riscv64-linux-gnu -y
export CC=riscv64-linux-gnu-gcc
export CXX=riscv64-linux-gnu-g++
pnpm build --target riscv64gc-unknown-linux-gnu

steps:
- uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1
Expand All @@ -91,36 +129,72 @@ jobs:
with:
version: 0.13.0

- name: Build with zig cross
if: ${{ contains(matrix.target, 'musl') }}
working-directory: napi/${{ inputs.name }}
run: pnpm build -x --target ${{ matrix.target }}
env:
CC: clang # for mimalloc

- name: Build with napi cross
if: ${{ contains(matrix.target, 'gnu') }}
- name: Build
working-directory: napi/${{ inputs.name }}
run: pnpm build --use-napi-cross --target ${{ matrix.target }}
run: ${{ matrix.build }}
shell: bash
env:
CC: clang # for mimalloc

- name: Build
if: ${{ !contains(matrix.target, 'gnu') && !contains(matrix.target, 'musl') }}
working-directory: napi/${{ inputs.name }}
run: pnpm build --target ${{ matrix.target }}

- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: bindings-${{ matrix.target }}
path: |
napi/${{ inputs.name }}/*.node
napi/${{ inputs.name }}/*.wasm

build-freebsd:
needs: check
if: needs.check.outputs.version_changed == 'true'
name: Build FreeBSD
runs-on: ubuntu-latest
steps:
- uses: taiki-e/checkout-action@b13d20b7cda4e2f325ef19895128f7ff735c0b3d # v1.3.1
- name: Build
id: build
uses: cross-platform-actions/action@fe0167d8082ac584754ef3ffb567fded22642c7d # v0.27.0
env:
DEBUG: napi:*
RUSTUP_IO_THREADS: 1
with:
operating_system: freebsd
version: "14.0"
memory: 8G
cpu_count: 3
environment_variables: "DEBUG RUSTUP_IO_THREADS"
shell: bash
run: |
sudo pkg install -y -f curl libnghttp2 node22 npm cmake
curl https://sh.rustup.rs -sSf --output rustup.sh
sh rustup.sh -y --profile minimal --default-toolchain stable
source "$HOME/.cargo/env"
echo "~~~~ rustc --version ~~~~"
rustc --version
echo "~~~~ node -v ~~~~"
node -v
pwd
ls -lah
whoami
env
cd napi/${{ inputs.name }}
export COREPACK_INTEGRITY_KEYS=0
sudo corepack enable
pnpm install
pnpm build --target x86_64-unknown-freebsd
rm -rf node_modules
rm -rf target
- name: Upload artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: bindings-freebsd
path: napi/${{ inputs.name }}/*.node
if-no-files-found: error

publish:
name: Publish NAPI
needs:
- build
- build-freebsd
runs-on: ubuntu-latest
permissions:
id-token: write # for `pnpm publish --provenance`
Expand Down
2 changes: 2 additions & 0 deletions napi/minify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@
"aarch64-pc-windows-msvc",
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
"x86_64-unknown-freebsd",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
"armv7-unknown-linux-gnueabihf",
"riscv64gc-unknown-linux-gnu",
"x86_64-apple-darwin",
"aarch64-apple-darwin",
"wasm32-wasip1-threads"
Expand Down
2 changes: 2 additions & 0 deletions napi/parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,11 @@
"aarch64-pc-windows-msvc",
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
"x86_64-unknown-freebsd",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
"armv7-unknown-linux-gnueabihf",
"riscv64gc-unknown-linux-gnu",
"x86_64-apple-darwin",
"aarch64-apple-darwin",
"wasm32-wasip1-threads"
Expand Down
2 changes: 2 additions & 0 deletions napi/transform/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@
"aarch64-pc-windows-msvc",
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
"x86_64-unknown-freebsd",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
"armv7-unknown-linux-gnueabihf",
"riscv64gc-unknown-linux-gnu",
"x86_64-apple-darwin",
"aarch64-apple-darwin",
"wasm32-wasip1-threads"
Expand Down
Loading