Skip to content

Make guardian API key secret and tidy up CI #120

Make guardian API key secret and tidy up CI

Make guardian API key secret and tidy up CI #120

Workflow file for this run

name: Check Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
JAVA_VERSION: "17"
XCODE_VERSION: "13.3"
XCODE_CACHE: "CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++"
IOS_SIMULATOR: "platform=iOS Simulator,name=iPhone 11,OS=15.4"
ANDROID_COMPILE_SDK: "31"
ANDROID_EMULATOR_ARCHITECTURE: "x86_64"
GUARDIAN_API_KEY: ${{ secrets.GUARDIAN_API_KEY }}
GUARDIAN_API_URL: ${{ secrets.GUARDIAN_API_URL }}
jobs:
kmmTest:
runs-on: ubuntu-20.04
concurrency:
group: ${{ github.ref }}_kmmTest
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ env.JAVA_VERSION }}
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3 # By default, cache is only saved on the 'master' branch
- name: Set up Konan
uses: actions/cache@v4
id: konan-kmm-test
with:
path: '~/.konan/**'
key: konan-kmm-build
- name: Set up secrets
run: |
bash secrets.sh
- name: KMM tests
run: |
set -o pipefail &&
./gradlew --no-daemon --continue testDebugUnitTest
- name: Generate test report
uses: mikepenz/action-junit-report@v4
if: always() # Ensure all test reports are collected, even after errors
with:
report_paths: |
**/TEST-*.xml
check_name: 'kmmTestResults'
- name: Save artifacts
uses: actions/upload-artifact@v4
if: always() # Ensure all artifacts are collected, even after errors
with:
name: Tests
path: |
**/TEST-*.xml
iosBuild:
runs-on: macos-12
concurrency:
group: ${{ github.ref }}_iosBuild
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ env.JAVA_VERSION }}
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3 # By default, cache is only saved on the 'master' branch
- name: Set up Konan
uses: actions/cache@v4
id: konan-ios-build
with:
path: '~/.konan/**'
key: konan-ios-build
- name: Set up secrets
run: |
bash secrets.sh
- name: Set up Xcode version
run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app
- name: Set up Xcode
uses: mikehardy/buildcache-action@v2
- name: Compile iOS app
run: |
cd appIos &&
set -o pipefail &&
xcodebuild ${{ env.XCODE_CACHE }} -workspace appIos.xcworkspace -scheme "appIos" -sdk iphonesimulator -destination '${{ env.IOS_SIMULATOR }}' build | tee xcodebuild.log | xcpretty &&
cd ..
- name: Save artifacts
uses: actions/upload-artifact@v4
if: always() # Ensure all artifacts are collected, even after errors
with:
name: Build
path: |
appIos/xcodebuild.log
~/Library/Developer/Xcode/DerivedData/**/Build/Products/**/appIos.app
~/Library/Developer/Xcode/DerivedData/**/Build/Products/**/appIos.app.dSYM
**/build
**/secrets.properties
iosTest:
runs-on: macos-12
concurrency:
group: ${{ github.ref }}_iosTest
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ env.JAVA_VERSION }}
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3 # By default, cache is only saved on the 'master' branch
- name: Set up Konan
uses: actions/cache@v4
id: konan-ios-test
with:
path: '~/.konan/**'
key: konan-ios-test
- name: Set up secrets
run: |
bash secrets.sh
- name: Set up Xcode version
run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app
- name: Set up Xcode
uses: mikehardy/buildcache-action@v2
- name: iOS tests
run: |
cd appIos &&
set -o pipefail &&
xcodebuild ${{ env.XCODE_CACHE }} -workspace appIos.xcworkspace -scheme "appIos" -sdk iphonesimulator -destination '${{ env.IOS_SIMULATOR }}' test | tee xcodebuild.log | xcpretty &&
cd ..
- name: Save artifacts
uses: actions/upload-artifact@v4
if: always() # Ensure all artifacts are collected, even after errors
with:
name: Tests
path: |
appIos/xcodebuild.log
androidBuild:
runs-on: ubuntu-20.04
concurrency:
group: ${{ github.ref }}_androidBuild
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ env.JAVA_VERSION }}
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3 # By default, cache is only saved on the 'master' branch
- name: Set up Konan
uses: actions/cache@v4
id: konan-android-build
with:
path: '~/.konan/**'
key: konan-android-build
- name: Set up secrets
run: |
bash secrets.sh
- name: Compile Android app
run: |
set -o pipefail &&
./gradlew android:app:assembleDebug
- name: Save artifacts
uses: actions/upload-artifact@v4
if: always() # Ensure all artifacts are collected, even after errors
with:
name: Build
path: |
**/*.apk
**/build
**/secrets.properties
androidTest:
runs-on: macos-11 # Allows Android emulator hardware acceleration
concurrency:
group: ${{ github.ref }}_androidTest
cancel-in-progress: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: ${{ env.JAVA_VERSION }}
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3 # By default, cache is only saved on the 'master' branch
- name: Set up Konan
uses: actions/cache@v4
id: konan-android-test
with:
path: '~/.konan/**'
key: konan-android-test
- name: Set up secrets
run: |
bash secrets.sh
- name: Set up AVD
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ env.ANDROID_COMPILE_SDK }}
- name: Generate AVD cache snapshot
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.ANDROID_COMPILE_SDK }}
arch: ${{ env.ANDROID_EMULATOR_ARCHITECTURE }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD cache snapshot"
- name: Android tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ env.ANDROID_COMPILE_SDK }}
arch: ${{ env.ANDROID_EMULATOR_ARCHITECTURE }}
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: set -o pipefail && ./gradlew connectedAndroidTest
- name: Save artifacts
uses: actions/upload-artifact@v4
if: always() # Ensure all artifacts are collected, even after errors
with:
name: Tests
path: |
**/test-result.pb