Skip to content

chore: update index.js autogenerated napi file #21

chore: update index.js autogenerated napi file

chore: update index.js autogenerated napi file #21

Workflow file for this run

name: CI
on:
push:
branches: [develop]
pull_request:
branches: [develop]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
env:
RUST_BACKTRACE: 1
NODE_VERSION: "24"
# Disable husky git hooks in CI — CI runs its own checks
# https://typicode.github.io/husky/how-to.html#ci-server-and-docker
HUSKY: 0
jobs:
check:
name: Check
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- run: cargo fmt --all --check
- run: cargo clippy --workspace --all-targets --locked -- -D warnings
- run: cargo doc --workspace --no-deps --locked
env:
RUSTDOCFLAGS: -D warnings
build-napi:
name: Build NAPI (${{ matrix.settings.target }})
strategy:
fail-fast: false
matrix:
settings:
- target: aarch64-apple-darwin
os: macos-latest
artifact: apvm-napi.darwin-arm64.node
- target: x86_64-apple-darwin
os: macos-latest
artifact: apvm-napi.darwin-x64.node
- target: x86_64-unknown-linux-gnu
os: ubuntu-22.04
artifact: apvm-napi.linux-x64-gnu.node
# Vendor OpenSSL to produce a self-contained binary with no runtime libssl dependency.
# https://docs.rs/openssl/latest/openssl/#vendored
features: vendored-openssl
- target: aarch64-unknown-linux-gnu
os: ubuntu-22.04
artifact: apvm-napi.linux-arm64-gnu.node
# Vendor OpenSSL from source for cross-compilation (no system libssl-dev:arm64)
# and to produce a self-contained binary with no runtime libssl dependency.
# https://docs.rs/openssl/latest/openssl/#vendored
features: vendored-openssl
- target: x86_64-pc-windows-msvc
os: windows-latest
artifact: apvm-napi.win32-x64-msvc.node
runs-on: ${{ matrix.settings.os }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.settings.target }}
- name: Install cross-compilation tools (Linux ARM64)
if: matrix.settings.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- run: npm install
- name: Build NAPI
run: >
npx napi build --release --platform
--manifest-path crates/napi/Cargo.toml --output-dir .
--target ${{ matrix.settings.target }}
${{ matrix.settings.features && format('--features {0}', matrix.settings.features) || '' }}
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
AR_aarch64_unknown_linux_gnu: aarch64-linux-gnu-ar
- name: Upload .node artifact
uses: actions/upload-artifact@v7
with:
name: napi-${{ matrix.settings.target }}
path: ${{ matrix.settings.artifact }}
if-no-files-found: error
- name: Upload JS bindings
if: matrix.settings.target == 'x86_64-unknown-linux-gnu'
uses: actions/upload-artifact@v7
with:
name: napi-bindings
path: |
index.js
index.d.ts
if-no-files-found: error
test:
name: Test (${{ matrix.settings.name }})
needs: build-napi
strategy:
fail-fast: false
matrix:
settings:
- name: Linux x64
os: ubuntu-22.04
napi-artifact: napi-x86_64-unknown-linux-gnu
- name: macOS ARM64
os: macos-latest
napi-artifact: napi-aarch64-apple-darwin
- name: Windows x64
os: windows-latest
napi-artifact: napi-x86_64-pc-windows-msvc
runs-on: ${{ matrix.settings.os }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: ${{ env.NODE_VERSION }}
- uses: dtolnay/rust-toolchain@stable
# PHP + Composer (required by wp-rocket and backwpup build steps).
# Use shivammathur/setup-php to get a consistent PHP version on all runners.
# ubuntu-22.04 ships PHP 8.1 (EOL, known allocator bugs causing SIGABRT),
# so we install PHP 8.4 (latest stable with active support) everywhere.
# https://github.com/shivammathur/setup-php
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
# fileinfo: required by league/flysystem (transitive dep of wp-rocket via coenjacobs/mozart).
# Bundled by default on Linux/macOS but must be explicitly enabled on Windows.
extensions: fileinfo
tools: composer
coverage: none
env:
fail-fast: true
# Debug: print PHP and Composer info for troubleshooting
- name: PHP & Composer diagnostics
run: |
php -v
php -m
composer --version
composer diagnose || true
- name: Install gulp
run: npm install --global gulp-cli
# Rust tests
- name: Rust tests
run: cargo test --workspace
# Node tests
- name: Download NAPI binary
uses: actions/download-artifact@v8
with:
name: ${{ matrix.settings.napi-artifact }}
- run: npm install
- name: Node tests
run: npm test
env:
# Prevent PHP memory limit issues during Composer autoload generation.
# wp-rocket has 95+ deps; the default 128MB can be insufficient.
# https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors
COMPOSER_MEMORY_LIMIT: "-1"
commit-artifacts:
name: Commit Artifacts
if: github.event_name == 'push' && github.ref == 'refs/heads/develop'
needs: [build-napi, test]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v6
- name: Download all NAPI artifacts
uses: actions/download-artifact@v8
with:
pattern: napi-*
merge-multiple: true
- name: Commit and push artifacts
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add *.node index.js index.d.ts
git diff --staged --quiet && exit 0
git commit -m "chore: update NAPI binaries"
git pull --rebase
git push
# ── CI gate ──────────────────────────────────────────────────────────────
# Single required check for branch protection. With matrix strategies, job
# names are dynamic (e.g. "Build NAPI (x86_64-unknown-linux-gnu)"). This
# job provides one stable name — "CI" — to configure as a required status
# check, so matrix changes never break branch protection rules.
ci:
name: CI
if: always()
needs: [check, build-napi, test, commit-artifacts]
runs-on: ubuntu-22.04
timeout-minutes: 5
steps:
- name: Check results
if: >-
needs.check.result != 'success' ||
needs.build-napi.result != 'success' ||
needs.test.result != 'success' ||
(needs.commit-artifacts.result != 'success' &&
needs.commit-artifacts.result != 'skipped')
run: exit 1