libsignal-client/.gitlab-ci.yml
2023-06-13 14:44:14 +00:00

119 lines
3.3 KiB
YAML

stages:
- native library
- bindings
variables:
libsignal_version: "v0.26.0"
GRADLE_OPTS: -Dorg.gradle.daemon=false
CARGO_TERM_COLOR: always
.multitarget:
parallel:
matrix:
- TARGET:
- aarch64-unknown-linux-gnu
- x86_64-unknown-linux-gnu
- arm-unknown-linux-gnueabi
- arm-unknown-linux-gnueabihf
- armv7-unknown-linux-gnueabihf
rules:
- when: on_success
.multitarget-failing:
parallel:
matrix:
- TARGET:
- aarch64-unknown-linux-musl
- arm-unknown-linux-musleabihf
- armv7-unknown-linux-musleabihf
- x86_64-unknown-linux-musl
rules:
- when: on_success
allow_failure: true
.multitarget-darwin:
parallel:
matrix:
- TARGET:
- x86_64-apple-darwin
- aarch64-apple-darwin
compile:
extends: .multitarget
image: rust:slim-bullseye
stage: native library
before_script:
- ./prepare-env.sh
script:
- git clone https://github.com/signalapp/libsignal-client
- cd libsignal-client && git checkout "$libsignal_version"
- rustup set profile minimal
- rustup toolchain install nightly
- rustup target add "${TARGET}"
- if [[ -d ../target ]]; then mv ../target target; fi
- . ../rustflags.sh
- cargo build -p libsignal-jni --target "${TARGET}" --release --verbose
- cp -v target/${TARGET}/release/libsignal_jni.so ../libsignal_jni-${TARGET}.so
- cp -r target/ ../target
cache:
paths:
- target/
key: rust-target-$TARGET
artifacts:
paths:
- libsignal_jni-$TARGET.so
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"
- rustup target add "${TARGET}"
- 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-$TARGET.dylib
rules:
- if: '$CI_PROJECT_ROOT_NAMESPACE == "signald"'
when: on_success
- when: manual
allow_failure: true
jar:
extends: .multitarget
image: gradle:7
stage: bindings
needs: ["compile"]
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
- mkdir -p java/shared/resources
- cp "../libsignal_jni-${TARGET}.so" java/shared/resources/libsignal_jni.so
- cd java
- gradle assemble publish
jar darwin:
extends: .multitarget-darwin
image: gradle:7
stage: bindings
tags: [darwin-builder]
needs: ["compile darwin"]
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
- mkdir -p java/shared/resources
- cp "../libsignal_jni-${TARGET}.dylib" java/shared/resources/libsignal_jni.dylib
- cd java
- gradle assemble publish
rules:
- if: '$CI_PROJECT_ROOT_NAMESPACE == "signald"'
when: on_success
- when: manual
allow_failure: true