chore(gradle): create test plugin convention for test modules. #241
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: Build | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: build-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
android: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: gradle/actions/setup-gradle@v4 | |
- name: Copy CI gradle.properties | |
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 21 | |
- name: Check Kotlin lint | |
run: ./gradlew :androidApp:ktlintCheck :androidApp:detekt --stacktrace | |
- name: Check lint | |
run: ./gradlew :androidApp:lintDebug --stacktrace | |
- name: Check and build android project | |
run: ./gradlew :androidApp:assembleDebug :androidApp:bundleDebug --stacktrace | |
- name: Upload build outputs | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: android-build-outputs | |
path: androidApp/build/outputs | |
- name: Upload reports | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: android-reports | |
path: | | |
**/build/reports/* | |
- name: Upload test results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: android-test-results | |
path: | | |
**/build/test-results/* | |
wear: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: gradle/actions/setup-gradle@v4 | |
- name: Copy CI gradle.properties | |
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 21 | |
- name: Check Kotlin lint | |
run: ./gradlew :wear:wear-app:ktlintCheck :wear:wear-app:detekt --stacktrace | |
- name: Check lint | |
run: ./gradlew :wear:wear-app:lintDebug --stacktrace | |
- name: Check and build android project | |
run: ./gradlew :wear:wear-app:assembleDebug :wear:wear-app:bundleDebug --stacktrace | |
- name: Upload build outputs | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wear-build-outputs | |
path: wear/wear-app/build/outputs | |
- name: Upload reports | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wear-reports | |
path: | | |
**/build/reports/* | |
- name: Upload test results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wear-test-results | |
path: | | |
**/build/test-results/* | |
androidTest: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- name: Delete unnecessary tools 🔧 | |
uses: jlumbroso/[email protected] | |
with: | |
android: false # Don't remove Android tools | |
tool-cache: true # Remove image tool cache - rm -rf "$AGENT_TOOLSDIRECTORY" | |
dotnet: true # rm -rf /usr/share/dotnet | |
haskell: true # rm -rf /opt/ghc... | |
swap-storage: true # rm -f /mnt/swapfile (4GiB) | |
docker-images: false # Takes 16s, enable if needed in the future | |
large-packages: false # includes google-cloud-sdk and it's slow | |
- 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 | |
- uses: actions/checkout@v4 | |
- uses: gradle/actions/setup-gradle@v4 | |
- name: Copy CI gradle.properties | |
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 21 | |
- name: Build projects and run instrumentation tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 29 | |
disable-animations: true | |
disk-size: 6000M | |
heap-size: 600M | |
emulator-build: 7425822 # https://github.com/ReactiveCircus/android-emulator-runner/issues/160 | |
script: ./gradlew connectedDebugAndroidTest --daemon | |
- name: Upload test results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: android-instrumented-test-results | |
path: | | |
**/build/reports/androidTests | |
ios: | |
runs-on: macos-14 # M1 runner | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 21 | |
- name: Build iOS app | |
run: xcodebuild -allowProvisioningUpdates -project iosApp/iosApp.xcodeproj -configuration Debug -scheme iosApp -sdk iphoneos build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | |
backend: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: gradle/actions/setup-gradle@v4 | |
- name: Copy CI gradle.properties | |
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 21 | |
- name: Check Kotlin lint | |
run: ./gradlew :backend:ktlintCheck :backend:detekt --stacktrace | |
- name: Check and build android project | |
run: ./gradlew :backend:build --stacktrace |