Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update build: Better support for fallback to local compile, upgrade node version support #52

Merged
merged 3 commits into from
Dec 6, 2023
Merged
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
20 changes: 11 additions & 9 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@ jobs:
# (https://github.com/bchr02/node-pre-gyp-github/issues/42)
fail-fast: false
matrix:
node_version: [14, 16, 17]
node_version: [18, 19, 20]
system:
- os: macos-latest
- os: macos-12
target: x86_64-apple-darwin
- os: ubuntu-18.04
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
include:
## ARM64 builds are not working. No ARM64 GitHub Action runners available out of box. Need to nail down cross compile
# - node_version: 16
# system:
# os: macos-latest
# target: aarch64-apple-darwin
- node_version: 18
- node_version: 17
system:
os: ubuntu-22.04
os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
- node_version: 18
- node_version: 17
system:
os: macos-latest
os: macos-11
target: x86_64-apple-darwin
runs-on: ${{ matrix.system.os }}
steps:
Expand All @@ -50,12 +50,14 @@ jobs:
toolchain: stable
target: ${{ matrix.system.target }}
override: true
- name: Setup python
run: python3 -m pip install setuptools
- name: Install dependencies
working-directory: ./node-plugin
working-directory: ./
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
working-directory: ./
run: yarn build-test-pack-publish
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
node-plugin/native/target
node-plugin/native/index.node
node-plugin/native/artifacts.json
**/node_modules
/target
**/.DS_Store
.idea
Cargo.lock
6 changes: 0 additions & 6 deletions node-plugin/.gitignore

This file was deleted.

23 changes: 12 additions & 11 deletions node-plugin/package.json → package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "@graphprotocol/cost-model",
"version": "0.1.16",
"version": "0.1.17",
"description": "Cost model",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"main": "node-plugin/lib/index.js",
"types": "/node-plugin/lib/index.d.ts",
"files": [
"/lib",
"/src",
"Cargo.toml"
"/node-plugin/lib",
"/node-plugin/src",
"/node-plugin/Cargo.toml",
"/lang/"
],
"repository": {
"type": "git",
Expand All @@ -25,7 +26,7 @@
"arm64"
],
"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 ./node-plugin/native/index.node -- cargo build --message-format=json-render-diagnostics",
"build-debug": "yarn build --",
"build-release": "yarn build --release",
"package": "node-pre-gyp package",
Expand All @@ -34,19 +35,19 @@
"build-test-pack-publish": "yarn build-release && yarn test && yarn package && yarn publish-github",
"install": "node-pre-gyp install --fallback-to-build=false --update-binary || yarn build-release",
"test": "jest",
"clean": "cargo clean && rm -rf ./native ./build ./node_modules"
"clean": "cargo clean && rm -rf ./node-plugin/native ./build ./node_modules ./target"
},
"dependencies": {
"@mapbox/node-pre-gyp": "1.0.9",
"cargo-cp-artifact": "0.1.6"
"@mapbox/node-pre-gyp": "1.0.11",
"cargo-cp-artifact": "0.1.8"
},
"devDependencies": {
"jest": "27.5.1",
"node-pre-gyp-github": "1.4.4"
},
"binary": {
"module_name": "index",
"module_path": "./native",
"module_path": "./node-plugin/native",
"host": "https://github.com/graphprotocol/agora/releases/download/",
"remote_path": "v{version}",
"package_name": "graphprotocol-agora-plugin-v{version}-{node_abi}-{platform}-{arch}.tar.gz"
Expand Down
Loading
Loading