Re-add Xcode build cache #85
Workflow file for this run
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: Check Build | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
env: | |
JAVA_VERSION: "11" | |
XCODE_VERSION: "13.0" | |
XCODE_CACHE: "CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++" | |
IOS_SIMULATOR: "platform=iOS Simulator,name=iPhone 11,OS=15.0" | |
ANDROID_COMPILE_SDK: "31" | |
ANDROID_EMULATOR_ARCHITECTURE: "x86_64" | |
jobs: | |
kmmTest: | |
runs-on: ubuntu-20.04 | |
concurrency: | |
group: ${{ github.ref }}_kmmTest | |
cancel-in-progress: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Java | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'zulu' | |
java-version: ${{ env.JAVA_VERSION }} | |
- name: Gradle cache | |
uses: gradle/gradle-build-action@v2 | |
- name: KMM cache | |
uses: actions/cache@v2 | |
id: konan-kmm | |
with: | |
path: '~/.konan/**' | |
key: konan-kmm | |
- name: KMM tests | |
run: set -o pipefail && ./gradlew --continue testDebugUnitTest | |
# Always run this job even if the previous steps fail to collect all test reports | |
- name: Generate KMM test report | |
uses: mikepenz/action-junit-report@v3 | |
if: always() | |
with: | |
report_paths: 'kmm/**/build/test-results/**/TEST-*.xml' | |
check_name: 'kmmTestResults' | |
# Always run this job even if the previous steps fail to collect all artifacts | |
- name: Save artifacts | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: KMM test results | |
path: 'kmm/**/build/test-results/**/TEST-*.xml' | |
ioscachetest: | |
runs-on: macos-latest | |
steps: | |
- uses: mikehardy/buildcache-action@v2 | |
iosBuild: | |
runs-on: macos-11 | |
concurrency: | |
group: ${{ github.ref }}_iosBuild | |
cancel-in-progress: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Java | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'zulu' | |
java-version: ${{ env.JAVA_VERSION }} | |
- name: Setup Xcode | |
run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app | |
- name: Gradle cache | |
uses: gradle/gradle-build-action@v2 | |
- name: KMM cache | |
uses: actions/cache@v2 | |
id: konan-ios | |
with: | |
path: '~/.konan/**' | |
key: konan-ios | |
- 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 | |
- name: Save artifacts | |
uses: actions/upload-artifact@v3 | |
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 | |
iosTest: | |
runs-on: macos-11 | |
concurrency: | |
group: ${{ github.ref }}_iosTest | |
cancel-in-progress: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Java | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'zulu' | |
java-version: ${{ env.JAVA_VERSION }} | |
- name: Setup Xcode | |
run: sudo xcode-select -s /Applications/Xcode_${{ env.XCODE_VERSION }}.app | |
- name: Gradle cache | |
uses: gradle/gradle-build-action@v2 | |
- name: KMM cache | |
uses: actions/cache@v2 | |
id: konan-ios-test | |
with: | |
path: '~/.konan/**' | |
key: konan-ios-test | |
- 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 | |
- name: Save artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: iOS test results | |
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@v2 | |
- name: Setup Java | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'zulu' | |
java-version: ${{ env.JAVA_VERSION }} | |
- name: Gradle cache | |
uses: gradle/gradle-build-action@v2 | |
- name: KMM cache | |
uses: actions/cache@v2 | |
id: konan-android | |
with: | |
path: '~/.konan/**' | |
key: konan-android | |
- name: Compile Android app | |
run: set -o pipefail && ./gradlew appAndroid:assembleDebug | |
- name: Save artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Android build | |
path: 'appAndroid/**/build/**/appAndroid-*.apk' | |
androidTest: | |
# Needed because of hardware acceleration for the emulator | |
runs-on: macos-11 | |
concurrency: | |
group: ${{ github.ref }}_androidTest | |
cancel-in-progress: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Java | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'zulu' | |
java-version: ${{ env.JAVA_VERSION }} | |
- name: Gradle cache | |
uses: gradle/gradle-build-action@v2 | |
- name: KMM cache | |
uses: actions/cache@v2 | |
id: konan-android-test | |
with: | |
path: '~/.konan/**' | |
key: konan-android-test | |
- name: AVD cache | |
uses: actions/cache@v2 | |
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 | |
# Always run this job even if the previous steps fail to collect all artifacts | |
- name: Save artifacts | |
uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: Android test results | |
path: 'appAndroid/**/build/outputs/androidTest-results/connected/**/test-result.pb' |