Skip to content

docs: clean documentation #2138

docs: clean documentation

docs: clean documentation #2138

Workflow file for this run

name: CI - Test Runner
# Run the workflow when commits are pushed on main or when a PR is modified
on:
push:
branches:
- main
- 'setup/**'
- 'feat/**'
- 'release/**'
pull_request:
types:
- opened
- synchronize
- reopened
jobs:
ci:
name: CI
# Execute the CI on the course's runners
runs-on: ubuntu-latest
steps:
- uses: denoland/setup-deno@v2
# First step : Checkout the repository on the runner
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of Sonar analysis (if we use Sonar Later)
# Kernel-based Virtual Machine (KVM) is an open source virtualization technology built into Linux. Enabling it allows the Android emulator to run faster.
- name: Enable KVM group perms
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: Setup JDK
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
# Hello Hello, Alonso here ^_~
# For whatever reason Android SDK is weird and I can't get the emulator to work
# vvv this new plugin should install v12.0 that was published Sep 2024 to be updated
- name: Setup Android SDK
uses: Swisyn/setup-android-sdk@v1
with:
cmdline-tools-version: 11076708
##TODO: Check if I need to install adb and avdmanager manually with cli cmds
# Caching is a very useful part of a CI, as a workflow is executed in a clean environment every time,
# this means that one would need to re-download and re-process gradle files for every run. Which is very time consuming.
#
# To avoid that, we cache the the gradle folder to reuse it later.
- name: Gradle cache
uses: gradle/actions/setup-gradle@v3
# Cache the Emulator, if the cache does not hit, create the emulator
- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-34
- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 34
target: google_apis
arch: x86_64
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: echo "Generated AVD snapshot for caching."
- name: Grant execute permission for gradlew
run: |
chmod +x ./gradlew
- name: Setup secrets.properties
env:
SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}
SERVICE_KEY: ${{ secrets.SERVICE_KEY }}
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
POWERSYNC_URL: ${{ secrets.POWERSYNC_URL }}
STADIA_MAPS_KEY: ${{ secrets.STADIA_MAPS_KEY }}
STREAM_SDK_KEY: ${{ secrets.STREAM_SDK_KEY }}
STREAM_SDK_SECRET: ${{ secrets.STREAM_SDK_SECRET }}
run: |
sed -e "s|SAFE_DEFAULT_VALUE_SERVICE_KEY|$SERVICE_KEY|g;" \
-e "s|SAFE_DEFAULT_VALUE_SUPABASE_KEY|$SUPABASE_KEY|g;" \
-e "s|SAFE_DEFAULT_VALUE_SUPABASE_URL|$SUPABASE_URL|g;" \
-e "s|SAFE_DEFAULT_VALUE_POWERSYNC_URL|$POWERSYNC_URL|g;" \
-e "s|SAFE_DEFAULT_STADIA_MAPS_KEY|$STADIA_MAPS_KEY|g;" \
-e "s|SAFE_DEFAULT_VALUE_STREAM_SDK_KEY|$STREAM_SDK_KEY|g;" \
-e "s|SAFE_DEFAULT_VALUE_STREAM_SDK_SECRET|$STREAM_SDK_SECRET|g;" secrets.defaults.properties > secrets.properties
# Load google-services.json from the secrets
- name: Setup google-services.json
env:
GOOGLE_SERVICES: ${{ secrets.GOOGLE_SERVICES }}
run: |
echo "$GOOGLE_SERVICES" | base64 --decode > ./app/google-services.json
# Load service-account.json from the secrets
- name: Setup service-account.json
env:
SERVICE_ACCOUNT: ${{ secrets.SERVICE_ACCOUNT }}
run: |
echo "$SERVICE_ACCOUNT" | base64 --decode > ./supabase/functions/service-account.json
# Check formatting
- name: KTFmt Check
run: |
./gradlew ktfmtCheck
# This step runs gradle commands to build the application
- name: Assemble
run: |
# To run the CI with debug information, add --info
./gradlew assemble lint --parallel --build-cache
# Run Unit tests
- name: Run unit tests
run: |
# To run the CI with debug information, add --info
./gradlew check --parallel --build-cache
# Run connected tests on the emulator
- name: Run connected tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 34
target: google_apis
arch: x86_64
avd-name: github
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -skin 1080x1920
disable-animations: true
script: ./gradlew connectedCheck --parallel --build-cache
# Run Deno tests
- name: Run Deno tests
run: |
deno test --allow-net --allow-read supabase/tests/*.test.ts
# This step generates the coverage report which will be uploaded to sonar
- name: Generate Coverage Report
run: |
./gradlew jacocoTestReport
# Upload the various reports to sonar
- name: SonarCloud
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: ./gradlew build sonar --parallel --build-cache --info