forked from signalapp/libsignal
-
Notifications
You must be signed in to change notification settings - Fork 1
152 lines (124 loc) · 4.46 KB
/
jni_artifacts.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: Upload Java libraries to Sonatype
run-name: ${{ github.workflow }} (${{ github.ref_name }})
on:
workflow_dispatch:
inputs:
dry_run:
description: "Just build, don't publish"
default: false
required: false
type: boolean
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: Build for local development
runs-on: ${{ matrix.os }}
permissions:
# Needed for ncipollo/release-action.
contents: 'write'
strategy:
matrix:
os: [windows-latest, macos-latest]
include:
- os: windows-latest
library: signal_jni.dll
- os: macos-latest
library: libsignal_jni.dylib
additional-rust-target: aarch64-apple-darwin
# Ubuntu binaries are built using Docker, below
steps:
- uses: actions/checkout@v3
- run: rustup toolchain install $(cat rust-toolchain) --profile minimal
- run: rustup target add ${{ matrix.additional-rust-target }}
if: ${{ matrix.additional-rust-target != '' }}
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
version: '3.x'
repo-token: ${{ secrets.GITHUB_TOKEN }}
# install nasm compiler for boring
- name: Install nasm
if: startsWith(matrix.os, 'windows')
run: choco install nasm
shell: cmd
- name: Build for host (should be x86_64)
run: java/build_jni.sh desktop
shell: bash
- name: Build for alternate target (arm64)
run: java/build_jni.sh desktop
if: matrix.os == 'macos-latest'
env:
CARGO_BUILD_TARGET: ${{ matrix.additional-rust-target }}
- name: Merge library slices (for macOS)
# Using target/release/ for both the input and output wouldn't normally be ideal
# from a build system perspective, but we're going to immediately upload the merged library.
run: lipo -create target/release/${{ matrix.library }} target/${{ matrix.additional-rust-target }}/release/${{ matrix.library }} -output target/release/${{ matrix.library }}
if: matrix.os == 'macos-latest'
- name: Upload library
uses: actions/upload-artifact@v3
with:
name: libsignal_jni (${{matrix.os}})
path: target/release/${{ matrix.library }}
# verify-rust:
# name: Verify JNI bindings
# runs-on: ubuntu-latest
#
# steps:
# - uses: actions/checkout@v3
#
# - run: rustup toolchain install $(cat rust-toolchain) --profile minimal
#
# - name: Verify that the JNI bindings are up to date
# run: rust/bridge/jni/bin/gen_java_decl.py --verify
publish:
name: Build for production and publish
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- name: Download built libraries
id: download
uses: actions/download-artifact@v3
with:
path: artifacts
- name: Copy libraries
run: mv ${{ steps.download.outputs.download-path }}/*/* java/shared/resources && find java/shared/resources
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
version: '3.x'
repo-token: ${{ secrets.GITHUB_TOKEN }}
- run: make
if: ${{ inputs.dry_run }}
working-directory: java
- name: Upload libsignal-android
if: ${{ inputs.dry_run }}
uses: actions/upload-artifact@v3
with:
name: libsignal-android
path: java/android/build/outputs/aar/libsignal-android-release.aar
- name: Upload libsignal-client
if: ${{ inputs.dry_run }}
uses: actions/upload-artifact@v3
with:
name: libsignal-client
path: java/client/build/libs/libsignal-client-*.jar
- name: Upload libsignal-server
if: ${{ inputs.dry_run }}
uses: actions/upload-artifact@v3
with:
name: libsignal-server
path: java/server/build/libs/libsignal-server-*.jar
- run: make publish_java
if: ${{ !inputs.dry_run }}
working-directory: java
env:
ORG_GRADLE_PROJECT_sonatypeRepo: ${{ secrets.SONATYPE_REPO }}
ORG_GRADLE_PROJECT_sonatypeSnapshotRepo: ${{ secrets.SONATYPE_SNAPSHOT_REPO }}
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USER }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.SIGNING_KEYID }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
# ASCII-armored PGP secret key
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}