Skip to content

Rewrite the app in Kotlin Multiplatform and Compose for 2.0 #4

Rewrite the app in Kotlin Multiplatform and Compose for 2.0

Rewrite the app in Kotlin Multiplatform and Compose for 2.0 #4

Workflow file for this run

name: CI
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
name: Checks
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
# One step per gate, so a red run says which gate failed without opening the log.
#
# These are the same tasks `./gradlew ciCheck` depends on. Adding a task there means
# adding a step here, or the local gate and the CI gate drift apart.
#
# Each step runs even if an earlier one failed, so a single push reports every
# problem at once instead of one per round trip. The cost is that a compile error
# turns several steps red at the same time.
- name: Formatting
run: ./gradlew ktlintCheck --no-daemon --stacktrace
- name: Static analysis
if: ${{ !cancelled() }}
run: ./gradlew detekt --no-daemon --stacktrace
- name: Android Lint
if: ${{ !cancelled() }}
run: ./gradlew :composeApp:lintDebug --no-daemon --stacktrace
- name: Unit tests (shared)
if: ${{ !cancelled() }}
run: ./gradlew :shared:testAndroid --no-daemon --stacktrace
- name: Unit tests (app)
if: ${{ !cancelled() }}
run: ./gradlew :composeApp:testDebugUnitTest --no-daemon --stacktrace
- name: Debug build
if: ${{ !cancelled() }}
run: ./gradlew :composeApp:assembleDebug --no-daemon --stacktrace
# Reports are far more useful than the log when something fails, and they are the
# only artefact of a red run worth keeping.
- name: Upload reports
if: always()
uses: actions/upload-artifact@v4
with:
name: reports
path: |
**/build/reports/ktlint/**
**/build/reports/detekt/**
**/build/reports/lint-results-*.html
**/build/reports/tests/**
retention-days: 7
if-no-files-found: ignore
e2e:
name: End-to-end tests
runs-on: ubuntu-latest
timeout-minutes: 45
needs: check
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
# KVM has to be enabled explicitly or the emulator falls back to software rendering
# and the suite times out rather than failing honestly.
- 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
- name: Instrumented tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 34
target: google_apis
arch: x86_64
disable-animations: true
script: ./gradlew :composeApp:connectedDebugAndroidTest --no-daemon
- name: Upload reports
if: always()
uses: actions/upload-artifact@v4
with:
name: e2e-reports
path: composeApp/build/reports/androidTests/**
retention-days: 7
if-no-files-found: ignore
bundle:
name: Release bundle
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [check, e2e]
# Only on master: this proves the release variant still assembles, which is what
# actually ships to Play. It is unsigned here, the upload keystore never enters CI.
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
- name: Bundle release
run: ./gradlew :composeApp:bundleRelease --no-daemon
- name: Upload bundle
uses: actions/upload-artifact@v4
with:
name: aab
path: composeApp/build/outputs/bundle/release/*.aab
retention-days: 14