-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make guardian API key secret and tidy up CI (#29)
- Loading branch information
Showing
15 changed files
with
345 additions
and
260 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,247 @@ | ||
name: check | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
env: | ||
JAVA_VERSION: "17" | ||
JAVA_DISTRIBUTION: "zulu" | ||
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: | ||
check-unit-test: | ||
runs-on: ubuntu-20.04 | ||
concurrency: | ||
group: ${{ github.ref }}-check-unit-test | ||
cancel-in-progress: true | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: ${{ env.JAVA_DISTRIBUTION }} | ||
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: check-unit-test-konan | ||
with: | ||
path: '~/.konan/**' | ||
key: check-unit-test-konan | ||
- name: Set up secrets | ||
run: | | ||
bash secrets.sh | ||
- name: Unit test | ||
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: 'check-unit-test-results' | ||
- name: Artifacts | ||
uses: actions/upload-artifact@v4 | ||
if: always() # Ensure all artifacts are collected, even after errors | ||
with: | ||
name: Unit tests | ||
path: | | ||
**/TEST-*.xml | ||
ios-check-build: | ||
runs-on: macos-12 | ||
concurrency: | ||
group: ${{ github.ref }}-ios-check-build | ||
cancel-in-progress: true | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: ${{ env.JAVA_DISTRIBUTION }} | ||
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: ios-check-build-konan | ||
with: | ||
path: '~/.konan/**' | ||
key: ios-check-build-konan | ||
- 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: Artifacts | ||
uses: actions/upload-artifact@v4 | ||
if: always() # Ensure all artifacts are collected, even after errors | ||
with: | ||
name: iOS 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 | ||
ios-check-test: | ||
runs-on: macos-12 | ||
concurrency: | ||
group: ${{ github.ref }}-ios-check-test | ||
cancel-in-progress: true | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: ${{ env.JAVA_DISTRIBUTION }} | ||
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: ios-check-test-konan | ||
with: | ||
path: '~/.konan/**' | ||
key: ios-check-test-konan | ||
- 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: Artifacts | ||
uses: actions/upload-artifact@v4 | ||
if: always() # Ensure all artifacts are collected, even after errors | ||
with: | ||
name: iOS Tests | ||
path: | | ||
appIos/xcodebuild.log | ||
android-check-build: | ||
runs-on: ubuntu-20.04 | ||
concurrency: | ||
group: ${{ github.ref }}-android-check-build | ||
cancel-in-progress: true | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: ${{ env.JAVA_DISTRIBUTION }} | ||
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: android-check-build-konan | ||
with: | ||
path: '~/.konan/**' | ||
key: android-check-build-konan | ||
- name: Set up secrets | ||
run: | | ||
bash secrets.sh | ||
- name: Compile Android app | ||
run: | | ||
set -o pipefail && | ||
./gradlew android:app:assembleDebug | ||
- name: Artifacts | ||
uses: actions/upload-artifact@v4 | ||
if: always() # Ensure all artifacts are collected, even after errors | ||
with: | ||
name: Android Build | ||
path: | | ||
**/*.apk | ||
**/build | ||
**/secrets.properties | ||
android-check-test: | ||
runs-on: macos-11 # Allows Android emulator hardware acceleration | ||
concurrency: | ||
group: ${{ github.ref }}-android-check-test | ||
cancel-in-progress: true | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: ${{ env.JAVA_DISTRIBUTION }} | ||
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: android-check-test-konan | ||
with: | ||
path: '~/.konan/**' | ||
key: android-check-test-konan | ||
- 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: Artifacts | ||
uses: actions/upload-artifact@v4 | ||
if: always() # Ensure all artifacts are collected, even after errors | ||
with: | ||
name: Android Tests | ||
path: | | ||
**/test-result.pb |
Oops, something went wrong.