Skip to content

Commit

Permalink
refactor(release): Rename OSX to MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
rholshausen committed Mar 15, 2024
1 parent a6d6819 commit 6406e9a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Expand Up @@ -61,7 +61,7 @@ jobs:
elif [[ "${{ runner.os }}" = "Windows" ]]; then
echo "platform=win" >> "$GITHUB_OUTPUT"
elif [[ "${{ runner.os }}" = "macOS" ]]; then
echo "platform=osx" >> "$GITHUB_OUTPUT"
echo "platform=macos" >> "$GITHUB_OUTPUT"
else
echo "Unknown platform"
exit 1
Expand Down
14 changes: 13 additions & 1 deletion rust/pact_ffi/release-osx.sh → rust/pact_ffi/release-macos.sh
Expand Up @@ -27,6 +27,12 @@ build_x86_64() {
gzip_and_sum \
"$CARGO_TARGET_DIR/x86_64-apple-darwin/release/libpact_ffi.a" \
"$ARTIFACTS_DIR/libpact_ffi-osx-x86_64.a"
gzip_and_sum \
"$CARGO_TARGET_DIR/x86_64-apple-darwin/release/libpact_ffi.dylib" \
"$ARTIFACTS_DIR/libpact_ffi-macos-x86_64.dylib.gz"
gzip_and_sum \
"$CARGO_TARGET_DIR/x86_64-apple-darwin/release/libpact_ffi.a" \
"$ARTIFACTS_DIR/libpact_ffi-macos-x86_64.a"
fi
}

Expand All @@ -41,8 +47,14 @@ build_aarch64() {
gzip_and_sum \
"$CARGO_TARGET_DIR/aarch64-apple-darwin/release/libpact_ffi.a" \
"$ARTIFACTS_DIR/libpact_ffi-osx-aarch64-apple-darwin.a"
gzip_and_sum \
"$CARGO_TARGET_DIR/aarch64-apple-darwin/release/libpact_ffi.dylib" \
"$ARTIFACTS_DIR/libpact_ffi-macos-aarch64-apple-darwin.dylib.gz"
gzip_and_sum \
"$CARGO_TARGET_DIR/aarch64-apple-darwin/release/libpact_ffi.a" \
"$ARTIFACTS_DIR/libpact_ffi-macos-aarch64-apple-darwin.a"
fi
}

build_x86_64
build_aarch64
build_aarch64
35 changes: 6 additions & 29 deletions rust/pact_mock_server_cli/release-linux.sh
Expand Up @@ -13,54 +13,31 @@ export CARGO_TARGET_DIR=${CARO_TARGET_DIR:-"$RUST_DIR/target"}
# All flags passed to this script are passed to cargo.
cargo_flags=( "$@" )

build_x86_64_gnu() {
cargo build --target x86_64-unknown-linux-gnu "${cargo_flags[@]}"

if [[ "${cargo_flags[*]}" =~ "--release" ]]; then
gzip_and_sum \
"$CARGO_TARGET_DIR/x86_64-unknown-linux-gnu/release/pact_mock_server_cli" \
"$ARTIFACTS_DIR/pact_mock_server_cli-linux-x86_64.gz"
fi
}

build_x86_64_musl() {
build_x86_64() {
sudo apt-get install -y musl-tools
cargo build --target=x86_64-unknown-linux-musl "${cargo_flags[@]}"

if [[ "${cargo_flags[*]}" =~ "--release" ]]; then
gzip_and_sum \
"$CARGO_TARGET_DIR/x86_64-unknown-linux-musl/release/pact_mock_server_cli" \
"$ARTIFACTS_DIR/pact_mock_server_cli-linux-x86_64-musl.gz"
"$ARTIFACTS_DIR/pact_mock_server_cli-linux-x86_64.gz"
fi
}

install_cross() {
cargo install cross@0.2.5
}

build_aarch64_gnu() {
install_cross
cross build --target aarch64-unknown-linux-gnu "${cargo_flags[@]}"

if [[ "${cargo_flags[*]}" =~ "--release" ]]; then
gzip_and_sum \
"$CARGO_TARGET_DIR/aarch64-unknown-linux-gnu/release/pact_mock_server_cli" \
"$ARTIFACTS_DIR/pact_mock_server_cli-linux-aarch64.gz"
fi
}

build_aarch64_musl() {
build_aarch64() {
install_cross
cross build --target=aarch64-unknown-linux-musl "${cargo_flags[@]}"

if [[ "${cargo_flags[*]}" =~ "--release" ]]; then
gzip_and_sum \
"$CARGO_TARGET_DIR/aarch64-unknown-linux-musl/release/pact_mock_server_cli" \
"$ARTIFACTS_DIR/pact_mock_server_cli-linux-aarch64-musl.gz"
"$ARTIFACTS_DIR/pact_mock_server_cli-linux-aarch64.gz"
fi
}

build_x86_64_gnu
build_x86_64_musl
build_aarch64_gnu
build_aarch64_musl
build_x86_64
build_aarch64
Expand Up @@ -24,6 +24,9 @@ build_x86_64() {
gzip_and_sum \
"$CARGO_TARGET_DIR/x86_64-apple-darwin/release/pact_mock_server_cli" \
"$ARTIFACTS_DIR/pact_mock_server_cli-osx-x86_64.gz"
gzip_and_sum \
"$CARGO_TARGET_DIR/x86_64-apple-darwin/release/pact_mock_server_cli" \
"$ARTIFACTS_DIR/pact_mock_server_cli-macos-x86_64.gz"
fi
}

Expand All @@ -35,8 +38,11 @@ build_aarch64() {
gzip_and_sum \
"$CARGO_TARGET_DIR/aarch64-apple-darwin/release/pact_mock_server_cli" \
"$ARTIFACTS_DIR/pact_mock_server_cli-osx-aarch64.gz"
gzip_and_sum \
"$CARGO_TARGET_DIR/aarch64-apple-darwin/release/pact_mock_server_cli" \
"$ARTIFACTS_DIR/pact_mock_server_cli-macos-aarch64.gz"
fi
}

build_x86_64
build_aarch64
build_aarch64
Expand Up @@ -39,4 +39,4 @@ build_aarch64() {
}

build_x86_64
build_aarch64
build_aarch64

0 comments on commit 6406e9a

Please sign in to comment.