Skip to content

Commit

Permalink
node-plugin: Install uses precompiled binaries hosted on GitHub releases
Browse files Browse the repository at this point in the history
- Restructure crate directories
- Add GitHub Actions workflow for pre-compiling the Node add-on module
on various machines and binaries and pushing to the GitHub releases
page
- Update install process to download precompiled binary,if that fails
fallback to the current behavior and compile directly on user's machine
  • Loading branch information
fordN committed Apr 27, 2022
1 parent 567f028 commit 603c061
Show file tree
Hide file tree
Showing 29 changed files with 778 additions and 8,602 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Creates and publishes assets for a new release.
# To manually trigger this workflow, create a release in the GitHub UI.

name: "Publish binaries"

on:
push:
tags:
- '*'

jobs:
publish-github:
strategy:
# Allowing jobs to fail until 'node-pre-gyp-github' supports failing gracefully if file already exists
# (https://github.com/bchr02/node-pre-gyp-github/issues/42)
fail-fast: false
matrix:
node_version: [12, 14, 16, 17]
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
runs-on: ${{ matrix.system.os }}
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node_version }}
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{ matrix.system.target }}
override: true
- name: Install dependencies
working-directory: ./node-plugin
run: yarn install --ignore-scripts
- 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 }}
working-directory: ./node-plugin
run: yarn build-test-pack-publish
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[workspace]

members = [
"node-plugin/lang",
"lang",
"agora",
"node-plugin/native",
"node-plugin",
]
4 changes: 2 additions & 2 deletions agora/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
cost-model = { path="../node-plugin/lang" }
cost-model = { path= "../lang" }
# num-bigint is behind so we can use num-format
num-bigint = "0.2.6"
fraction = { version="0.6.3", features=["with-bigint"] }
Expand All @@ -21,4 +21,4 @@ structopt = "0.3.14"
num-format = { version = "0.4.0", features = ["with-num-bigint"] }
graphql-parser = "0.3.0"
anyhow = "1.0.33"
libflate = "1.1.0"
libflate = "1.1.0"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions node-plugin/native/Cargo.toml → node-plugin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ name = "cost-model-node-plugin"
version = "0.1.0"
authors = ["Zac Burns <[email protected]>"]
license = "MIT"
build = "build.rs"
build = "src/build.rs"
edition = "2018"
exclude = ["artifacts.json", "index.node"]
exclude = ["/lib"]

[lib]
name = "node_plugin"
Expand Down
Loading

0 comments on commit 603c061

Please sign in to comment.