Skip to content

Show the installed version in the app #77

Show the installed version in the app

Show the installed version in the app #77

Workflow file for this run

name: CI
# Adapted from the SwEnt bootcamp's CI: the same checks, without the
# bootcamp-specific parts (milestone filters, staff tests, time tracking, MCQ).
on:
push:
branches:
- main
pull_request:
types:
- opened
- synchronize
- reopened
# The jobs only read the repository, so the workflow token gets no write access.
permissions:
contents: read
jobs:
always-on:
name: Always-on checks
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
fetch-depth: 0
# A tag can be moved to different code; a commit SHA cannot. The release job holds the signing
# key, so every action in every workflow must stay pinned.
- name: Check actions are pinned to commit SHAs
run: |
if grep -rnE '^\s*(-\s*)?uses:' .github/workflows | grep -vE '@[0-9a-f]{40}( |$)'; then
echo "::error::Pin the actions above to a full commit SHA, with the tag as a comment."
exit 1
fi
- name: Setup JDK
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5
with:
distribution: "temurin"
# The last version listed becomes JAVA_HOME. Robolectric needs 21 for SDK 36.
java-version: |
17
21
- name: Retrieve gradle cache
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
- name: Decode secrets
env:
GOOGLE_SERVICES: ${{ secrets.GOOGLE_SERVICES }}
run: |
# The google-services plugin needs this file to build, and it is kept out of the repo.
if [ -z "$GOOGLE_SERVICES" ]; then
echo "::error::GOOGLE_SERVICES secret is not set. Add app/google-services.json, base64-encoded, as a repository secret."
exit 1
fi
echo "$GOOGLE_SERVICES" | base64 --decode > ./app/google-services.json
- name: Grant execute permission for gradlew
run: |
chmod +x ./gradlew
- name: KTFmt Check
run: |
./gradlew ktfmtCheck
- name: Assemble
run: |
./gradlew assembleDebug lint --parallel --build-cache
firestore-rules:
name: Firestore rules tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: firebase/firestore/test
steps:
- name: Checkout
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
# The Firestore emulator is a Java program; firebase-tools 15 needs JDK 21.
- name: Setup JDK
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5
with:
distribution: "temurin"
java-version: 21
- name: Setup Node
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
with:
node-version: 24
cache: npm
cache-dependency-path: firebase/firestore/test/package-lock.json
- name: Retrieve emulator cache
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ~/.cache/firebase/emulators
key: firebase-emulators-${{ runner.os }}-${{ hashFiles('firebase/firestore/test/package-lock.json') }}
- name: Install dependencies
run: |
npm ci
- name: Type-check
run: |
npx tsc --noEmit
# Starts the Firestore emulator from firebase.json, runs the suite against
# firestore.rules, and fails the job if any test fails.
- name: Run rules tests
run: |
npm test
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
fetch-depth: 0
- name: Setup JDK
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5
with:
distribution: "temurin"
# The last version listed becomes JAVA_HOME. Robolectric needs 21 for SDK 36.
java-version: |
17
21
- name: Retrieve gradle cache
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
- name: Decode secrets
env:
GOOGLE_SERVICES: ${{ secrets.GOOGLE_SERVICES }}
run: |
if [ -z "$GOOGLE_SERVICES" ]; then
echo "::error::GOOGLE_SERVICES secret is not set. Add app/google-services.json, base64-encoded, as a repository secret."
exit 1
fi
echo "$GOOGLE_SERVICES" | base64 --decode > ./app/google-services.json
- name: Grant execute permission for gradlew
run: |
chmod +x ./gradlew
- name: Run unit tests
run: |
./gradlew testDebugUnitTest --parallel --build-cache
- name: Check coverage gate
run: |
./gradlew coverageVerification
# GitHub-hosted runners need KVM enabled to run the x86_64 emulator at usable speed.
- 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
# The emulator needs about 7.4 GB for its data partition and a hosted runner has less free.
# The NDK and the .NET and Haskell toolchains are not used by this build.
- name: Free disk space
run: |
sudo rm -rf /usr/local/lib/android/sdk/ndk /usr/share/dotnet /opt/ghc /usr/local/.ghcup
df -h /
- name: Run instrumentation tests
timeout-minutes: 40
uses: reactivecircus/android-emulator-runner@a421e43855164a8197daf9d8d40fe71c6996bb0d # v2.38.0
with:
api-level: 34
target: google_apis
arch: x86_64
avd-name: github
force-avd-creation: true
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -skin 1080x2400
disable-animations: true
script: ./gradlew connectedCheck --parallel --build-cache