Skip to content

feat: optimize async scanning by moving heavy processing to worker thread #169

feat: optimize async scanning by moving heavy processing to worker thread

feat: optimize async scanning by moving heavy processing to worker thread #169

Workflow file for this run

name: CI
env:
DEBUG: napi:*
APP_NAME: yara-x
MACOSX_DEPLOYMENT_TARGET: "10.13"
CARGO_INCREMENTAL: "1"
permissions:
contents: write
id-token: write
"on":
push:
branches:
- main
paths-ignore:
- "**/*.md"
- LICENSE
- "**/*.gitignore"
- .editorconfig
- docs/**
pull_request: null
release:
types: [published]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
settings:
- host: macos-latest
target: x86_64-apple-darwin
build: pnpm build --target x86_64-apple-darwin
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
build: pnpm build --target x86_64-unknown-linux-gnu --use-napi-cross
- host: macos-latest
target: aarch64-apple-darwin
build: pnpm build --target aarch64-apple-darwin
name: stable - ${{ matrix.settings.target }} - node@20
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v4
- name: setup pnpm
uses: pnpm/action-setup@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- 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/
~/.napi-rs
.cargo-cache
target/
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
- name: Build
run: ${{ matrix.settings.build }}
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.settings.target }}
path: "*.node"
if-no-files-found: error
test-bindings:
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
architecture: x64
- host: macos-latest
target: aarch64-apple-darwin
architecture: arm64
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
architecture: x64
node:
- "20"
- "22"
runs-on: ${{ matrix.settings.host }}
steps:
- uses: actions/checkout@v4
- name: setup pnpm
uses: pnpm/action-setup@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: pnpm
architecture: ${{ matrix.settings.architecture }}
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: bindings-${{ matrix.settings.target }}
path: .
- name: List packages
run: ls -R .
shell: bash
- name: Test bindings
run: pnpm test
publish:
name: Publish
runs-on: ubuntu-latest
if: github.event_name == 'release'
needs:
- build
- test-bindings
steps:
- uses: actions/checkout@v4
- name: setup pnpm
uses: pnpm/action-setup@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: create npm dirs
run: pnpm napi create-npm-dirs
- name: Move artifacts
run: pnpm artifacts
- name: List packages
run: ls -R ./npm
shell: bash
- name: Publish
run: |
npm config set provenance true
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then
npm publish --tag next --access public
else
npm publish --access public
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}