|
|
|
|
name: Test
|
|
|
|
|
|
|
|
|
|
on:
|
|
|
|
|
workflow_dispatch:
|
|
|
|
|
pull_request: { }
|
|
|
|
|
push:
|
|
|
|
|
branches: [ main, develop ]
|
|
|
|
|
|
|
|
|
|
# Enrich gradle.properties for CI/CD
|
|
|
|
|
env:
|
|
|
|
|
GRADLE_OPTS: -Dorg.gradle.jvmargs="-Xmx3072m -Dfile.encoding=UTF-8 -XX:+HeapDumpOnOutOfMemoryError" -Dkotlin.daemon.jvm.options="-Xmx2560m" -Dkotlin.incremental=false
|
|
|
|
|
CI_GRADLE_ARG_PROPERTIES: --stacktrace -PpreDexEnable=false --max-workers 4 --warn
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
tests:
|
|
|
|
|
name: Runs unit tests
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
|
|
# Allow all jobs on main and develop. Just one per PR.
|
|
|
|
|
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('unit-tests-{0}', github.ref) }}
|
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
steps:
|
|
|
|
|
- name: β¬ Checkout with LFS
|
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
|
with:
|
|
|
|
|
# Ensure we are building the branch and not the branch after being merged on develop
|
|
|
|
|
# https://github.com/actions/checkout/issues/881
|
|
|
|
|
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}
|
|
|
|
|
lfs: 'true'
|
|
|
|
|
- name: βοΈ Use JDK 17
|
|
|
|
|
uses: actions/setup-java@v3
|
|
|
|
|
with:
|
|
|
|
|
distribution: 'temurin' # See 'Supported distributions' for available options
|
|
|
|
|
java-version: '17'
|
|
|
|
|
- name: Configure gradle
|
|
|
|
|
uses: gradle/gradle-build-action@v2.4.2
|
|
|
|
|
with:
|
|
|
|
|
cache-read-only: ${{ github.ref != 'refs/heads/develop' }}
|
|
|
|
|
|
|
|
|
|
- name: βοΈ Run unit & screenshot tests, generate kover report
|
|
|
|
|
run: ./gradlew koverMergedReport $CI_GRADLE_ARG_PROPERTIES -Pci-build=true
|
|
|
|
|
|
|
|
|
|
- name: π Verify coverage
|
|
|
|
|
run: ./gradlew koverMergedVerify $CI_GRADLE_ARG_PROPERTIES -Pci-build=true
|
|
|
|
|
|
|
|
|
|
- name: π« Upload kover failed coverage reports
|
|
|
|
|
if: failure()
|
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
|
with:
|
|
|
|
|
name: kover-error-report
|
|
|
|
|
path: |
|
|
|
|
|
**/kover/merged/verification/errors.txt
|
|
|
|
|
|
|
|
|
|
- name: πΈ Upload Screenshot test report
|
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
|
if: always()
|
|
|
|
|
with:
|
|
|
|
|
name: reports
|
|
|
|
|
path: tests/uitests/build/reports/tests/testDebugUnitTest/
|
|
|
|
|
retention-days: 5
|
|
|
|
|
|
|
|
|
|
- name: π« Upload Screenshot failure differences on error
|
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
|
if: failure()
|
|
|
|
|
with:
|
|
|
|
|
name: failures
|
|
|
|
|
path: tests/uitests/out/failures/
|
|
|
|
|
retention-days: 5
|
|
|
|
|
|
|
|
|
|
- name: β
Upload kover report (disabled)
|
|
|
|
|
if: always()
|
|
|
|
|
run: echo "This is now done only once a day, see nightlyReports.yml"
|
|
|
|
|
|
|
|
|
|
- name: π« Upload test results on error
|
|
|
|
|
if: failure()
|
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
|
with:
|
|
|
|
|
name: tests-and-screenshot-tests-results
|
|
|
|
|
path: |
|
|
|
|
|
**/out/failures/
|
|
|
|
|
**/build/reports/tests/*UnitTest/
|
|
|
|
|
|
|
|
|
|
- name: π Publish results to Sonar (disabled)
|
|
|
|
|
run: echo "This is now done only once a day, see nightlyReports.yml"
|
|
|
|
|
|
|
|
|
|
# https://github.com/codecov/codecov-action
|
|
|
|
|
- name: βοΈ Upload coverage reports to codecov
|
|
|
|
|
if: always()
|
|
|
|
|
uses: codecov/codecov-action@v3
|
|
|
|
|
# with:
|
|
|
|
|
# files: build/reports/kover/merged/xml/report.xml
|