mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
6f22859717
## Summary - update `oxc-project/setup-node` from v1.4.0 to v1.4.1 across all workflows - pick up `pnpm/action-setup` v6.0.10, whose newer bootstrap fixes broken `@pnpm/exe` shims during package-manager self-updates The setup action fix was released after oxc-project/setup-node#34.
247 lines
8.6 KiB
YAML
247 lines
8.6 KiB
YAML
name: Release NAPI
|
|
|
|
permissions: {}
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
name:
|
|
required: true
|
|
type: string
|
|
description: "The component name"
|
|
|
|
jobs:
|
|
check:
|
|
name: Check version
|
|
runs-on: ubuntu-slim
|
|
outputs:
|
|
version_changed: ${{ steps.check.outputs.version_changed }}
|
|
env:
|
|
name: ${{ inputs.name }}
|
|
steps:
|
|
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
|
|
- uses: ./.github/actions/check-version
|
|
id: check
|
|
with:
|
|
file-name: napi/${{ inputs.name }}/package.json
|
|
file-url: https://unpkg.com/oxc-${{ inputs.name }}@latest/package.json
|
|
|
|
build:
|
|
needs: check
|
|
if: needs.check.outputs.version_changed == 'true'
|
|
name: Build ${{ matrix.target }}
|
|
runs-on: ${{ matrix.os }}
|
|
env:
|
|
name: ${{ inputs.name }}
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
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-wasm
|
|
|
|
- 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: aarch64-linux-android
|
|
build: pnpm build --target aarch64-linux-android
|
|
|
|
- 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 TARGET_CC=riscv64-linux-gnu-gcc
|
|
export CXX=riscv64-linux-gnu-g++
|
|
pnpm build --target riscv64gc-unknown-linux-gnu
|
|
|
|
- os: ubuntu-latest
|
|
target: aarch64-unknown-linux-ohos
|
|
build: pnpm build --target aarch64-unknown-linux-ohos
|
|
|
|
- os: ubuntu-latest
|
|
target: armv7-linux-androideabi
|
|
build: pnpm build --target armv7-linux-androideabi
|
|
|
|
- os: ubuntu-latest
|
|
target: armv7-unknown-linux-musleabihf
|
|
build: pnpm build --target armv7-unknown-linux-musleabihf -x
|
|
|
|
- os: windows-latest
|
|
target: i686-pc-windows-msvc
|
|
build: pnpm build --target i686-pc-windows-msvc
|
|
|
|
- os: ubuntu-latest
|
|
target: powerpc64le-unknown-linux-gnu
|
|
build: pnpm build --target powerpc64le-unknown-linux-gnu --use-napi-cross
|
|
|
|
- os: ubuntu-latest
|
|
target: riscv64gc-unknown-linux-musl
|
|
build: |
|
|
sudo apt-get update
|
|
sudo apt-get install gcc-riscv64-linux-gnu g++-riscv64-linux-gnu -y
|
|
export TARGET_CC=riscv64-linux-gnu-gcc
|
|
export CXX=riscv64-linux-gnu-g++
|
|
pnpm build --target riscv64gc-unknown-linux-musl -x
|
|
|
|
steps:
|
|
- if: ${{ contains(matrix.os, 'windows') }}
|
|
run: git config --system core.longpaths true
|
|
|
|
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
|
|
|
|
- uses: oxc-project/setup-node@f46a72f95efdc55273fcd042d61c84e723b2892c # v1.4.1
|
|
|
|
- run: rustup target add ${{ matrix.target }}
|
|
|
|
- name: Setup OpenHarmony SDK
|
|
if: ${{ contains(matrix.target, 'ohos') }}
|
|
uses: Boshen/setup-ohos-sdk@edb865a89a712f1f15dbad932dfa9cfce849d95c # v1.0.0
|
|
|
|
- uses: goto-bus-stop/setup-zig@abea47f85e598557f500fa1fd2ab7464fcb39406 # v2.2.1
|
|
if: ${{ contains(matrix.target, 'musl') }}
|
|
with:
|
|
version: 0.13.0
|
|
|
|
- name: Build
|
|
working-directory: napi/${{ inputs.name }}
|
|
run: ${{ matrix.build }}
|
|
shell: bash
|
|
env:
|
|
# `clang` lacks the `__ldar64`/`__stlr64` MSVC intrinsics that mimalloc's
|
|
# atomic.h uses on the ARM64 MSVC C path, so leave TARGET_CC unset on
|
|
# `*-pc-windows-msvc` targets and let cc-rs pick `cl.exe`.
|
|
TARGET_CC: ${{ !contains(matrix.target, 'pc-windows-msvc') && 'clang' || '' }} # for mimalloc
|
|
|
|
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
if-no-files-found: error
|
|
name: bindings-${{ matrix.target }}
|
|
# `**/*.node` because in `napi/parser`, binaries are in `src-js` subdirectory
|
|
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@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
|
|
|
|
- uses: oxc-project/setup-node@f46a72f95efdc55273fcd042d61c84e723b2892c # v1.4.1
|
|
|
|
- run: rustup target add x86_64-unknown-freebsd
|
|
|
|
- name: Install Zig
|
|
uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2
|
|
with:
|
|
version: "0.15.2"
|
|
|
|
- name: Install cargo-zigbuild
|
|
uses: jaxxstorm/action-install-gh-release@25e24d2d23ae098373794ef1d6faecb48ee52da8 # v3.0.0
|
|
with:
|
|
repo: rust-cross/cargo-zigbuild
|
|
|
|
- name: Build
|
|
working-directory: napi/${{ inputs.name }}
|
|
run: pnpm build --target x86_64-unknown-freebsd -x
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
if-no-files-found: error
|
|
name: bindings-freebsd
|
|
# `**/*.node` because in `napi/parser`, binary is in `src-js` subdirectory
|
|
path: napi/${{ inputs.name }}/**/*.node
|
|
|
|
publish:
|
|
name: Publish NAPI
|
|
needs:
|
|
- build
|
|
- build-freebsd
|
|
runs-on: ubuntu-slim
|
|
permissions:
|
|
id-token: write # for `pnpm publish --provenance`
|
|
env:
|
|
name: ${{ inputs.name }}
|
|
package_path: napi/${{ inputs.name }}
|
|
npm_dir: release-dir
|
|
PUBLISH_FLAGS: "--provenance --access public --no-git-checks"
|
|
steps:
|
|
- uses: taiki-e/checkout-action@7d1e50e93dc4fb3bba58f85018fadf77898aee8b # v1.4.2
|
|
|
|
- uses: oxc-project/setup-node@f46a72f95efdc55273fcd042d61c84e723b2892c # v1.4.1
|
|
|
|
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
with:
|
|
path: artifacts
|
|
|
|
- run: mkdir -p ${npm_dir}
|
|
|
|
- run: pnpm napi create-npm-dirs --package-json-path ${package_path}/package.json --npm-dir ${npm_dir}
|
|
|
|
- run: pnpm napi artifacts --package-json-path ${package_path}/package.json --build-output-dir ${package_path}/src-js --npm-dir ${npm_dir}
|
|
if: ${{ inputs.name == 'parser' }}
|
|
|
|
- run: pnpm napi artifacts --package-json-path ${package_path}/package.json --build-output-dir ${package_path} --npm-dir ${npm_dir}
|
|
if: ${{ inputs.name != 'parser' }}
|
|
|
|
- run: pnpm -C ${package_path} build-browser-bundle --npmDir ../../${npm_dir}
|
|
if: ${{ inputs.name == 'parser' }}
|
|
|
|
- name: Check Publish
|
|
run: node .github/scripts/check-npm-packages.js "${npm_dir}/*" "${package_path}"
|
|
|
|
- name: Trusted Publish
|
|
run: |
|
|
# Trusted publishing is configured, publish token is not required.
|
|
# Publish sub-packages and adds `optionalDependencies` to `package_path`.
|
|
pnpm napi pre-publish --no-gh-release -t npm --package-json-path ${package_path}/package.json --npm-dir ${npm_dir}
|
|
bash .github/scripts/publish-if-needed.sh ${package_path} ${PUBLISH_FLAGS}
|