JavaThemis #1376
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 openssl@1.1 | |
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 |