diff --git a/.github/workflows/ci-build-release-napi.yml b/.github/workflows/ci-build-release-napi.yml index 9d6a2f61..25dc9f92 100644 --- a/.github/workflows/ci-build-release-napi.yml +++ b/.github/workflows/ci-build-release-napi.yml @@ -19,8 +19,8 @@ jobs: fail-fast: false matrix: arch: - - x86_64 -# - arm64 + - x64 + - arm64 nodejs: - 18 steps: @@ -38,16 +38,24 @@ jobs: path: pkg/mac/build key: ${{ runner.os }}-${{ matrix.arch }}-mac-${{ hashFiles('pkg/mac/build-cpp-deps-lib.sh') }} + - name: Add arch env vars + run: | + if [ "${{ matrix.arch }}" = "x64" ]; then + echo "ARCH=x86_64" >> $GITHUB_ENV + else + echo "ARCH=${{ matrix.arch }}" >> $GITHUB_ENV + fi + - name: Build CPP dependencies lib if: steps.cache-dependencies.outputs.cache-hit != 'true' run: | - export ARCH=${{ matrix.arch }} + export ARCH=${{ env.ARCH }} pkg/mac/build-cpp-deps-lib.sh - name: Build CPP lib if: steps.cache-pulsar.outputs.cache-hit != 'true' run: | - export ARCH=${{ matrix.arch }} + export ARCH=${{ env.ARCH }} pkg/mac/build-cpp-lib.sh - name: Build Node binaries lib @@ -57,6 +65,7 @@ jobs: npx node-pre-gyp build --target_arch=${{ matrix.arch }} - name: Test loading Node binaries lib + if: matrix.arch == 'x64' run: | node pkg/load_test.js diff --git a/.github/workflows/ci-pr-validation.yml b/.github/workflows/ci-pr-validation.yml index bd22c205..98e2edaf 100644 --- a/.github/workflows/ci-pr-validation.yml +++ b/.github/workflows/ci-pr-validation.yml @@ -48,7 +48,8 @@ jobs: fail-fast: false matrix: arch: - - x86_64 + - x64 + - arm64 nodejs: - 18 steps: @@ -66,40 +67,40 @@ jobs: path: pkg/mac/build key: ${{ runner.os }}-${{ matrix.arch }}-mac-${{ hashFiles('pkg/mac/build-cpp-deps-lib.sh') }} - - name: Add env vars - shell: bash + - name: Add arch env vars run: | - if [ "${{ matrix.target }}" = "x86_64" ]; then - echo "TARGET=x64" >> $GITHUB_ENV + if [ "${{ matrix.arch }}" = "x64" ]; then + echo "ARCH=x86_64" >> $GITHUB_ENV else - echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV + echo "ARCH=${{ matrix.arch }}" >> $GITHUB_ENV fi - name: Build CPP dependencies lib if: steps.cache-dependencies.outputs.cache-hit != 'true' run: | - export ARCH=${{ matrix.arch }} + export ARCH=${{ env.ARCH }} pkg/mac/build-cpp-deps-lib.sh - name: Build CPP lib if: steps.cache-pulsar.outputs.cache-hit != 'true' run: | - export ARCH=${{ matrix.arch }} + export ARCH=${{ env.ARCH }} pkg/mac/build-cpp-lib.sh - name: Build Node binaries lib run: | npm install --ignore-scripts - npx node-pre-gyp configure --target_arch=${{ env.TARGET }} - npx node-pre-gyp build --target_arch=${{ env.TARGET }} + npx node-pre-gyp configure --target_arch=${{ matrix.arch }} + npx node-pre-gyp build --target_arch=${{ matrix.arch }} - name: Test loading Node binaries lib + if: matrix.arch == 'x64' run: | node pkg/load_test.js - name: Package Node binaries lib run: | - npx node-pre-gyp package --target_arch=${{ env.TARGET }} + npx node-pre-gyp package --target_arch=${{ matrix.arch }} linux-napi: name: Build NAPI ${{matrix.image}} - Node ${{matrix.nodejs}} - ${{matrix.cpu.platform}} diff --git a/pkg/mac/build-cpp-deps-lib.sh b/pkg/mac/build-cpp-deps-lib.sh index 9226bce3..d6092024 100755 --- a/pkg/mac/build-cpp-deps-lib.sh +++ b/pkg/mac/build-cpp-deps-lib.sh @@ -147,8 +147,8 @@ if [ ! -f snappy-${SNAPPY_VERSION}.done ]; then curl -O -L https://github.com/google/snappy/archive/refs/tags/${SNAPPY_VERSION}.tar.gz tar xfz ${SNAPPY_VERSION}.tar.gz pushd snappy-${SNAPPY_VERSION} - CXXFLAGS="-fPIC -O3 -arch ${ARCH} -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}" \ - cmake . -DCMAKE_INSTALL_PREFIX=$PREFIX -DSNAPPY_BUILD_TESTS=OFF -DSNAPPY_BUILD_BENCHMARKS=OFF + CXXFLAGS="-fPIC -O3 -mmacosx-version-min=${MACOSX_DEPLOYMENT_TARGET}" \ + cmake . -DCMAKE_OSX_ARCHITECTURES=${ARCH} -DCMAKE_INSTALL_PREFIX=$PREFIX -DSNAPPY_BUILD_TESTS=OFF -DSNAPPY_BUILD_BENCHMARKS=OFF make -j16 make install touch .done @@ -175,7 +175,8 @@ if [ ! -f curl-${CURL_VERSION}.done ]; then --without-brotli \ --without-secure-transport \ --disable-ipv6 \ - --prefix=$PREFIX + --prefix=$PREFIX \ + --host=$ARCH-apple-darwin make -j16 install popd diff --git a/pkg/mac/build-cpp-lib.sh b/pkg/mac/build-cpp-lib.sh index ab829278..a0f4289e 100755 --- a/pkg/mac/build-cpp-lib.sh +++ b/pkg/mac/build-cpp-lib.sh @@ -29,9 +29,9 @@ cd $PULSAR_DIR curl -O -L "$BASE_URL"/apache-pulsar-client-cpp-${PULSAR_CPP_VERSION}.tar.gz tar xfz apache-pulsar-client-cpp-${PULSAR_CPP_VERSION}.tar.gz pushd apache-pulsar-client-cpp-${PULSAR_CPP_VERSION} - chmod +x ./build-support/merge_archives.sh rm -f CMakeCache.txt cmake . \ + -DCMAKE_OSX_ARCHITECTURES=${ARCH} \ -DCMAKE_OSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} \ -DCMAKE_INSTALL_PREFIX=$PULSAR_PREFIX \ -DCMAKE_BUILD_TYPE=Release \