-
Notifications
You must be signed in to change notification settings - Fork 144
137 lines (131 loc) · 4.43 KB
/
test-java.yaml
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
name: JavaThemis
on:
pull_request:
paths:
- '.github/workflows/test-java.yaml'
- '**/*gradle*'
- 'docs/examples/android/**'
- 'jni/**'
- 'src/soter/**'
- 'src/themis/**'
- 'src/wrappers/themis/android/**'
- 'src/wrappers/themis/java/**'
- 'third_party/boringssl/src/**'
- '**/*.mk'
- 'Makefile'
- '!**/README*'
push:
branches:
- master
- stable
- release/*
schedule:
- cron: '20 6 * * 1' # every Monday at 6:20 UTC
env:
WITH_FATAL_WARNINGS: yes
jobs:
unit-tests:
name: Unit tests
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-12]
fail-fast: false
steps:
- name: Install system dependencies
run: |
if [[ "$(uname)" = "Darwin" ]]
then
brew install [email protected]
else
sudo sh -c 'echo "DEBIAN_FRONTEND=noninteractive" >> /etc/environment'
sudo apt update
sudo apt install --yes gcc make libssl-dev default-jdk
fi
- name: Check out code
uses: actions/checkout@v2
- name: Install Themis Core with JNI
run: |
make all themis_jni
sudo make install themis_jni_install
- name: Build and test JavaThemis
# This step tends to randomly hang up. Use a shorter timeout here
# instead of the default 6-hour one.
timeout-minutes: 5
# Set native library search path for Java explicitly since most
# distribution-provided JVMs do not look there by default.
run: |
./gradlew --no-daemon -Djava.library.path=/usr/local/lib \
:desktop:build
android-tests:
name: Android emulator
runs-on: macos-11
steps:
- name: Check out code
uses: actions/checkout@v2
with:
submodules: true
- name: Install Android SDK
run: |
~/Library/Android/sdk/tools/bin/sdkmanager \
'build-tools;30.0.3' \
'cmake;3.22.1' \
'platforms;android-30' \
'ndk;25.0.8775105'
# macos-11 defaults to Java 8, but Gradle requires Java 11.
# Do this after sdkmanager usage, because *it* needs Java 8.
- name: Use Java 11
run: echo "JAVA_HOME=$JAVA_HOME_11_X64" >> "$GITHUB_ENV"
- name: Build Themis
# This step tends to randomly hang up. Use a shorter timeout here
# instead of the default 6-hour one.
timeout-minutes: 30
run: ./gradlew --no-daemon :android:assembleDebug
# This works reliably only in macOS runners which have HAXM available.
# Ubuntu runners do not have KVM enabled, modern x86 emulators do not
# work without KVM, and ARM emulator is abysmally slow.
- name: Run test suite
# This step tends to randomly hang up. Use a shorter timeout here
# instead of the default 6-hour one.
timeout-minutes: 15
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
script: ./gradlew --no-daemon :android:connectedAndroidTest
android-example:
name: Example – AndroidThemis
runs-on: ubuntu-20.04
steps:
- name: Check out code
uses: actions/checkout@v2
# Just build and run unit tests, don't launch the app or anything.
# Donations in the form of UI integration tests are welcome.
- name: Build AndroidThemis example
run: |
cd docs/examples/android
./gradlew --no-daemon build
java-example:
name: Example project – JavaThemis
runs-on: ubuntu-20.04
steps:
- name: Install system dependencies
run: |
sudo sh -c 'echo "DEBIAN_FRONTEND=noninteractive" >> /etc/environment'
sudo apt update
sudo apt install --yes gcc make libssl-dev default-jdk
- name: Check out code
uses: actions/checkout@v2
- name: Install Themis Core with JNI
run: |
make all themis_jni
sudo make install themis_jni_install
- name: Build JavaThemis example
run: |
cd docs/examples/java
./gradlew --no-daemon build
# Thus runs a bit of an abomination: Themis Core and JNI libs are built
# from source while JavaThemis binaries are installed from Maven Central.
- name: Run JavaThemis example
run: |
cd docs/examples/java
java -Djava.library.path=/usr/local/lib -jar app/build/libs/app.jar