From 7eb2f5ba43ed46ca9af1af2f18eeb528e21eb37a Mon Sep 17 00:00:00 2001 From: finn Date: Tue, 13 Sep 2022 15:17:26 -0700 Subject: [PATCH] cleanup multi-arch darwin build --- .gitlab-ci.yml | 45 +++++++++++++++------------------------------ 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f3ab076..39852a5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,6 +22,13 @@ variables: rules: - when: on_success +.multitarget-darwin: + parallel: + matrix: + - TARGET: + - x86_64-apple-darwin + - aarch64-apple-darwin + compile: extends: .multitarget image: rust:slim-buster @@ -38,39 +45,18 @@ compile: paths: - libsignal_jni-$TARGET.so -compile x86_64-apple-darwin: +compile darwin: + extends: .multitarget-darwin stage: native library tags: [darwin-builder] script: - git clone https://github.com/signalapp/libsignal-client - cd libsignal-client && git checkout "$libsignal_version" - - RUSTFLAGS='-C link-arg=-s' cargo build -p libsignal-jni --release --verbose - - cp -v target/release/libsignal_jni.dylib ../libsignal_jni-x86_64-apple-darwin.dylib + - RUSTFLAGS='-C link-arg=-s' cargo build -p libsignal-jni --target "${TARGET}" --release --verbose + - cp -v target/${TARGET}/release/libsignal_jni.dylib ../libsignal_jni-${TARGET}.dylib artifacts: paths: - - libsignal_jni-x86_64-apple-darwin.dylib - variables: - TARGET: x86_64-apple-darwin - rules: - - if: '$CI_PROJECT_ROOT_NAMESPACE == "signald"' - when: on_success - - when: manual - allow_failure: true - -compile aarch64-apple-darwin: - stage: native library - tags: [darwin-builder] - script: - - git clone https://github.com/signalapp/libsignal-client - - cd libsignal-client && git checkout "$libsignal_version" - - rustup target add aarch64-apple-darwin - - RUSTFLAGS='-C link-arg=-s' cargo build -p libsignal-jni --target aarch64-apple-darwin --release --verbose - - cp -v target/aarch64-apple-darwin/release/libsignal_jni.dylib ../libsignal_jni-aarch64-apple-darwin.dylib - artifacts: - paths: - - libsignal_jni-aarch64-apple-darwin.dylib - variables: - TARGET: aarch64-apple-darwin + - libsignal_jni-$TARGET.dylib rules: - if: '$CI_PROJECT_ROOT_NAMESPACE == "signald"' when: on_success @@ -92,11 +78,12 @@ jar: - cd java - gradle assemble publish -jar x86_64-apple-darwin: +jar darwin: + extends: .multitarget-darwin image: gradle:7 stage: bindings tags: [darwin-builder] - needs: ["compile x86_64-apple-darwin"] + needs: ["compile darwin"] script: - git clone https://github.com/signalapp/libsignal-client - cd libsignal-client && git checkout "$libsignal_version" @@ -106,8 +93,6 @@ jar x86_64-apple-darwin: - cp "../libsignal_jni-${TARGET}.dylib" java/shared/resources/libsignal_jni.dylib - cd java - gradle assemble publish - variables: - TARGET: x86_64-apple-darwin rules: - if: '$CI_PROJECT_ROOT_NAMESPACE == "signald"' when: on_success