Skip to content

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

Rewrite the app in Kotlin Multiplatform and Compose for 2.0

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

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:
# One job per gate, so each shows up as its own check: CI / Format, CI / Lint and
# so on, and a red run names the gate in the checks list without opening a log.
#
# A matrix rather than five copies of the same job, since the only thing that
# differs is the Gradle task. These are the tasks `./gradlew ciCheck` depends on;
# adding one there means adding a row here or the local and CI gates drift apart.
#
# The cost is that each job compiles independently. The Gradle cache absorbs most
# of it, and being able to see every failure at once is worth the minutes.
check:
name: ${{ matrix.name }}
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- name: Format
task: ktlintCheck
- name: Static analysis
task: detekt
- name: Lint
task: ':composeApp:lintDebug'
- name: Unit tests
task: ':shared:testAndroid :composeApp:testDebugUnitTest'
- name: Debug build
task: ':composeApp:assembleDebug'
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: ${{ matrix.name }}
run: ./gradlew ${{ matrix.task }} --no-daemon --stacktrace
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
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