|
|
|
name: Test
|
|
|
|
|
|
|
|
on:
|
|
|
|
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 --no-daemon
|
|
|
|
|
|
|
|
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:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Run tests and generate kover report
|
|
|
|
run: ./gradlew koverMergedReport $CI_GRADLE_ARG_PROPERTIES
|
|
|
|
|
|
|
|
- name: Archive kover report
|
|
|
|
if: always()
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: kover-results
|
|
|
|
path: |
|
|
|
|
**/build/reports/kover/merged
|
|
|
|
|
|
|
|
- name: Archive 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
|
|
|
|
env:
|
|
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
|
|
ORG_GRADLE_PROJECT_SONAR_LOGIN: ${{ secrets.SONAR_TOKEN }}
|
|
|
|
if: ${{ always() && env.SONAR_TOKEN != '' && env.ORG_GRADLE_PROJECT_SONAR_LOGIN != '' }}
|
|
|
|
run: ./gradlew sonar $CI_GRADLE_ARG_PROPERTIES
|
|
|
|
|
|
|
|
# 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
|