2021-10-15 07:26:35 +00:00
|
|
|
stages:
|
2021-10-24 19:47:40 +00:00
|
|
|
- native library
|
2021-10-15 07:26:35 +00:00
|
|
|
- bindings
|
|
|
|
|
|
|
|
variables:
|
2023-06-13 14:44:14 +00:00
|
|
|
libsignal_version: "v0.26.0"
|
2021-10-15 07:26:35 +00:00
|
|
|
GRADLE_OPTS: -Dorg.gradle.daemon=false
|
2022-12-20 07:28:43 +00:00
|
|
|
CARGO_TERM_COLOR: always
|
2021-10-15 07:26:35 +00:00
|
|
|
|
|
|
|
.multitarget:
|
|
|
|
parallel:
|
|
|
|
matrix:
|
|
|
|
- TARGET:
|
|
|
|
- aarch64-unknown-linux-gnu
|
2022-12-20 10:40:34 +00:00
|
|
|
- x86_64-unknown-linux-gnu
|
2023-06-13 14:33:54 +00:00
|
|
|
- arm-unknown-linux-gnueabi
|
|
|
|
- arm-unknown-linux-gnueabihf
|
|
|
|
- armv7-unknown-linux-gnueabihf
|
2022-12-20 10:40:34 +00:00
|
|
|
rules:
|
|
|
|
- when: on_success
|
|
|
|
|
|
|
|
.multitarget-failing:
|
|
|
|
parallel:
|
|
|
|
matrix:
|
|
|
|
- TARGET:
|
|
|
|
- aarch64-unknown-linux-musl
|
|
|
|
- arm-unknown-linux-musleabihf
|
|
|
|
- armv7-unknown-linux-musleabihf
|
2022-03-28 02:52:14 +00:00
|
|
|
- x86_64-unknown-linux-musl
|
2021-11-16 18:24:58 +00:00
|
|
|
rules:
|
|
|
|
- when: on_success
|
2022-12-20 10:40:34 +00:00
|
|
|
allow_failure: true
|
2021-10-15 07:26:35 +00:00
|
|
|
|
2022-09-13 22:17:26 +00:00
|
|
|
.multitarget-darwin:
|
|
|
|
parallel:
|
|
|
|
matrix:
|
|
|
|
- TARGET:
|
|
|
|
- x86_64-apple-darwin
|
|
|
|
- aarch64-apple-darwin
|
|
|
|
|
2021-10-15 07:26:35 +00:00
|
|
|
compile:
|
|
|
|
extends: .multitarget
|
2022-10-27 08:34:10 +00:00
|
|
|
image: rust:slim-bullseye
|
2021-10-24 19:47:40 +00:00
|
|
|
stage: native library
|
2021-10-15 07:26:35 +00:00
|
|
|
before_script:
|
|
|
|
- ./prepare-env.sh
|
|
|
|
script:
|
|
|
|
- git clone https://github.com/signalapp/libsignal-client
|
|
|
|
- cd libsignal-client && git checkout "$libsignal_version"
|
2022-12-20 08:32:45 +00:00
|
|
|
- rustup set profile minimal
|
2022-12-20 09:44:56 +00:00
|
|
|
- rustup toolchain install nightly
|
2022-12-20 08:25:15 +00:00
|
|
|
- rustup target add "${TARGET}"
|
2022-12-20 05:50:37 +00:00
|
|
|
- if [[ -d ../target ]]; then mv ../target target; fi
|
2022-12-20 10:20:10 +00:00
|
|
|
- . ../rustflags.sh
|
|
|
|
- cargo build -p libsignal-jni --target "${TARGET}" --release --verbose
|
2021-10-15 07:26:35 +00:00
|
|
|
- cp -v target/${TARGET}/release/libsignal_jni.so ../libsignal_jni-${TARGET}.so
|
2022-12-20 10:03:03 +00:00
|
|
|
- cp -r target/ ../target
|
2022-12-20 05:50:37 +00:00
|
|
|
cache:
|
|
|
|
paths:
|
|
|
|
- target/
|
2022-12-20 10:30:48 +00:00
|
|
|
key: rust-target-$TARGET
|
2021-10-15 07:26:35 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- libsignal_jni-$TARGET.so
|
|
|
|
|
2022-09-13 22:17:26 +00:00
|
|
|
compile darwin:
|
|
|
|
extends: .multitarget-darwin
|
2022-09-13 20:30:52 +00:00
|
|
|
stage: native library
|
|
|
|
tags: [darwin-builder]
|
|
|
|
script:
|
|
|
|
- git clone https://github.com/signalapp/libsignal-client
|
|
|
|
- cd libsignal-client && git checkout "$libsignal_version"
|
2022-10-27 03:36:11 +00:00
|
|
|
- rustup target add "${TARGET}"
|
2022-09-13 22:17:26 +00:00
|
|
|
- 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
|
2022-09-13 20:30:52 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
2022-09-13 22:17:26 +00:00
|
|
|
- libsignal_jni-$TARGET.dylib
|
2022-09-13 20:30:52 +00:00
|
|
|
rules:
|
|
|
|
- if: '$CI_PROJECT_ROOT_NAMESPACE == "signald"'
|
|
|
|
when: on_success
|
|
|
|
- when: manual
|
|
|
|
allow_failure: true
|
|
|
|
|
2021-10-15 07:26:35 +00:00
|
|
|
jar:
|
|
|
|
extends: .multitarget
|
2021-10-24 20:02:35 +00:00
|
|
|
image: gradle:7
|
2021-10-15 07:26:35 +00:00
|
|
|
stage: bindings
|
2021-10-15 07:28:01 +00:00
|
|
|
needs: ["compile"]
|
2021-10-15 07:26:35 +00:00
|
|
|
script:
|
|
|
|
- git clone https://github.com/signalapp/libsignal-client
|
|
|
|
- cd libsignal-client && git checkout "$libsignal_version"
|
|
|
|
- git config user.email nobody@signald.org && git config user.name signald
|
|
|
|
- git am ../libsignal.patch
|
2022-03-22 03:14:15 +00:00
|
|
|
- mkdir -p java/shared/resources
|
|
|
|
- cp "../libsignal_jni-${TARGET}.so" java/shared/resources/libsignal_jni.so
|
2021-10-15 07:26:35 +00:00
|
|
|
- cd java
|
|
|
|
- gradle assemble publish
|
|
|
|
|
2022-09-13 22:17:26 +00:00
|
|
|
jar darwin:
|
|
|
|
extends: .multitarget-darwin
|
2021-10-24 20:02:35 +00:00
|
|
|
image: gradle:7
|
2021-10-15 07:26:35 +00:00
|
|
|
stage: bindings
|
|
|
|
tags: [darwin-builder]
|
2022-09-13 22:17:26 +00:00
|
|
|
needs: ["compile darwin"]
|
2021-10-15 07:26:35 +00:00
|
|
|
script:
|
|
|
|
- git clone https://github.com/signalapp/libsignal-client
|
|
|
|
- cd libsignal-client && git checkout "$libsignal_version"
|
|
|
|
- git config user.email nobody@signald.org && git config user.name signald
|
|
|
|
- git am ../libsignal.patch
|
2022-03-22 03:14:15 +00:00
|
|
|
- mkdir -p java/shared/resources
|
|
|
|
- cp "../libsignal_jni-${TARGET}.dylib" java/shared/resources/libsignal_jni.dylib
|
2021-10-15 07:26:35 +00:00
|
|
|
- cd java
|
|
|
|
- gradle assemble publish
|
2021-11-15 18:24:13 +00:00
|
|
|
rules:
|
|
|
|
- if: '$CI_PROJECT_ROOT_NAMESPACE == "signald"'
|
|
|
|
when: on_success
|
|
|
|
- when: manual
|
|
|
|
allow_failure: true
|