Add CRL generation capability #76
Workflow file for this run
This file contains hidden or 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: Android Gradle Build and Test | |
| on: | |
| push: | |
| branches: [ 'master', 'main', 'release/**' ] | |
| pull_request: | |
| branches: [ 'master' ] | |
| concurrency: | |
| group: android-${{ github.head_ref || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build_wolfssljni: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Clone wolfssljni | |
| uses: actions/checkout@v4 | |
| # Clone native wolfSSL | |
| - name: Clone native wolfSSL | |
| uses: actions/checkout@v4 | |
| with: | |
| # Point to PR branch until merge | |
| # TODO: Switch back to wolfssl/wolfssl after merge | |
| repository: 'padelsbach/wolfssl' | |
| ref: crl-generation | |
| path: IDE/Android/app/src/main/cpp/wolfssl | |
| # Copy options.h.in to blank options.h | |
| - name: Create blank options.h | |
| run: cp IDE/Android/app/src/main/cpp/wolfssl/wolfssl/options.h.in IDE/Android/app/src/main/cpp/wolfssl/wolfssl/options.h | |
| # Setup Java with Gradle caching | |
| - name: Setup java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'zulu' | |
| java-version: '21' | |
| cache: 'gradle' | |
| # Build all targets in single Gradle invocation | |
| - name: Gradle Build | |
| run: cd IDE/Android && ./gradlew --build-cache assembleDebug assembleDebugUnitTest assembleDebugAndroidTest | |
| # Download Bouncy Castle provider for BKS conversion | |
| - name: Download Bouncy Castle Provider | |
| run: | | |
| wget -q https://repo1.maven.org/maven2/org/bouncycastle/bcprov-jdk18on/1.78.1/bcprov-jdk18on-1.78.1.jar -O /tmp/bcprov.jar | |
| # Convert JKS keystores to BKS format for Android | |
| - name: Convert JKS to BKS | |
| run: | | |
| cd examples/provider | |
| ./convert-to-bks.sh /tmp/bcprov.jar | |
| # Enable KVM for hardware acceleration (required for emulator) | |
| - name: Enable KVM | |
| run: | | |
| echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
| sudo udevadm control --reload-rules | |
| sudo udevadm trigger --name-match=kvm | |
| # Cache AVD snapshot for faster emulator boot | |
| - name: AVD cache | |
| uses: actions/cache@v4 | |
| id: avd-cache | |
| with: | |
| path: | | |
| ~/.android/avd/* | |
| ~/.android/adb* | |
| key: avd-30-x86_64-atd-v1 | |
| # Create AVD and generate snapshot for caching | |
| - name: Create AVD and generate snapshot | |
| if: steps.avd-cache.outputs.cache-hit != 'true' | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: 30 | |
| arch: x86_64 | |
| target: aosp_atd | |
| force-avd-creation: false | |
| emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
| disable-animations: true | |
| script: echo "Generated AVD snapshot for caching" | |
| # Run instrumented tests on Android emulator | |
| - name: Run Android Instrumented Tests | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| timeout-minutes: 15 | |
| with: | |
| api-level: 30 | |
| arch: x86_64 | |
| target: aosp_atd | |
| force-avd-creation: false | |
| emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
| disable-animations: true | |
| script: | | |
| adb wait-for-device | |
| adb shell mkdir -p /data/local/tmp/examples/provider | |
| adb shell mkdir -p /data/local/tmp/examples/certs/intermediate | |
| adb push ./examples/provider/*.bks /data/local/tmp/examples/provider/ | |
| adb push ./examples/certs/ /data/local/tmp/examples/ | |
| adb logcat -c | |
| cd IDE/Android && ./gradlew connectedDebugAndroidTest --no-daemon --no-watch-fs || { adb logcat -d > /tmp/logcat.txt 2>&1; echo "=== LOGCAT (errors) ==="; grep -i "exception\|error\|fatal" /tmp/logcat.txt || true; exit 1; } | |
| adb logcat -d > /tmp/logcat.txt 2>&1 || true | |
| pgrep -f '[q]emu-system' | xargs -r kill -9 2>/dev/null || true | |
| pgrep -f '[c]rashpad' | xargs -r kill -9 2>/dev/null || true | |
| sleep 2 | |
| # Upload test reports even on failure | |
| - name: Upload Test Reports | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| timeout-minutes: 5 | |
| with: | |
| name: android-test-reports | |
| path: | | |
| IDE/Android/app/build/reports/androidTests/ | |
| /tmp/logcat.txt | |
| retention-days: 14 | |