Add PEM to DER conversion support in WolfCrypt class #20
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_wolfcryptjni: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Clone wolfcrypt-jni | |
| uses: actions/checkout@v4 | |
| # Free up disk space to prevent emulator from failing | |
| - name: Free up disk space | |
| run: | | |
| sudo rm -rf /usr/share/dotnet | |
| sudo rm -rf /usr/local/lib/android/sdk/ndk | |
| sudo rm -rf /opt/ghc | |
| sudo rm -rf /opt/hostedtoolcache/CodeQL | |
| sudo docker image prune --all --force | |
| df -h | |
| # Clone native wolfSSL | |
| - name: Clone native wolfSSL | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: 'wolfssl/wolfssl' | |
| 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 | |
| # 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-wolfcryptjni-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/certs/intermediate | |
| adb shell mkdir -p /data/local/tmp/examples/certs/rsapss | |
| adb shell mkdir -p /data/local/tmp/examples/certs/crl | |
| 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 |