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

Bump version, build binary for macos arm64 #727

Merged
merged 6 commits into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
78 changes: 74 additions & 4 deletions .github/workflows/bindings-nodejs-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
run: yarn build

- name: Update Cargo.toml with git
run: sed -i 's#path = "../core"#git = "https://github.com/iotaledger/iota-sdk", rev = "'$GITHUB_SHA'"#g' Cargo.toml
run: sed -i 's#path = "../core"#git = "https://github.com/iotaledger/iota-sdk", rev = "'$GITHUB_SHA'"#g' Cargo.toml

- name: Print Cargo.toml
run: cat Cargo.toml
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
uses: maxim-lobanov/setup-xcode@v1
if: matrix.os == 'macos-13'
with:
xcode-version: '14.3'
xcode-version: "14.3"

# Temporary fix for "ValueError: invalid mode: 'rU' while trying to load binding.gyp"
# This can be removed when "prebuild" updates "node-gyp"
Expand Down Expand Up @@ -115,10 +115,28 @@ jobs:
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV
if: matrix.os == 'windows-2019'

- name: Install gon (macOS)
# https://github.com/mitchellh/gon
run: brew install mitchellh/gon/gon
if: ${{ startsWith(matrix.os, 'macos') }}

- name: Set deployment target (macOS)
run: echo "MACOSX_DEPLOYMENT_TARGET=10.13" >> $GITHUB_ENV
if: matrix.os == 'macos-13'

- name: Add aarch64 target (macOS)
if: ${{ startsWith(matrix.os, 'macos') }}
Thoralf-M marked this conversation as resolved.
Show resolved Hide resolved
run: rustup target add aarch64-apple-darwin

# TODO: enable https://github.com/iotaledger/iota-sdk/issues/97
# - name: Add aarch64 target (linux)
# if: ${{ startsWith(matrix.os, 'ubuntu') }}
# run: rustup target add aarch64-unknown-linux-gnu

# - name: Add aarch64 target (windows)
# if: ${{ startsWith(matrix.os, 'windows') }}
# run: rustup target add aarch64-pc-windows-msvc

- name: Get current date
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
if: matrix.os == 'macos-13' || ${{ startsWith(matrix.os, 'ubuntu') }}
Expand Down Expand Up @@ -172,10 +190,62 @@ jobs:
run: yarn run prebuild-x64
working-directory: bindings/nodejs

- name: Build Node.js prebuild (arm64)
run: yarn run prebuild-arm64
- name: Build Node.js prebuild (macos, arm64)
if: ${{ startsWith(matrix.os, 'macos') }}
run: yarn run prebuild-macos-arm64
working-directory: bindings/nodejs

# TODO: enable https://github.com/iotaledger/iota-sdk/issues/97
# - name: Build Node.js prebuild (ubuntu/linux, arm64)
# if: ${{ startsWith(matrix.os, 'ubuntu') }}
# run: yarn run prebuild-linux-arm64
# working-directory: bindings/nodejs

# - name: Build Node.js prebuild (windows, arm64)
# if: ${{ startsWith(matrix.os, 'windows') }}
# run: yarn run prebuild-windows-arm64
# working-directory: bindings/nodejs

- name: Import code signing assets (macOS)
if: ${{ startsWith(matrix.os, 'macos') }}
env:
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
MAC_CERT_BASE64: ${{ secrets.MAC_CERT_BASE64 }}
MAC_CERT_PASSWORD: ${{ secrets.MAC_CERT_PASSWORD }}
# Based on https://github.com/Apple-Actions/import-codesign-certs/blob/master/src/security.ts
run: |
security create-keychain -p $KEYCHAIN_PASSWORD signing.keychain
security set-keychain-settings -lut 3600 signing.keychain
security unlock-keychain -p $KEYCHAIN_PASSWORD signing.keychain
echo $MAC_CERT_BASE64 | base64 -D -o signing.p12
security import signing.p12 -k signing.keychain -f pkcs12 -T "/usr/bin/codesign" -T "/usr/bin/security" -P $MAC_CERT_PASSWORD
rm signing.p12
security -q set-key-partition-list -S apple-tool:,apple: -k $KEYCHAIN_PASSWORD signing.keychain > /dev/null
security -v list-keychains -s signing.keychain
security find-identity -vp codesigning

- name: Sign and notarize index.node binary (macOS arm64)
if: ${{ startsWith(matrix.os, 'macos') }}
env:
AC_USERNAME: ${{ secrets.ASC_APPLE_ID }}
AC_PASSWORD: ${{ secrets.ASC_PASSWORD }}
working-directory: bindings/nodejs
run: |
TAR_NAME=sdk-v$(npm pkg get version --workspaces=false | tr -d \")-napi-v6-darwin-arm64.tar.gz

# unpack to only get the index.node
tar -xvf prebuilds/@iota/$TAR_NAME

gon gon-config.json

unzip -o binary.zip

mkdir -p build/Release

mv -f index.node build/Release/index.node

tar -czf prebuilds/@iota/$TAR_NAME build/Release/index.node

- name: Upload prebuild to GitHub release
run: npx prebuild --upload-all ${{ secrets.GITHUB_TOKEN }} --tag-prefix iota-sdk-nodejs-v
working-directory: bindings/nodejs
2 changes: 1 addition & 1 deletion bindings/nodejs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Security -->

## 1.0.0-rc.2 - 2023-0x-xx
## 1.0.0-rc.2 - 2023-07-05

### Added

Expand Down
13 changes: 13 additions & 0 deletions bindings/nodejs/gon-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"source": ["./build/Release/index.node"],
"bundle_id": "org.iota.sdk-nodejs",
"apple_id": {
"password": "@env:AC_PASSWORD"
},
"sign": {
"application_identity": "Developer ID Application: IOTA Stiftung (UG77RJKZHH)"
},
"zip": {
"output_path": "./binary.zip"
}
}
9 changes: 7 additions & 2 deletions bindings/nodejs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@iota/sdk",
"version": "1.0.0-rc.1",
"version": "1.0.0-rc.2",
"description": "Node.js binding to the IOTA SDK library",
"main": "out/index.js",
"types": "out/index.d.ts",
Expand All @@ -11,7 +11,12 @@
"build": "node scripts/neon-build && tsc",
"build:neon": "cargo-cp-artifact -ac iota-sdk-nodejs ./index.node -- cargo build --release --message-format=json-render-diagnostics",
"prebuild-x64": "prebuild --runtime napi --target 6 --prepack scripts/neon-build.js --strip --arch x64",
"prebuild-arm64": "prebuild --runtime napi --target 6 --prepack scripts/neon-build.js --strip --arch arm64",
"prebuild-macos-arm64": "prebuild --runtime napi --target 6 --prepack 'yarn run neon-build-macos-arm64' --strip --arch arm64",
"neon-build-macos-arm64": "cargo-cp-artifact -ac iota-sdk-nodejs ./index.node -- cargo build --release --message-format=json-render-diagnostics --target aarch64-apple-darwin && node -e \"require('./scripts/move-artifact.js')()\"",
"prebuild-linux-arm64": "prebuild --runtime napi --target 6 --prepack 'yarn run neon-build-linux-arm64' --strip --arch arm64",
"neon-build-linux-arm64": "cargo-cp-artifact -ac iota-sdk-nodejs ./index.node -- cargo build --release --message-format=json-render-diagnostics --target aarch64-unknown-linux-gnu && node -e \"require('./scripts/move-artifact.js')()\"",
"prebuild-windows-arm64": "prebuild --runtime napi --target 6 --prepack 'yarn run neon-build-linux-arm64' --strip --arch arm64",
thibault-martinez marked this conversation as resolved.
Show resolved Hide resolved
Thoralf-M marked this conversation as resolved.
Show resolved Hide resolved
"neon-build-windows-arm64": "cargo-cp-artifact -ac iota-sdk-nodejs ./index.node -- cargo build --release --message-format=json-render-diagnostics --target aarch64-pc-windows-msvc && node -e \"require('./scripts/move-artifact.js')()\"",
"rebuild": "node scripts/neon-build && tsc && node scripts/strip.js",
"install": "prebuild-install --runtime napi --tag-prefix='iota-sdk-nodejs-v' && tsc || npm run rebuild",
"test": "jest"
Expand Down
1 change: 1 addition & 0 deletions sdk/tests/client/node_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ async fn test_mqtt() {
client.subscriber().disconnect().await.unwrap();
}

#[ignore]
#[tokio::test]
async fn test_call_plugin_route() {
let c = setup_client_with_node_health_ignored().await;
Expand Down