libsignal-client/.gitlab-ci.yml
2022-12-19 19:30:51 -08:00

117 lines
3.3 KiB
YAML

stages:
- native library
- bindings
variables:
libsignal_version: "v0.21.1"
GRADLE_OPTS: -Dorg.gradle.daemon=false
.multitarget:
parallel:
matrix:
- TARGET:
- aarch64-unknown-linux-gnu
# - aarch64-unknown-linux-musl
- arm-unknown-linux-gnueabi
- arm-unknown-linux-gnueabihf
# - arm-unknown-linux-musleabihf
- armv7-unknown-linux-gnueabihf
# - armv7-unknown-linux-musleabihf
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
rules:
- when: on_success
.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 target add "${TARGET}"
- RUSTFLAGS="$(../rustflags.sh)" cargo build -p libsignal-jni --target "${TARGET}" --release --verbose
- cp -v target/${TARGET}/release/libsignal_jni.so ../libsignal_jni-${TARGET}.so
variables:
CC: clang-13
CXX: clang++-13
CPP: clang-cpp-13
AR: llvm-ar-13
STRIP: llvm-strip-13
RANLIB: llvm-ranlib-13
AS: llvm-as-13
OBJDUMP: llvm-objdump-13
OBJCOPY: llvm-objcopy-13
READELF: llvm-readelf-13
NM: llvm-nm-13
CC_LD: lld-13
CXX_LD: lld-13
LD: lld-13
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