feat: [FC-0072] Static code analyzer (#403) #53
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
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: nschloe/action-cached-lfs-checkout@v1.2.1 | |
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 }} | |
- 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.6.1 | |
with: | |
cache-read-only: ${{ github.ref != 'refs/heads/develop' }} | |
- name: Generate mock files | |
run: ./gradlew generateMockedRawFile | |
- name: Run unit tests | |
run: ./gradlew testProdDebugUnitTest $CI_GRADLE_ARG_PROPERTIES | |
- name: Upload reports | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: failures | |
path: app/build/reports/ | |
retention-days: 5 |