2021-03-25 14:26:26 +03:00
|
|
|
name: Test
|
|
|
|
|
|
|
|
on:
|
2022-09-07 12:45:00 +03:00
|
|
|
pull_request: { }
|
2021-03-25 14:26:26 +03:00
|
|
|
push:
|
2022-09-07 12:45:00 +03:00
|
|
|
branches: [ main, develop ]
|
2023-02-10 17:17:13 +03:00
|
|
|
paths-ignore:
|
|
|
|
- '.github/**'
|
2021-03-25 14:26:26 +03:00
|
|
|
|
2021-09-08 14:03:51 +03:00
|
|
|
# Enrich gradle.properties for CI/CD
|
|
|
|
env:
|
2022-08-04 12:00:47 +03:00
|
|
|
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx3072m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError" -Dkotlin.daemon.jvm.options="-Xmx2560m" -Dkotlin.incremental=false
|
2022-09-23 16:25:32 +03:00
|
|
|
CI_GRADLE_ARG_PROPERTIES: --stacktrace -PpreDexEnable=false --max-workers 4 --no-daemon
|
2022-02-24 12:30:28 +03:00
|
|
|
|
2021-03-25 14:26:26 +03:00
|
|
|
jobs:
|
2022-05-25 14:38:37 +03:00
|
|
|
tests:
|
|
|
|
name: Runs all tests
|
2022-09-19 15:31:35 +03:00
|
|
|
runs-on: buildjet-4vcpu-ubuntu-2204
|
2022-11-24 11:46:11 +03:00
|
|
|
timeout-minutes: 90 # We might need to increase it if the time for tests grows
|
2022-09-19 19:12:19 +03:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-07-16 16:15:12 +03:00
|
|
|
api-level: [28]
|
2022-02-24 02:13:30 +03:00
|
|
|
# Allow all jobs on main and develop. Just one per PR.
|
2022-02-23 21:11:46 +03:00
|
|
|
concurrency:
|
2022-02-24 19:31:17 +03:00
|
|
|
group: ${{ github.ref == 'refs/heads/main' && format('unit-tests-main-{0}', github.sha) || github.ref == 'refs/heads/develop' && format('unit-tests-develop-{0}', github.sha) || format('unit-tests-{0}', github.ref) }}
|
2022-02-23 21:11:46 +03:00
|
|
|
cancel-in-progress: true
|
2021-03-25 14:26:26 +03:00
|
|
|
steps:
|
2024-07-15 19:12:08 +03:00
|
|
|
- uses: actions/checkout@v4
|
2021-03-25 14:26:26 +03:00
|
|
|
with:
|
2022-09-14 17:29:21 +03:00
|
|
|
lfs: true
|
2022-05-25 14:38:37 +03:00
|
|
|
fetch-depth: 0
|
2024-10-25 11:29:16 +03:00
|
|
|
- name: Use JDK 21
|
2024-07-15 19:12:08 +03:00
|
|
|
uses: actions/setup-java@v4
|
2022-05-25 14:38:37 +03:00
|
|
|
with:
|
2024-07-15 19:12:08 +03:00
|
|
|
distribution: 'temurin' # See 'Supported distributions' for available options
|
2024-10-25 11:29:16 +03:00
|
|
|
java-version: '21'
|
2024-07-15 19:12:08 +03:00
|
|
|
- name: Configure gradle
|
|
|
|
uses: gradle/actions/setup-gradle@v3
|
2022-09-27 18:45:50 +03:00
|
|
|
with:
|
|
|
|
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
|
|
|
|
gradle-home-cache-cleanup: ${{ github.ref == 'refs/heads/develop' }}
|
2022-09-14 17:09:14 +03:00
|
|
|
|
|
|
|
- name: Run screenshot tests
|
2022-09-26 14:29:28 +03:00
|
|
|
run: ./gradlew verifyScreenshots $CI_GRADLE_ARG_PROPERTIES
|
2022-09-14 17:09:14 +03:00
|
|
|
|
|
|
|
- name: Archive Screenshot Results on Error
|
|
|
|
if: failure()
|
2022-09-27 13:03:44 +03:00
|
|
|
uses: actions/upload-artifact@v3
|
2022-09-14 17:09:14 +03:00
|
|
|
with:
|
|
|
|
name: screenshot-results
|
|
|
|
path: |
|
|
|
|
**/out/failures/
|
|
|
|
**/build/reports/tests/*UnitTest/
|
|
|
|
|
2022-06-14 02:05:19 +03:00
|
|
|
- uses: actions/setup-python@v4
|
2022-05-25 14:38:37 +03:00
|
|
|
with:
|
|
|
|
python-version: 3.8
|
2024-11-04 19:52:02 +03:00
|
|
|
- uses: michaelkaye/setup-matrix-synapse@v1.0.5
|
2022-05-25 14:38:37 +03:00
|
|
|
with:
|
|
|
|
uploadLogs: true
|
|
|
|
httpPort: 8080
|
|
|
|
disableRateLimiting: true
|
|
|
|
public_baseurl: "http://10.0.2.2:8080/"
|
2022-09-19 19:12:19 +03:00
|
|
|
|
2022-05-25 14:38:37 +03:00
|
|
|
- name: Run all the codecoverage tests at once
|
|
|
|
uses: reactivecircus/android-emulator-runner@v2
|
2022-09-19 17:26:38 +03:00
|
|
|
# continue-on-error: true
|
2022-05-25 14:38:37 +03:00
|
|
|
with:
|
2022-09-19 19:12:19 +03:00
|
|
|
api-level: ${{ matrix.api-level }}
|
2022-05-25 14:38:37 +03:00
|
|
|
arch: x86
|
|
|
|
profile: Nexus 5X
|
2022-09-23 16:25:32 +03:00
|
|
|
target: playstore
|
2022-05-25 14:38:37 +03:00
|
|
|
force-avd-creation: false
|
|
|
|
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
|
|
|
|
disable-animations: true
|
2022-09-19 19:12:19 +03:00
|
|
|
# emulator-build: 7425822
|
2022-09-07 12:45:00 +03:00
|
|
|
script: |
|
2023-10-02 14:58:51 +03:00
|
|
|
./gradlew gatherGplayDebugStringTemplates $CI_GRADLE_ARG_PROPERTIES
|
2022-08-04 17:03:00 +03:00
|
|
|
./gradlew unitTestsWithCoverage $CI_GRADLE_ARG_PROPERTIES
|
|
|
|
./gradlew instrumentationTestsWithCoverage $CI_GRADLE_ARG_PROPERTIES
|
|
|
|
./gradlew generateCoverageReport $CI_GRADLE_ARG_PROPERTIES
|
2022-09-13 15:40:26 +03:00
|
|
|
# NB: continue-on-error marks steps.tests.conclusion = 'success' but leaves steps.tests.outcome = 'failure'
|
2022-09-13 15:42:39 +03:00
|
|
|
### - name: Run all the codecoverage tests at once (retry if emulator failed)
|
|
|
|
### uses: reactivecircus/android-emulator-runner@v2
|
|
|
|
### if: always() && steps.tests.outcome == 'failure' # don't run if previous step succeeded.
|
|
|
|
### with:
|
|
|
|
### api-level: 28
|
|
|
|
### arch: x86
|
|
|
|
### profile: Nexus 5X
|
|
|
|
### force-avd-creation: false
|
|
|
|
### emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
|
|
|
|
### disable-animations: true
|
|
|
|
### emulator-build: 7425822
|
|
|
|
### script: |
|
|
|
|
### ./gradlew gatherGplayDebugStringTemplates $CI_GRADLE_ARG_PROPERTIES
|
|
|
|
### ./gradlew unitTestsWithCoverage $CI_GRADLE_ARG_PROPERTIES
|
|
|
|
### ./gradlew instrumentationTestsWithCoverage $CI_GRADLE_ARG_PROPERTIES
|
|
|
|
### ./gradlew generateCoverageReport $CI_GRADLE_ARG_PROPERTIES
|
2022-09-07 12:45:00 +03:00
|
|
|
|
2022-09-19 19:36:01 +03:00
|
|
|
- name: Upload Integration Test Report Log
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
if: always()
|
|
|
|
with:
|
|
|
|
name: integration-test-error-results
|
|
|
|
path: |
|
|
|
|
*/build/outputs/androidTest-results/connected/
|
|
|
|
*/build/reports/androidTests/connected/
|
|
|
|
|
2022-09-07 12:45:00 +03:00
|
|
|
# we may have failed a previous step and retried, that's OK
|
|
|
|
- name: Publish results to Sonar
|
2022-09-07 13:15:12 +03:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.SONARQUBE_GITHUB_API_TOKEN }} # Needed to get PR information, if any
|
|
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
|
|
ORG_GRADLE_PROJECT_SONAR_LOGIN: ${{ secrets.SONAR_TOKEN }}
|
2022-09-07 13:14:03 +03:00
|
|
|
if: ${{ always() && env.GITHUB_TOKEN != '' && env.SONAR_TOKEN != '' && env.ORG_GRADLE_PROJECT_SONAR_LOGIN != '' }}
|
2023-03-03 18:40:23 +03:00
|
|
|
run: ./gradlew sonar $CI_GRADLE_ARG_PROPERTIES
|
2022-05-25 14:38:37 +03:00
|
|
|
|
2022-03-01 14:42:54 +03:00
|
|
|
- name: Format unit test results
|
|
|
|
if: always()
|
|
|
|
run: python3 ./tools/ci/render_test_output.py unit ./**/build/test-results/**/*.xml
|
2022-05-25 16:10:50 +03:00
|
|
|
|
|
|
|
# can't be run on macos due to containers.
|
2022-05-25 14:38:37 +03:00
|
|
|
# - name: Publish Unit Test Results
|
|
|
|
# uses: EnricoMi/publish-unit-test-result-action@v1
|
|
|
|
# if: always() &&
|
|
|
|
# github.event.sender.login != 'dependabot[bot]' &&
|
|
|
|
# ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository )
|
|
|
|
# with:
|
|
|
|
# files: ./**/build/test-results/**/*.xml
|
2022-03-10 19:41:00 +03:00
|
|
|
|
2022-05-25 16:10:50 +03:00
|
|
|
# Unneeded as part of the test suite above, kept around in case we want to re-enable them.
|
|
|
|
#
|
|
|
|
# # Build Android Tests
|
2022-11-24 11:46:11 +03:00
|
|
|
# build-android-tests:
|
|
|
|
# name: Build Android Tests
|
|
|
|
# runs-on: ubuntu-latest
|
2022-05-25 16:10:50 +03:00
|
|
|
# concurrency:
|
|
|
|
# group: ${{ github.ref == 'refs/heads/main' && format('unit-tests-main-{0}', github.sha) || github.ref == 'refs/heads/develop' && format('unit-tests-develop-{0}', github.sha) || format('build-android-tests-{0}', github.ref) }}
|
|
|
|
# cancel-in-progress: true
|
2022-11-24 11:46:11 +03:00
|
|
|
# steps:
|
2024-07-15 19:12:08 +03:00
|
|
|
# - uses: actions/checkout@v4
|
2024-10-25 11:29:16 +03:00
|
|
|
# - name: Use JDK 21
|
2024-07-15 19:12:08 +03:00
|
|
|
# uses: actions/setup-java@v4
|
2022-11-24 11:46:11 +03:00
|
|
|
# with:
|
2024-07-15 19:12:08 +03:00
|
|
|
# distribution: 'temurin' # See 'Supported distributions' for available options
|
2024-10-25 11:29:16 +03:00
|
|
|
# java-version: '21'
|
2023-01-19 14:20:16 +03:00
|
|
|
# - name: Configure gradle
|
2024-07-15 19:12:08 +03:00
|
|
|
# uses: gradle/actions/setup-gradle@v3
|
2022-11-24 11:46:11 +03:00
|
|
|
# with:
|
2023-01-19 14:20:16 +03:00
|
|
|
# cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
|
2022-11-24 11:46:11 +03:00
|
|
|
# - name: Build Android Tests
|
2022-08-04 17:03:00 +03:00
|
|
|
# run: ./gradlew clean assembleAndroidTest $CI_GRADLE_ARG_PROPERTIES
|
2022-05-25 16:10:50 +03:00
|
|
|
|