Skip to content

Commit

Permalink
Bump version, build binary for macos arm64 (#727)
Browse files Browse the repository at this point in the history
* Bump version, build binary for macos arm64

* Format, set release date

* Update bundle_id

* Add #[ignore]

* Update bindings/nodejs/package.json

* Align if run order
  • Loading branch information
Thoralf-M authored Jul 5, 2023
1 parent 76782e3 commit 708853a
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 10 deletions.
84 changes: 77 additions & 7 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 @@ -112,16 +112,34 @@ jobs:
directory: ${{ runner.temp }}/llvm

- name: Set LIBCLANG_PATH (Windows)
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV
if: matrix.os == 'windows-2019'
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> $env:GITHUB_ENV

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

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

- name: Add aarch64 target (macOS)
if: ${{ startsWith(matrix.os, 'macos') }}
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') }}
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV

- name: Get current date
if: matrix.os == 'windows-2019'
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-windows-arm64' --strip --arch arm64",
"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

0 comments on commit 708853a

Please sign in to comment.