Task: Update dependencies #165
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: | |
pull_request: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
checks: | |
name: Checking manifest and deps | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
env: | |
TERM: dumb | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17.0.6 | |
- name: Copy CI gradle.properties | |
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties | |
- name: Validate gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
## This is needed by secrets-gradle-plugin | |
- name: Create Local Properties File | |
run: touch local.properties | |
## Actual task | |
- name: Check merged manifests | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: copyMergedManifests | |
- uses: UnicornGlobal/has-changes-action@ea00e6f831a9e785271645729fa251907b314707 | |
id: merged_manifests | |
- name: Check if there are changes | |
if: steps.merged_manifests.outputs.changed == 1 | |
run: | | |
echo '::error::Uncommitted changes to the merged manifests!' | |
git diff | |
exit 1 | |
- name: Check compile dependencies report | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: generateRuntimeDependenciesReport | |
- uses: UnicornGlobal/has-changes-action@ea00e6f831a9e785271645729fa251907b314707 | |
id: compile_dependencies_report | |
- name: Check if there are changes | |
if: steps.compile_dependencies_report.outputs.changed == 1 | |
run: | | |
echo '::error::Uncommitted changes to the compile dependencies report!' | |
exit 1 | |
build-release: | |
name: Build release | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
env: | |
TERM: dumb | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17.0.6 | |
- name: Copy CI gradle.properties | |
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties | |
- name: Validate gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
## This is needed by secrets-gradle-plugin | |
- name: Create Local Properties File | |
run: touch local.properties | |
- name: Decrypt secrets | |
run: ./release/decrypt-secrets.sh | |
env: | |
ENCRYPT_KEY: ${{ secrets.ENCRYPT_KEY }} | |
## Actual task | |
- name: Build | |
uses: gradle/gradle-build-action@v2 | |
env: | |
ORG_GRADLE_PROJECT_RELEASE_KEYSTORE_PWD: ${{ secrets.RELEASE_KEYSTORE_PWD }} | |
with: | |
arguments: bundleRelease # analyzeReleaseBundle <- Disable due to https://github.com/spotify/ruler/issues/116 | |
- name: Clean secrets | |
if: always() | |
run: ./release/clean-secrets.sh | |
# Disable due to https://github.com/spotify/ruler/issues/116 | |
# - name: Upload Ruler report | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: ruler | |
# path: app/build/reports/ruler | |
build-debug: | |
name: Build debug | |
runs-on: ubuntu-latest | |
timeout-minutes: 40 | |
env: | |
TERM: dumb | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17.0.6 | |
- name: Copy CI gradle.properties | |
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties | |
- name: Validate gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
## This is needed by secrets-gradle-plugin | |
- name: Create Local Properties File | |
run: touch local.properties | |
## Actual tasks | |
- name: Build | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: assembleDebug -PsaveBuildLogToFile=true | |
- name: Archiving violations report | |
if: ${{ always() && github.event_name == 'pull_request' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: violations-build-debug | |
path: ./**/build/logs/buildlog*.txt | |
detekt: | |
name: Detekt | |
runs-on: ubuntu-latest | |
timeout-minutes: 40 | |
env: | |
TERM: dumb | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17.0.6 | |
- name: Copy CI gradle.properties | |
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties | |
- name: Validate gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
## This is needed by secrets-gradle-plugin | |
- name: Create Local Properties File | |
run: touch local.properties | |
## Actual tasks | |
- name: Detekt | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: detektMain detektTest | |
- name: Archiving violations report | |
if: ${{ always() && github.event_name == 'pull_request' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: violations-detekt | |
path: ./**/reports/detekt/*.xml | |
spotless: | |
name: Spotless | |
runs-on: ubuntu-latest | |
timeout-minutes: 40 | |
env: | |
TERM: dumb | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17.0.6 | |
- name: Copy CI gradle.properties | |
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties | |
- name: Validate gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
## This is needed by secrets-gradle-plugin | |
- name: Create Local Properties File | |
run: touch local.properties | |
## Actual tasks | |
- name: Spotless | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: spotlessCheck | |
android-lint: | |
name: Android Lint | |
runs-on: ubuntu-latest | |
timeout-minutes: 40 | |
env: | |
TERM: dumb | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17.0.6 | |
- name: Copy CI gradle.properties | |
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties | |
- name: Validate gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
## This is needed by secrets-gradle-plugin | |
- name: Create Local Properties File | |
run: touch local.properties | |
## Actual tasks | |
- name: Lint | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: lint | |
- name: Upload Lint results | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: android-lint-html-report | |
path: ./**/build/reports/lint-results-*.html | |
- name: Archiving violations report | |
if: ${{ always() && github.event_name == 'pull_request' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: violations-android-lint | |
path: ./**/reports/lint-results*.xml | |
unit-tests: | |
name: Unit tests | |
runs-on: ubuntu-latest | |
timeout-minutes: 40 | |
env: | |
TERM: dumb | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17.0.6 | |
- name: Copy CI gradle.properties | |
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties | |
- name: Validate gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
## This is needed by secrets-gradle-plugin | |
- name: Create Local Properties File | |
run: touch local.properties | |
## Actual tasks | |
- name: Unit tests | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: testDebugUnitTest | |
- name: Archiving violations report | |
if: ${{ always() && github.event_name == 'pull_request' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: violations-unit-tests | |
path: ./**/build/test-results/test*/*.xml | |
espresso-tests: | |
name: Espresso tests | |
# Android emulators require hardware acceleration (HAXM on Mac & Windows, QEMU on Linux) from the host to run fast. | |
# The macOS VM provided by GitHub Actions is the only one that currently supports it. | |
runs-on: macos-latest | |
timeout-minutes: 45 | |
env: | |
JAVA_TOOL_OPTIONS: -Xmx4g | |
TERM: dumb | |
strategy: | |
# Allow tests to continue on other devices if they fail on one device. | |
fail-fast: false | |
matrix: | |
api-level: [24, 30] | |
target: [google_apis] | |
arch: [x86_64] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17.0.6 | |
- name: Copy CI gradle.properties | |
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties | |
- name: Validate gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
## This is needed by secrets-gradle-plugin | |
- name: Create Local Properties File | |
run: touch local.properties | |
- name: AVD cache | |
uses: actions/cache@v2 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
~/.android/debug.keystore | |
key: avd-${{ matrix.api-level }}-${{ matrix.arch }}-${{ matrix.target }} | |
- name: Assemble Android tests | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: assembleAndroidTest | |
- name: Run emulator to generate snapshot for caching | |
if: steps.avd-cache.outputs.cache-hit != 'true' | |
uses: reactivecircus/android-emulator-runner@v2.28.0 | |
with: | |
api-level: ${{ matrix.api-level }} | |
target: ${{ matrix.target }} | |
arch: ${{ matrix.arch }} | |
profile: Galaxy Nexus | |
cores: 2 | |
sdcard-path-or-size: 100M | |
avd-name: api${{ matrix.api-level }}-${{ matrix.arch }}-${{ matrix.target }} | |
force-avd-creation: false | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: false | |
channel: stable | |
script: echo "Generated AVD snapshot for caching." | |
## Actual task | |
- name: Run Android tests on API ${{ matrix.api-level }} / ${{ matrix.arch }} / ${{ matrix.target }} | |
uses: reactivecircus/android-emulator-runner@v2.28.0 | |
with: | |
api-level: ${{ matrix.api-level }} | |
target: ${{ matrix.target }} | |
arch: ${{ matrix.arch }} | |
profile: Galaxy Nexus | |
cores: 2 | |
ram-size: 2048M | |
sdcard-path-or-size: 100M | |
avd-name: api${{ matrix.api-level }}-${{ matrix.arch }}-${{ matrix.target }} | |
force-avd-creation: false | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
channel: stable | |
script: | | |
echo $GITHUB_REPOSITORY | |
adb devices | |
./gradlew app:connectedCheck | |
- name: Make file path compatible with upload-artifact | |
run: find . -path '*/build/*' -name '*:*' -exec bash -c 'mv "$0" "${0//:/_}"' {} \; | |
- name: Upload results | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: instrumentation-test-results-${{ matrix.api-level }}-${{ matrix.arch }}-${{ matrix.target }} | |
path: | | |
**/build/reports/* | |
**/build/outputs/*/connected/* | |
publishing-violation: | |
name: Publishing violations to PR | |
if: ${{ always() && github.event_name == 'pull_request' }} | |
runs-on: ubuntu-latest | |
needs: [build-debug, detekt, android-lint, unit-tests] | |
timeout-minutes: 40 | |
env: | |
TERM: dumb | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 17.0.6 | |
- name: Copy CI gradle.properties | |
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties | |
- name: Validate gradle wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
## This is needed by secrets-gradle-plugin | |
- name: Create Local Properties File | |
run: touch local.properties | |
- name: Fetching build-debug result | |
uses: actions/download-artifact@v3 | |
with: | |
name: violations-build-debug | |
- name: Fetching detekt result | |
uses: actions/download-artifact@v3 | |
with: | |
name: violations-detekt | |
- name: Fetching android-lint result | |
uses: actions/download-artifact@v3 | |
with: | |
name: violations-android-lint | |
- name: Fetching unit-tests result | |
uses: actions/download-artifact@v3 | |
with: | |
name: violations-unit-tests | |
## Actual tasks | |
- name: Publishing violation comments to PR | |
if: ${{ always() && github.event_name == 'pull_request' }} | |
uses: gradle/gradle-build-action@v2 | |
with: | |
cache-read-only: true | |
arguments: violationCommentsToGitHub -DGITHUB_PULLREQUESTID=${{ github.event.number }} -DGITHUB_OAUTH2TOKEN=${{ secrets.GITHUB_TOKEN }} --info |