Skip to content
This repository was archived by the owner on Jun 2, 2025. It is now read-only.
Closed
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
2 changes: 2 additions & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
82 changes: 68 additions & 14 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ name: "Publish binaries"

on:
push:
tags:
- '*'
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
publish-github:
Expand All @@ -15,38 +16,91 @@ jobs:
# (https://github.com/bchr02/node-pre-gyp-github/issues/42)
fail-fast: false
matrix:
node_version: [12, 14, 16, 17]
node_version: [16]
system:
- os: macos-latest
target: x86_64-apple-darwin
rust: stable
target: aarch64-apple-darwin
linker: aarch64-darwin-gcc
cross: false
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
include:
- node_version: 16
system:
os: macos-latest
target: aarch64-apple-darwin
rust: stable
target: aarch64-unknown-linux-gnu
linker: gcc-aarch64-linux-gnu
cross: true
# system:
# - os: macos-latest
# target: x86_64-apple-darwin
# - os: ubuntu-latest
# target: x86_64-unknown-linux-gnu
# include:
# - node_version: 16
# system:
# os: macos-latest
# target: aarch64-apple-darwin
# - node_version: 16
# system:
# os: ubuntu-latest
# target: aarch64-unknown-linux-gnu
runs-on: ${{ matrix.system.os }}
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2.1.5

- name: Rust cache
uses: actions/cache@v2
with:
node-version: ${{ matrix.node_version }}
path: |
~/.cargo/registry
~/.cargo/git
~/.rustup
target
key: ${{ runner.os }}

- name: Install Linker
if: matrix.system.cross
run: |
sudo apt update
sudo apt install build-essential
sudo apt install libudev-dev
sudo apt install ${{ matrix.system.linker }}

- name: Install Rust
run: |
rustup install ${{ matrix.system.rust }}
rustup target add ${{ matrix.system.target }}
rustup show

- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{ matrix.system.target }}
override: true

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2.1.5
with:
node-version: ${{ matrix.node_version }}

- name: Install dependencies
env:
NPM_CONFIG_FOREGROUND_SCRIPTS: true npm ci
working-directory: ./node-plugin
run: yarn install --ignore-scripts
run: |
yarn autoclean --init
rm -rf node_modules && yarn install --frozen-lockfile --ignore-scripts

# - name: Cross compile rust code
# run: |
# cargo install cargo-flash

- name: Compile binary, test, package, and publish to Github release page
env:
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_BUILD_TARGET: ${{ matrix.system.target }}
GCC_aarch64-unknown-linux-gnu: aarch64-linux-gnu-gcc
GCC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
working-directory: ./node-plugin
run: yarn build-test-pack-publish
8 changes: 6 additions & 2 deletions node-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@
],
"cpu": [
"x64",
"arm"
"arm",
"arm64"
],
"engines": {
"node": ">=12.22.0"
},
"scripts": {
"build": "cargo-cp-artifact -a cdylib node_plugin ./native/index.node -- cargo build --message-format=json-render-diagnostics",
"build": "cargo-cp-artifact -a cdylib node_plugin ./native/index.node -- cargo build --target aarch64-unknown-linux-gnu -flto /home/runner/work/agora/agora/target/aarch64-unknown-linux-gnu/release/deps/libneon_sys-dd4bb8d7de746e37.rlib",
"build-debug": "yarn build --",
"build-release": "yarn build --release",
"package": "node-pre-gyp package",
Expand Down