-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from YOU54F/feat/musl
feat: build for musl
- Loading branch information
Showing
4 changed files
with
41 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ build | |
target | ||
pacts | ||
*.out | ||
release_artifacts | ||
|
||
# Misc | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,37 +9,51 @@ fi | |
echo Building Release for "$1" | ||
|
||
cargo clean | ||
mkdir -p target/artifacts/ | ||
mkdir -p release_artifacts | ||
|
||
case "$1" in | ||
Linux) echo "Building for Linux" | ||
docker run --rm --user "$(id -u)":"$(id -g)" -v "$(pwd):/workspace" -w /workspace -t pactfoundation/rust-musl-build -c 'cargo build --release' | ||
gzip -c target/release/pact-plugin-cli > target/artifacts/pact-plugin-cli-linux-x86_64.gz | ||
openssl dgst -sha256 -r target/artifacts/pact-plugin-cli-linux-x86_64.gz > target/artifacts/pact-plugin-cli-linux-x86_64.gz.sha256 | ||
gzip -c target/release/pact-plugin-cli > release_artifacts/pact-plugin-cli-linux-x86_64.gz | ||
openssl dgst -sha256 -r release_artifacts/pact-plugin-cli-linux-x86_64.gz > release_artifacts/pact-plugin-cli-linux-x86_64.gz.sha256 | ||
|
||
# Build aarch64 | ||
cargo install cross | ||
cargo install [email protected] | ||
cargo clean | ||
cross build --target aarch64-unknown-linux-gnu --release | ||
gzip -c target/aarch64-unknown-linux-gnu/release/pact-plugin-cli > target/artifacts/pact-plugin-cli-linux-aarch64.gz | ||
openssl dgst -sha256 -r target/artifacts/pact-plugin-cli-linux-aarch64.gz > target/artifacts/pact-plugin-cli-linux-aarch64.gz.sha256 | ||
gzip -c target/aarch64-unknown-linux-gnu/release/pact-plugin-cli > release_artifacts/pact-plugin-cli-linux-aarch64.gz | ||
openssl dgst -sha256 -r release_artifacts/pact-plugin-cli-linux-aarch64.gz > release_artifacts/pact-plugin-cli-linux-aarch64.gz.sha256 | ||
|
||
cargo clean | ||
cross build --release --target=x86_64-unknown-linux-musl | ||
gzip -c target/x86_64-unknown-linux-musl/release/pact-plugin-cli > release_artifacts/pact-plugin-cli-linux-musl-x86_64.gz | ||
openssl dgst -sha256 -r release_artifacts/pact-plugin-cli-linux-musl-x86_64.gz > release_artifacts/pact-plugin-cli-linux-musl-x86_64.gz.sha256 | ||
|
||
echo -- Build the musl aarch64 release artifacts -- | ||
cargo clean | ||
cross build --release --target=aarch64-unknown-linux-musl | ||
gzip -c target/aarch64-unknown-linux-musl/release/pact-plugin-cli > release_artifacts/pact-plugin-cli-linux-aarch64-musl.gz | ||
openssl dgst -sha256 -r release_artifacts/pact-plugin-cli-linux-musl-aarch64.gz > release_artifacts/pact-plugin-cli-linux-musl-aarch64.gz.sha256 | ||
|
||
|
||
;; | ||
Windows) echo "Building for Windows" | ||
cargo build --release | ||
gzip -c target/release/pact-plugin-cli.exe > target/artifacts/pact-plugin-cli-windows-x86_64.exe.gz | ||
openssl dgst -sha256 -r target/artifacts/pact-plugin-cli-windows-x86_64.exe.gz > target/artifacts/pact-plugin-cli-windows-x86_64.exe.gz.sha256 | ||
gzip -c target/release/pact-plugin-cli.exe > release_artifacts/pact-plugin-cli-windows-x86_64.exe.gz | ||
openssl dgst -sha256 -r release_artifacts/pact-plugin-cli-windows-x86_64.exe.gz > release_artifacts/pact-plugin-cli-windows-x86_64.exe.gz.sha256 | ||
;; | ||
macOS) echo "Building for OSX" | ||
cargo build --release | ||
gzip -c target/release/pact-plugin-cli > target/artifacts/pact-plugin-cli-osx-x86_64.gz | ||
openssl dgst -sha256 -r target/artifacts/pact-plugin-cli-osx-x86_64.gz > target/artifacts/pact-plugin-cli-osx-x86_64.gz.sha256 | ||
gzip -c target/release/pact-plugin-cli > release_artifacts/pact-plugin-cli-osx-x86_64.gz | ||
openssl dgst -sha256 -r release_artifacts/pact-plugin-cli-osx-x86_64.gz > release_artifacts/pact-plugin-cli-osx-x86_64.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/pact-plugin-cli > target/artifacts/pact-plugin-cli-osx-aarch64.gz | ||
openssl dgst -sha256 -r target/artifacts/pact-plugin-cli-osx-aarch64.gz > target/artifacts/pact-plugin-cli-osx-aarch64.gz.sha256 | ||
gzip -c target/aarch64-apple-darwin/release/pact-plugin-cli > release_artifacts/pact-plugin-cli-osx-aarch64.gz | ||
openssl dgst -sha256 -r release_artifacts/pact-plugin-cli-osx-aarch64.gz > release_artifacts/pact-plugin-cli-osx-aarch64.gz.sha256 | ||
;; | ||
*) echo "$1 is not a recognised OS" | ||
exit 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters