diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 565b8fddc..e72fa78d2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -168,12 +168,12 @@ jobs: linker_package: cc: "" architecture: x64 - # - os: macos-latest - # platform: darwin - # target: aarch64-apple-darwin - # linker_package: - # cc: "" - # architecture: arm64 + - os: macos-latest + platform: darwin + target: aarch64-apple-darwin + linker_package: + cc: "" + architecture: arm64 steps: - name: Configure git to use LF (Windows) @@ -199,7 +199,9 @@ jobs: uses: actions/setup-node@v2 with: node-version: '14' - architecture: ${{ matrix.architecture }} + # Host nodejs arch does not matter in our usecase for compiling cross-platform npm packages, + # if enabled, this will fail after installing an arm64 nodejs runtime for an x86_64 arch macos system + # architecture: ${{ matrix.architecture }} cache: npm cache-dependency-path: node-bindings/package-lock.json @@ -226,6 +228,13 @@ jobs: # if: ${{ matrix.platform }}-${{ matrix.architecture }} == 'linux-arm64' || ${{ matrix.platform }}-${{ matrix.architecture }} == 'linux-armv7' || ${{ matrix.platform }}-${{ matrix.architecture }} == 'linux-musl-x64' # run: sudo apt-get update && sudo apt-get install -y ${{ matrix.linker_package }} + # Set environment variables required from cross compiling from macos-x86_64 to macos-arm64 + - name: Configure macos-arm64 cross compile config + if: matrix.target == 'aarch64-apple-darwin' + run: | + echo "SDKROOT=$(xcrun -sdk macosx --show-sdk-path)" >> $GITHUB_ENV + echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version)" >> $GITHUB_ENV + - name: Build - Cargo run: cargo build --release --features=telemetry --locked --target ${{ matrix.target }} # To be uncommented later when adding new distros @@ -324,6 +333,8 @@ jobs: path: stacks-devnet-js-${{ matrix.platform }}-${{ matrix.architecture }}.tar.gz - name: Unit Tests - Cargo + # can't easily run mac-arm64 tests in GH without native runners for that arch + if: matrix.target != 'aarch64-apple-darwin' run: cargo test --release --locked --target ${{ matrix.target }} # - name: Unit Tests - Node @@ -331,7 +342,8 @@ jobs: # run: npm run spec - name: Functional Tests (Not Windows) - if: matrix.os != 'windows-latest' + # can't easily run mac-arm64 tests in GH without native runners for that arch + if: matrix.os != 'windows-latest' && matrix.target != 'aarch64-apple-darwin' run: | for testdir in $(ls examples); do ./target/${{ matrix.target }}/release/clarinet test --manifest-path examples/${testdir}/Clarinet.toml diff --git a/node-bindings/package.json b/node-bindings/package.json index 5c85f89bb..ce96e1573 100644 --- a/node-bindings/package.json +++ b/node-bindings/package.json @@ -16,6 +16,7 @@ "build-linux-x64": "npm run build-release -- --target x86_64-unknown-linux-gnu", "build-windows-x64": "npm run build-release -- --target x86_64-pc-windows-msvc", "build-darwin-x64": "npm run build-release -- --target x86_64-apple-darwin", + "build-darwin-arm64": "npm run build-release -- --target aarch64-apple-darwin", "install": "node-pre-gyp install --fallback-to-build=false || npm run build-release", "lint": "eslint .", "package": "node-pre-gyp package",