forked from signalapp/libsignal
-
Notifications
You must be signed in to change notification settings - Fork 1
200 lines (160 loc) · 6.09 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
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 }}
strategy:
matrix:
os: [windows-latest, macos-latest]
include:
- os: windows-latest
- os: macos-latest
additional-rust-target: x86_64-apple-darwin
# Ubuntu binaries are built using Docker, below
timeout-minutes: 45
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive
- name: Checking run eligibility
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const dryRun = ${{ inputs.dry_run }};
const refType = '${{ github.ref_type }}';
const refName = '${{ github.ref_name }}';
console.log(dryRun
? `Running in 'dry run' mode on '${refName}' ${refType}`
: `Running on '${refName}' ${refType}`);
if (refType !== 'tag' && !dryRun) {
core.setFailed("the action should either be launched on a tag or with a 'dry run' switch");
}
- 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:
repo-token: ${{ secrets.GITHUB_TOKEN }}
# install nasm compiler for boring
- name: Install nasm
if: startsWith(matrix.os, 'windows')
run: choco install nasm
shell: cmd
- run: choco install protoc
if: matrix.os == 'windows-latest'
- run: brew install protobuf
if: matrix.os == 'macos-latest'
- name: Build client for host
run: java/build_jni.sh desktop
shell: bash
- name: Build server for host
run: java/build_jni.sh server
shell: bash
- name: Build client for alternate target
run: java/build_jni.sh desktop
if: matrix.os == 'macos-latest'
env:
CARGO_BUILD_TARGET: ${{ matrix.additional-rust-target }}
- name: Build server for alternate target
run: java/build_jni.sh server
if: matrix.os == 'macos-latest'
env:
CARGO_BUILD_TARGET: ${{ matrix.additional-rust-target }}
- name: Upload client libraries
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: libsignal-client libraries (${{matrix.os}})
path: |
java/client/src/main/resources/*.dll
java/client/src/main/resources/*.dylib
- name: Upload server libraries
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: libsignal-server libraries (${{matrix.os}})
path: |
java/server/src/main/resources/*.dll
java/server/src/main/resources/*.dylib
# verify-rust:
# name: Verify JNI bindings
# runs-on: ubuntu-latest
# timeout-minutes: 45
# steps:
# - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
# with:
# submodules: recursive
# - run: rustup toolchain install $(cat rust-toolchain) --profile minimal
# - run: sudo apt-get update && sudo apt-get install protobuf-compiler
# - run: cargo +stable install cbindgen
# - 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-20.04
needs: build
timeout-minutes: 45
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
submodules: recursive
- name: Download built client libraries
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
with:
path: java/client/src/main/resources
pattern: libsignal-client*
merge-multiple: true
- name: Download built server libraries
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
with:
path: java/server/src/main/resources
pattern: libsignal-server*
merge-multiple: true
- 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@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
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@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: libsignal-client
path: java/client/build/libs/libsignal-client-*.jar
- name: Upload libsignal-server
if: ${{ inputs.dry_run }}
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
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 }}