Add key learnings to summary details #17
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
# This is a workflow to run Unit and Android tests and generate code coverage reports | |
# It also uploads the reports to Codecov for later access | |
name: CI Dev Build | |
on: | |
# Triggers the workflow on push or pull request on the dev branch | |
push: | |
branches: [ dev ] | |
pull_request: | |
branches: [ dev ] | |
jobs: | |
build: | |
name: Build, test and upload code coverage | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v2 | |
# This step installs JDK 17 using the Zulu distribution. It's necessary for building the app. | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
# Loads the Google Services configuration file from a secret, decodes it, and saves it to the app directory. | |
# This file is essential for making Firebase services work into the app. | |
- name: Load Google Services file | |
env: | |
DATA: ${{ secrets.GOOGLE_SERVICES_JSON }} | |
run: echo $DATA | base64 -D > app/google-services.json | |
# Loads the keystore.properties file from a Github secret, decodes it, and saves it to the root directory. | |
- name: Create keystore.properties | |
run: | | |
echo "${{ secrets.KEYSTORE_PROPERTIES }}" > $GITHUB_WORKSPACE/keystore.properties | |
# Loads the secrets.properties file from a Github secret, decodes it, and saves it to the root directory. | |
- name: Create secrets.properties | |
run: | | |
echo "${{ secrets.SECRETS_PROPERTIES }}" > $GITHUB_WORKSPACE/secrets.properties | |
# Loads the sentry.properties file from a Github secret, decodes it, and saves it to the root directory. | |
- name: Create sentry.properties | |
run: | | |
echo "${{ secrets.SENTRY_PROPERTIES }}" > $GITHUB_WORKSPACE/sentry.properties | |
# Loads the keystore file from a Github secret, decodes it, and saves it to the root directory. | |
- name: Create keystore file | |
run: | | |
echo "${{ secrets.KEYSTORE_JKS_FILE }}" | base64 -d > $GITHUB_WORKSPACE/tangakeystore.jks | |
# Grant execute permission to the gradlew file. | |
- name: Grant execute permission for gradlew | |
run: chmod +x ./gradlew | |
# Setup Gradle Cache to improve the speed of the workflows | |
- name: Setup Gradle Cache | |
uses: gradle/gradle-build-action@v2 | |
with: | |
gradle-home-cache-cleanup: true | |
# This step builds the app in debug mode using Gradle. | |
- run: echo "Building Debug APK." | |
- name: Build the project with Gradle | |
run: ./gradlew build | |
- run: echo "Build status report=${{ job.status }}." | |
# Executes Android tests in an emulator. | |
# It uses an emulator with API level 29 and runs the 'jacocoTestReport' Gradle task for generating code coverage reports. | |
# Skipping this step for now as our android tests are not working | |
# - name: Android Tests with Android Emulator Runner | |
# uses: ReactiveCircus/[email protected] | |
# with: | |
# api-level: 29 | |
# script: ./gradlew jacocoTestReport | |
# Generates a Kotlin code coverage report using the Kover tool. | |
# This step is crucial for assessing the coverage of unit tests written in Kotlin. | |
- name: Run Unit Tests with Kover (Kotlin Code Coverage) | |
run: ./gradlew koverXmlReportDebug | |
# Uploads the generated Android instrumented test coverage reports as artifacts for later access. | |
# This step ensures that test results are stored and retrievable. | |
- name: Generate report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: report | |
path: app/build/reports/coverage/androidTest/debug/connected/ | |
# Uploads the Android instrumented test coverage report to Codecov using a provided token. | |
# If there's an error in uploading, the CI process will fail. | |
# Skipping this step for now as our android tests are not working | |
# - name: Upload Android Instrumented Test Report | |
# uses: codecov/codecov-action@v3 | |
# with: | |
# token: ${{ secrets.CODECOV_TOKEN }} | |
# files: app/build/reports/coverage/androidTest/debug/connected/report.xml, core-ui/build/reports/coverage/androidTest/debug/connected/report.xml | |
# flags: uitests | |
# fail_ci_if_error: true | |
# Similar to the previous step, this uploads the Kotlin unit test coverage report to Codecov. | |
# It also fails the CI process if an error occurs during upload. | |
- name: Upload Unit Test Report | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: app/build/reports/kover/reportDebug.xml | |
flags: unittests | |
fail_ci_if_error: true |