Dependency inversion #1052
Workflow file for this run
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: CI | |
'on': | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
permissions: | |
contents: write | |
security-events: write | |
env: | |
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: zulu | |
java-version: '17' | |
- name: Create Google Services JSON | |
run: | | |
mkdir ${{ github.workspace }}/app/src/prod | |
echo $GOOGLE_SERVICES_JSON | base64 -di > ${{ github.workspace }}/app/src/prod/google-services.json | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
dependency-graph: generate-and-submit | |
build-scan-publish: true | |
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service" | |
build-scan-terms-of-use-agree: "yes" | |
- name: Build APK | |
run: ./gradlew :app:assembleProdDebug | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: packages | |
path: '**/build/libs' | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: zulu | |
java-version: '17' | |
- name: Create Google Services JSON | |
run: | | |
mkdir ${{ github.workspace }}/app/src/prod | |
echo $GOOGLE_SERVICES_JSON | base64 -di > ${{ github.workspace }}/app/src/prod/google-services.json | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
build-scan-publish: true | |
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service" | |
build-scan-terms-of-use-agree: "yes" | |
- name: Lint | |
run: ./gradlew lintProdDebug lintDemoDebug | |
- name: Uploading lint results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: lint-report | |
path: '**/build/reports/lint-results-*.*' | |
detekt: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: zulu | |
java-version: '17' | |
- name: Create Google Services JSON | |
run: | | |
mkdir ${{ github.workspace }}/app/src/prod | |
echo $GOOGLE_SERVICES_JSON | base64 -di > ${{ github.workspace }}/app/src/prod/google-services.json | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
build-scan-publish: true | |
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service" | |
build-scan-terms-of-use-agree: "yes" | |
- name: Detekt | |
run: ./gradlew detektProdDebug reportMerge --continue | |
- name: Uploading detekt results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: detekt-reports | |
path: | | |
**/detekt.html | |
**/reports/detekt-results.xml | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: zulu | |
java-version: '17' | |
- name: Create Google Services JSON | |
run: | | |
mkdir ${{ github.workspace }}/app/src/prod | |
echo $GOOGLE_SERVICES_JSON | base64 -di > ${{ github.workspace }}/app/src/prod/google-services.json | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
build-scan-publish: true | |
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service" | |
build-scan-terms-of-use-agree: "yes" | |
- name: Unit test and coverage | |
run: ./gradlew koverXmlReportProdDebug | |
- name: Uploading test results and coverage | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-reports-and-coverage | |
path: | | |
**/reports/tests/testProdDebugUnitTest/ | |
**/app/build/reports/coverage/coverage.xml | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
fail_ci_if_error: true | |
files: '**/app/build/reports/coverage/coverage.xml' | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
sonar: | |
runs-on: ubuntu-latest | |
needs: [build, lint, detekt, test] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: zulu | |
java-version: '17' | |
- name: Cache SonarQube Cloud packages | |
uses: actions/cache@v4 | |
with: | |
path: ~/.sonar/cache | |
key: ${{ runner.os }}-sonar | |
restore-keys: ${{ runner.os }}-sonar | |
- name: Create Google Services JSON | |
run: | | |
mkdir ${{ github.workspace }}/app/src/prod | |
echo $GOOGLE_SERVICES_JSON | base64 -di > ${{ github.workspace }}/app/src/prod/google-services.json | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
build-scan-publish: true | |
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service" | |
build-scan-terms-of-use-agree: "yes" | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
- name: Sonar analysis | |
run: ./gradlew sonar | |
android-test: | |
if: false | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- name: Enable KVM group perms | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: zulu | |
java-version: '17' | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v3.2.2 | |
- name: Create Google Services JSON | |
run: | | |
mkdir ${{ github.workspace }}/app/src/prod | |
echo $GOOGLE_SERVICES_JSON | base64 -d > ${{ github.workspace }}/app/src/prod/google-services.json | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
build-scan-publish: true | |
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service" | |
build-scan-terms-of-use-agree: "yes" | |
- name: Build project and run instrumentation tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: 30 | |
arch: x86_64 | |
target: aosp_atd | |
channel: canary | |
profile: pixel_2 | |
disable-animations: true | |
disk-size: 6000M | |
heap-size: 600M | |
script: ./gradlew connectedProdDebugAndroidTest --no-daemon --max-workers 2 | |
- name: Upload Android test reports | |
uses: actions/upload-artifact@v4 | |
with: | |
name: android-test-reports | |
path: '**/build/reports/androidTests' |