-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
30 additions
and
16 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
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,41 +11,54 @@ set -e | |
echo Building Release for "$1" - "$2" | ||
|
||
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-protobuf-plugin > target/artifacts/pact-protobuf-plugin-linux-x86_64.gz | ||
openssl dgst -sha256 -r target/artifacts/pact-protobuf-plugin-linux-x86_64.gz > target/artifacts/pact-protobuf-plugin-linux-x86_64.gz.sha256 | ||
cp pact-plugin.json target/artifacts | ||
gzip -c target/release/pact-protobuf-plugin > release_artifacts/pact-protobuf-plugin-linux-x86_64.gz | ||
openssl dgst -sha256 -r release_artifacts/pact-protobuf-plugin-linux-x86_64.gz > release_artifacts/pact-protobuf-plugin-linux-x86_64.gz.sha256 | ||
cp pact-plugin.json release_artifacts | ||
NEXT=$(echo "$2" | cut -d\- -f2) | ||
sed -e 's/VERSION=\"0.1.5\"/VERSION=\"'${NEXT}'\"/' scripts/install-plugin.sh > target/artifacts/install-plugin.sh | ||
openssl dgst -sha256 -r target/artifacts/install-plugin.sh > target/artifacts/install-plugin.sh.sha256 | ||
sed -e 's/VERSION=\"0.1.5\"/VERSION=\"'${NEXT}'\"/' scripts/install-plugin.sh > release_artifacts/install-plugin.sh | ||
openssl dgst -sha256 -r release_artifacts/install-plugin.sh > release_artifacts/install-plugin.sh.sha256 | ||
|
||
# Build aarch64 | ||
cargo install cross --git https://github.com/cross-rs/cross | ||
cargo install [email protected] | ||
cargo clean | ||
cross build --target aarch64-unknown-linux-gnu --release | ||
gzip -c target/aarch64-unknown-linux-gnu/release/pact-protobuf-plugin > target/artifacts/pact-protobuf-plugin-linux-aarch64.gz | ||
openssl dgst -sha256 -r target/artifacts/pact-protobuf-plugin-linux-aarch64.gz > target/artifacts/pact-protobuf-plugin-linux-aarch64.gz.sha256 | ||
gzip -c target/aarch64-unknown-linux-gnu/release/pact-protobuf-plugin > release_artifacts/pact-protobuf-plugin-linux-aarch64.gz | ||
openssl dgst -sha256 -r release_artifacts/pact-protobuf-plugin-linux-aarch64.gz > release_artifacts/pact-protobuf-plugin-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-protobuf-plugin > release_artifacts/pact-protobuf-plugin-linux-x86_64-musl.gz | ||
openssl dgst -sha256 -r release_artifacts/pact-protobuf-plugin-linux-x86_64-musl.gz > release_artifacts/pact-protobuf-plugin-linux-x86_64-musl.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-protobuf-plugin > release_artifacts/pact-protobuf-plugin-linux-aarch64-musl.gz | ||
openssl dgst -sha256 -r release_artifacts/pact-protobuf-plugin-linux-aarch64-musl.gz > release_artifacts/pact-protobuf-plugin-linux-aarch64-musl.gz.sha256 | ||
|
||
;; | ||
Windows) echo "Building for Windows" | ||
cargo build --release | ||
gzip -c target/release/pact-protobuf-plugin.exe > target/artifacts/pact-protobuf-plugin-windows-x86_64.exe.gz | ||
openssl dgst -sha256 -r target/artifacts/pact-protobuf-plugin-windows-x86_64.exe.gz > target/artifacts/pact-protobuf-plugin-windows-x86_64.exe.gz.sha256 | ||
gzip -c target/release/pact-protobuf-plugin.exe > release_artifacts/pact-protobuf-plugin-windows-x86_64.exe.gz | ||
openssl dgst -sha256 -r release_artifacts/pact-protobuf-plugin-windows-x86_64.exe.gz > release_artifacts/pact-protobuf-plugin-windows-x86_64.exe.gz.sha256 | ||
;; | ||
macOS) echo "Building for OSX" | ||
cargo build --release | ||
gzip -c target/release/pact-protobuf-plugin > target/artifacts/pact-protobuf-plugin-osx-x86_64.gz | ||
openssl dgst -sha256 -r target/artifacts/pact-protobuf-plugin-osx-x86_64.gz > target/artifacts/pact-protobuf-plugin-osx-x86_64.gz.sha256 | ||
gzip -c target/release/pact-protobuf-plugin > release_artifacts/pact-protobuf-plugin-osx-x86_64.gz | ||
openssl dgst -sha256 -r release_artifacts/pact-protobuf-plugin-osx-x86_64.gz > release_artifacts/pact-protobuf-plugin-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-protobuf-plugin > target/artifacts/pact-protobuf-plugin-osx-aarch64.gz | ||
openssl dgst -sha256 -r target/artifacts/pact-protobuf-plugin-osx-aarch64.gz > target/artifacts/pact-protobuf-plugin-osx-aarch64.gz.sha256 | ||
gzip -c target/aarch64-apple-darwin/release/pact-protobuf-plugin > release_artifacts/pact-protobuf-plugin-osx-aarch64.gz | ||
openssl dgst -sha256 -r release_artifacts/pact-protobuf-plugin-osx-aarch64.gz > release_artifacts/pact-protobuf-plugin-osx-aarch64.gz.sha256 | ||
;; | ||
*) echo "$1 is not a recognised OS" | ||
exit 1 | ||
|