-
Notifications
You must be signed in to change notification settings - Fork 278
374 lines (320 loc) · 12.3 KB
/
ci.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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
name: Continuous integration
on:
push:
pull_request:
schedule:
# Run every day at midnight UTC
- cron: '0 0 * * *'
jobs:
boringssl_clone:
# This step ensures that all builders have the same version of BoringSSL
runs-on: ubuntu-latest
steps:
- name: Clone BoringSSL repo
run: |
git clone --depth 1 --filter=blob:none --no-checkout https://github.com/google/boringssl.git "${{ runner.temp }}/boringssl"
echo Using BoringSSL commit: $(cd "${{ runner.temp }}/boringssl"; git rev-parse HEAD)
- name: Archive BoringSSL source
uses: actions/upload-artifact@v4
with:
name: boringssl-source
path: ${{ runner.temp }}/boringssl
retention-days: 1
include-hidden-files: true
if-no-files-found: error
build:
needs: boringssl_clone
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
include:
- platform: ubuntu-latest
tools_url: https://dl.google.com/android/repository/commandlinetools-linux-9477386_latest.zip
- platform: macos-latest
tools_url: https://dl.google.com/android/repository/commandlinetools-mac-9477386_latest.zip
- platform: windows-latest
tools_url: https://dl.google.com/android/repository/commandlinetools-win-9477386_latest.zip
runs-on: ${{ matrix.platform }}
steps:
- name: Set up JDK 11 for toolchains
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11
- name: Set runner-specific environment variables
shell: bash
run: |
echo "ANDROID_HOME=${{ runner.temp }}/android-sdk" >> $GITHUB_ENV
echo "ANDROID_SDK_ROOT=${{ runner.temp }}/android-sdk" >> $GITHUB_ENV
echo "BORINGSSL_HOME=${{ runner.temp }}/boringssl" >> $GITHUB_ENV
echo "SDKMANAGER=${{ runner.temp }}/android-sdk/cmdline-tools/bin/sdkmanager" >> $GITHUB_ENV
echo "M2_REPO=${{ runner.temp }}/m2" >> $GITHUB_ENV
- uses: actions/checkout@v4
- name: Setup Linux environment
if: runner.os == 'Linux'
run: |
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
sudo dpkg --add-architecture i386
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get -qq update
sudo apt-get -qq install -y --no-install-recommends \
gcc-multilib \
g++-multilib \
ninja-build \
openjdk-11-jre-headless
- name: Setup macOS environment
if: runner.os == 'macOS'
run: |
brew update || echo update failed
brew install ninja || echo update failed
- name: Setup Windows environment
if: runner.os == 'Windows'
run: |
choco install nasm -y
choco install ninja -y
- name: Fetch BoringSSL source
uses: actions/download-artifact@v4
with:
name: boringssl-source
path: ${{ runner.temp }}/boringssl
- name: Checkout BoringSSL master branch
shell: bash
run: |
cd "$BORINGSSL_HOME"
git checkout --progress --force -B master
- name: Build BoringSSL x86 and ARM MacOS
if: runner.os == 'macOS'
env:
# For compatibility, but 10.15 target requires 16-byte stack alignment.
MACOSX_DEPLOYMENT_TARGET: 10.13
run: |
mkdir -p "$BORINGSSL_HOME/build.x86"
pushd "$BORINGSSL_HOME/build.x86"
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=x86_64 -GNinja ..
ninja
popd
mkdir -p "$BORINGSSL_HOME/build.arm"
pushd "$BORINGSSL_HOME/build.arm"
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=arm64 -GNinja ..
ninja
popd
- name: Build BoringSSL 64-bit Linux
if: runner.os == 'Linux'
run: |
mkdir -p "$BORINGSSL_HOME/build64"
pushd "$BORINGSSL_HOME/build64"
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE -DCMAKE_BUILD_TYPE=Release -GNinja ..
ninja
popd
- name: Set up MSVC paths on Windows
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Build BoringSSL 64-bit Windows
if: runner.os == 'Windows'
run: |
cd $Env:BORINGSSL_HOME
mkdir build64
pushd build64
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE -DCMAKE_BUILD_TYPE=Release -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -GNinja ..
ninja
popd
- name: Setup Android environment
shell: bash
if: runner.os == 'Linux'
run: |
cd "${{ runner.temp }}"
curl -L "${{ matrix.tools_url }}" -o android-tools.zip
mkdir -p "$ANDROID_HOME"
unzip -q android-tools.zip -d "$ANDROID_HOME"
yes | "$SDKMANAGER" --sdk_root="$ANDROID_HOME" --licenses || true
"$SDKMANAGER" --sdk_root="$ANDROID_HOME" tools
"$SDKMANAGER" --sdk_root="$ANDROID_HOME" platform-tools
"$SDKMANAGER" --sdk_root="$ANDROID_HOME" 'build-tools;30.0.3'
"$SDKMANAGER" --sdk_root="$ANDROID_HOME" 'platforms;android-26'
"$SDKMANAGER" --sdk_root="$ANDROID_HOME" 'extras;android;m2repository'
"$SDKMANAGER" --sdk_root="$ANDROID_HOME" 'ndk;25.2.9519653'
"$SDKMANAGER" --sdk_root="$ANDROID_HOME" 'cmake;3.22.1'
- name: Build with Gradle
shell: bash
run: ./gradlew assemble -PcheckErrorQueue
- name: Test with Gradle
shell: bash
timeout-minutes: 15
run: ./gradlew check -PcheckErrorQueue
- name: Publish to local Maven repo
shell: bash
run: ./gradlew publishToMavenLocal -Dmaven.repo.local="$M2_REPO"
- name: Upload Maven respository
uses: actions/upload-artifact@v4
with:
name: m2repo-${{ runner.os }}
path: ${{ runner.temp }}/m2
- name: Build test JAR with dependencies
if: runner.os == 'Linux'
shell: bash
run: ./gradlew :conscrypt-openjdk:testJar -PcheckErrorQueue
- name: Upload test JAR with dependencies
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: testjar
path: openjdk/build/libs/conscrypt-openjdk-*-tests.jar
if-no-files-found: error
uberjar:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Linux environment
run: |
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
sudo dpkg --add-architecture i386
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get -qq update
sudo apt-get -qq install -y --no-install-recommends \
gcc-multilib \
g++-multilib \
ninja-build \
openjdk-11-jre-headless
- name: Set runner-specific environment variables
shell: bash
run: |
echo "M2_REPO=${{ runner.temp }}/m2" >> $GITHUB_ENV
echo "BORINGSSL_HOME=${{ runner.temp }}/boringssl" >> $GITHUB_ENV
- name: Fetch BoringSSL source
uses: actions/download-artifact@v4
with:
name: boringssl-source
path: ${{ runner.temp }}/boringssl
- name: Checkout BoringSSL master branch
shell: bash
run: |
cd "$BORINGSSL_HOME"
git checkout --progress --force -B master
- name: Build BoringSSL 64-bit Linux
run: |
mkdir -p "$BORINGSSL_HOME/build64"
pushd "$BORINGSSL_HOME/build64"
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE -DCMAKE_BUILD_TYPE=Release -GNinja ..
ninja
popd
# TODO(prb) remove build dependency above and go back to this.
# - name: Make fake BoringSSL directories
# shell: bash
# run: |
# # TODO: remove this when the check is only performed when building.
# # BoringSSL is not needed during the UberJAR build, but the
# # assertion to check happens regardless of whether the project
# # needs it.
# mkdir -p "${{ runner.temp }}/boringssl/build64"
# mkdir -p "${{ runner.temp }}/boringssl/include"
- name: Download Maven repository for Linux
uses: actions/download-artifact@v4
with:
name: m2repo-Linux
path: ${{ runner.temp }}/m2
- name: Download Maven repository for MacOS
uses: actions/download-artifact@v4
with:
name: m2repo-macOS
path: ${{ runner.temp }}/m2
- name: Download Maven repository for Windows
uses: actions/download-artifact@v4
with:
name: m2repo-Windows
path: ${{ runner.temp }}/m2
- name: Build UberJAR with Gradle
shell: bash
run: |
./gradlew :conscrypt-openjdk-uber:build -Dorg.conscrypt.openjdk.buildUberJar=true -Dmaven.repo.local="$M2_REPO"
- name: Publish UberJAR to Maven Local
shell: bash
run: |
./gradlew :conscrypt-openjdk-uber:publishToMavenLocal -Dorg.conscrypt.openjdk.buildUberJar=true -Dmaven.repo.local="$M2_REPO"
- name: Upload Maven respository
uses: actions/upload-artifact@v4
with:
name: m2repo-uber
path: ${{ runner.temp }}/m2
openjdk-test:
needs: uberjar
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-13, macos-latest, windows-latest]
java: [8, 11, 17, 21]
dist: ['temurin', 'zulu']
include:
- platform: ubuntu-latest
separator: ':'
- platform: macos-latest
separator: ':'
- platform: macos-13
separator: ':'
- platform: windows-latest
separator: ';'
exclude: # Not available on Github runners
- platform: macos-latest
java: 8
dist: 'temurin'
runs-on: ${{ matrix.platform }}
steps:
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: ${{ matrix.dist }}
java-version: ${{ matrix.java }}
- name: Download UberJAR
uses: actions/download-artifact@v4
with:
name: m2repo-uber
path: m2
- name: Download Test JAR with Dependencies
uses: actions/download-artifact@v4
with:
name: testjar
path: testjar
- name: Download JUnit runner
shell: bash
run: mvn org.apache.maven.plugins:maven-dependency-plugin:3.8.0:copy -Dartifact=org.junit.platform:junit-platform-console-standalone:1.11.2 -DoutputDirectory=. -Dmdep.stripVersion=true
- name: Run JUnit tests
timeout-minutes: 15
shell: bash
run: |
DIR="$(find m2/org/conscrypt/conscrypt-openjdk-uber -maxdepth 1 -mindepth 1 -type d -print)"
VERSION="${DIR##*/}"
TESTJAR="$(find testjar -name '*-tests.jar')"
# SIGTERM handler, e.g. for when tests hang and time out.
# Send SIGQUIT to test process to get thread dump, give it
# a few seconds to complete and then kill it.
dump_threads() {
echo "Generating stack dump."
ps -fp "$TESTPID"
kill -QUIT "$TESTPID"
sleep 3
kill -KILL "$TESTPID"
exit 1
}
java -jar junit-platform-console-standalone.jar execute -cp "$DIR/conscrypt-openjdk-uber-$VERSION.jar${{ matrix.separator }}$TESTJAR" -n='org.conscrypt.ConscryptOpenJdkSuite' --scan-classpath --reports-dir=results --fail-if-no-tests &
case $(uname -s) in
Darwin|Linux)
trap dump_threads SIGTERM SIGINT
;;
*)
# TODO: Probably won't work on Windows but thread dumps
# work there already.
;;
esac
TESTPID=$!
wait "$TESTPID"
- name: Archive test results
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: test-results-${{ matrix.platform }}-${{ matrix.java }}-${{ matrix.dist }}
path: results