From 7bc0cf526e720a0baf3126376162a58046990a53 Mon Sep 17 00:00:00 2001 From: Ronald Holshausen Date: Fri, 20 Dec 2024 10:03:56 +1100 Subject: [PATCH] chore(release): Rename MacOS artifacts correctly --- .github/workflows/release.yml | 2 +- rust/pact_ffi/release-macos.sh | 88 ++++++++-------------------------- rust/pact_ffi/release-osx.sh | 19 -------- 3 files changed, 20 insertions(+), 89 deletions(-) delete mode 100755 rust/pact_ffi/release-osx.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 72f665852..f9f815254 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -80,7 +80,7 @@ jobs: shell: bash working-directory: rust/pact_ffi - if: startsWith(github.ref, 'refs/tags/libpact_ffi') && runner.os == 'macOS' - run: ./release-osx.sh + run: ./release-macos.sh shell: bash working-directory: rust/pact_ffi - name: Upload Release Assets diff --git a/rust/pact_ffi/release-macos.sh b/rust/pact_ffi/release-macos.sh index f4edfcada..5ce83ef76 100755 --- a/rust/pact_ffi/release-macos.sh +++ b/rust/pact_ffi/release-macos.sh @@ -1,69 +1,19 @@ -#!/bin/bash - -set -e -set -x - -RUST_DIR="$(cd -- "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" -APP_NAME=libpact_ffi - -source "$RUST_DIR/scripts/gzip-and-sum.sh" -ARTIFACTS_DIR=${ARTIFACTS_DIR:-"$RUST_DIR/release_artifacts"} -mkdir -p "$ARTIFACTS_DIR" -export CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-"$RUST_DIR/target"} - -# We target the oldest supported version of macOS. -export MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET:-12} - -# All flags passed to this script are passed to cargo. -case $1 in -x86_64-apple-darwin) - TARGET=$1 - shift - ;; -aarch64-apple-darwin) - TARGET=$1 - shift - ;; -*) ;; -esac -cargo_flags=("$@") - -build_target() { - TARGET=$1 - - case $TARGET in - x86_64-apple-darwin) - ARCH_SUFFIX=x86_64 - ;; - aarch64-apple-darwin) - ARCH_SUFFIX=aarch64 - ;; - *) - echo unknown target $TARGET - exit 1 - ;; - esac - cargo build --target $TARGET "${cargo_flags[@]}" - - if [[ "${cargo_flags[*]}" =~ "--release" ]]; then - file "$CARGO_TARGET_DIR/$TARGET/release/$APP_NAME.a" - file "$CARGO_TARGET_DIR/$TARGET/release/$APP_NAME.dylib" - du -sh "$CARGO_TARGET_DIR/$TARGET/release/$APP_NAME.a" - du -sh "$CARGO_TARGET_DIR/$TARGET/release/$APP_NAME.dylib" - gzip_and_sum \ - "$CARGO_TARGET_DIR/$TARGET/release/$APP_NAME.a" \ - "$ARTIFACTS_DIR/$APP_NAME-macos-$ARCH_SUFFIX.a.gz" - gzip_and_sum \ - "$CARGO_TARGET_DIR/$TARGET/release/$APP_NAME.dylib" \ - "$ARTIFACTS_DIR/$APP_NAME-macos-$ARCH_SUFFIX.dylib.gz" - fi -} - -if [ ! -z "$TARGET" ]; then - echo building for target $TARGET - build_target $TARGET -else - echo building for all targets - build_target x86_64-apple-darwin - build_target aarch64-apple-darwin -fi +#!/bin/bash -e + +cargo clean +cargo build --release +mkdir -p ../release_artifacts +gzip -c ../target/release/libpact_ffi.dylib > ../release_artifacts/libpact_ffi-osx-x86_64.dylib.gz +openssl dgst -sha256 -r ../release_artifacts/libpact_ffi-osx-x86_64.dylib.gz > ../release_artifacts/libpact_ffi-osx-x86_64.dylib.gz.sha256 +gzip -c ../target/release/libpact_ffi.a > ../release_artifacts/libpact_ffi-osx-x86_64.a.gz +openssl dgst -sha256 -r ../release_artifacts/libpact_ffi-osx-x86_64.a.gz > ../release_artifacts/libpact_ffi-osx-x86_64.a.gz.sha256 + +# M1 +export SDKROOT=$(xcrun -sdk macosx11.1 --show-sdk-path) +export MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx11.1 --show-sdk-platform-version) +cargo build --target aarch64-apple-darwin --release + +gzip -c ../target/aarch64-apple-darwin/release/libpact_ffi.dylib > ../release_artifacts/libpact_ffi-osx-aarch64-apple-darwin.dylib.gz +openssl dgst -sha256 -r ../release_artifacts/libpact_ffi-osx-aarch64-apple-darwin.dylib.gz > ../release_artifacts/libpact_ffi-osx-aarch64-apple-darwin.dylib.gz.sha256 +gzip -c ../target/aarch64-apple-darwin/release/libpact_ffi.a > ../release_artifacts/libpact_ffi-osx-aarch64-apple-darwin.a.gz +openssl dgst -sha256 -r ../release_artifacts/libpact_ffi-osx-aarch64-apple-darwin.a.gz > ../release_artifacts/libpact_ffi-osx-aarch64-apple-darwin.a.gz.sha256 diff --git a/rust/pact_ffi/release-osx.sh b/rust/pact_ffi/release-osx.sh deleted file mode 100755 index 5ce83ef76..000000000 --- a/rust/pact_ffi/release-osx.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -e - -cargo clean -cargo build --release -mkdir -p ../release_artifacts -gzip -c ../target/release/libpact_ffi.dylib > ../release_artifacts/libpact_ffi-osx-x86_64.dylib.gz -openssl dgst -sha256 -r ../release_artifacts/libpact_ffi-osx-x86_64.dylib.gz > ../release_artifacts/libpact_ffi-osx-x86_64.dylib.gz.sha256 -gzip -c ../target/release/libpact_ffi.a > ../release_artifacts/libpact_ffi-osx-x86_64.a.gz -openssl dgst -sha256 -r ../release_artifacts/libpact_ffi-osx-x86_64.a.gz > ../release_artifacts/libpact_ffi-osx-x86_64.a.gz.sha256 - -# M1 -export SDKROOT=$(xcrun -sdk macosx11.1 --show-sdk-path) -export MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx11.1 --show-sdk-platform-version) -cargo build --target aarch64-apple-darwin --release - -gzip -c ../target/aarch64-apple-darwin/release/libpact_ffi.dylib > ../release_artifacts/libpact_ffi-osx-aarch64-apple-darwin.dylib.gz -openssl dgst -sha256 -r ../release_artifacts/libpact_ffi-osx-aarch64-apple-darwin.dylib.gz > ../release_artifacts/libpact_ffi-osx-aarch64-apple-darwin.dylib.gz.sha256 -gzip -c ../target/aarch64-apple-darwin/release/libpact_ffi.a > ../release_artifacts/libpact_ffi-osx-aarch64-apple-darwin.a.gz -openssl dgst -sha256 -r ../release_artifacts/libpact_ffi-osx-aarch64-apple-darwin.a.gz > ../release_artifacts/libpact_ffi-osx-aarch64-apple-darwin.a.gz.sha256