Build(deps): Bump androidxLifecycle from 2.8.6 to 2.8.7 #321
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: Build and Test | |
on: | |
pull_request: | |
concurrency: | |
group: build-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
validate-wrappers: true | |
- name: Cache Gradle and build outputs | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
build | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: ${{ runner.os }}-gradle- | |
checks: | |
needs: setup | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
check: [ build_logic, spotless, detekt ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Run ${{ matrix.check }} | |
run: | | |
if [ "${{ matrix.check }}" = "build_logic" ]; then | |
./gradlew check -p build-logic | |
elif [ "${{ matrix.check }}" = "spotless" ]; then | |
./gradlew spotlessCheck --no-configuration-cache | |
elif [ "${{ matrix.check }}" = "detekt" ]; then | |
./gradlew detekt | |
fi | |
- name: Upload Detekt Reports | |
if: ${{ matrix.check == 'detekt' && steps.run_check.outcome == 'success' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: detekt-reports | |
path: | | |
**/build/reports/detekt/detekt.md | |
- name: Fix formatting if verification failed | |
id: fix_formatting | |
if: ${{ matrix.check == 'spotless' && steps.run_check.outcome == 'success' && github.event_name == 'pull_request' }} | |
run: ./gradlew spotlessApply --no-configuration-cache | |
- name: Push new changes if available | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
if: steps.fix_formatting.outcome == 'success' | |
with: | |
disable_globbing: true | |
commit_message: "🤖 Updates Formatting" | |
dependency_guard: | |
needs: setup | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Check Dependency Guard | |
id: dependencyguard_verify | |
continue-on-error: true | |
run: ./gradlew dependencyGuard | |
- name: Prevent updating Dependency Guard baselines if this is a fork | |
id: checkfork_dependencyguard | |
continue-on-error: false | |
if: steps.dependencyguard_verify.outcome == 'failure' && github.event.pull_request.head.repo.full_name != github.repository | |
run: | | |
echo "::error::Dependency Guard failed, please update baselines with: ./gradlew dependencyGuardBaseline" && exit 1 | |
# Runs if previous job failed | |
- name: Generate new Dependency Guard baselines if verification failed and it's a PR | |
id: dependencyguard_baseline | |
if: steps.dependencyguard_verify.outcome == 'failure' && github.event_name == 'pull_request' | |
run: | | |
./gradlew dependencyGuardBaseline | |
- name: Push new Dependency Guard baselines if available | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
if: steps.dependencyguard_baseline.outcome == 'success' | |
with: | |
file_pattern: '**/dependencies/*.txt' | |
disable_globbing: true | |
commit_message: "🤖 Updates baselines for Dependency Guard" | |
screenshot_tests: | |
needs: setup | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Run screenshot tests | |
id: screenshotsverify | |
continue-on-error: true | |
run: ./gradlew verifyRoborazziDemoDebug | |
- name: Generate new screenshots if verification failed | |
id: screenshotsrecord | |
if: steps.screenshotsverify.outcome == 'failure' && github.event_name == 'pull_request' | |
run: ./gradlew recordRoborazziDemoDebug | |
- name: Push new screenshots if available | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
if: steps.screenshotsrecord.outcome == 'success' | |
with: | |
file_pattern: '*/*.png' | |
disable_globbing: true | |
commit_message: "🤖 Updates screenshots" | |
tests_and_lint: | |
needs: [ setup, screenshot_tests ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Run tests and lint | |
run: | | |
./gradlew testDemoDebug :lint:test :app:lintProdRelease :lint:lint | |
- name: Upload reports | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-and-lint-reports | |
path: | | |
**/build/reports/lint-results-*.html | |
**/build/test-results/test*UnitTest/**.xml | |
build: | |
needs: [ checks, dependency_guard, tests_and_lint, screenshot_tests ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Build APKs | |
run: ./gradlew :app:assemble :benchmarks:assemble | |
-x pixel6Api33ProdNonMinifiedReleaseAndroidTest | |
-x pixel6Api33DemoNonMinifiedReleaseAndroidTest | |
-x collectDemoNonMinifiedReleaseBaselineProfile | |
-x collectProdNonMinifiedReleaseBaselineProfile | |
- name: Check badging | |
id: badging_verify | |
continue-on-error: true | |
run: ./gradlew :app:checkProdReleaseBadging | |
- name: Prevent updating release badging if this is a fork | |
id: checkfork_badging | |
if: steps.badging_verify.outcome == 'failure' && github.event.pull_request.head.repo.full_name != github.repository | |
run: | | |
echo "::error::Release Badging failed, please update badging with: ./gradlew updateReleaseBadging" && exit 1 | |
# Runs if previous job failed | |
- name: Generate new release badging if verification failed and it's a PR | |
id: generate_badging | |
if: steps.badging_verify.outcome == 'failure' && github.event_name == 'pull_request' | |
run: | | |
./gradlew updateProdReleaseBadging | |
- name: Push new release badging if available | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
if: steps.generate_badging.outcome == 'success' | |
with: | |
file_pattern: 'app/prodRelease-badging.txt' | |
disable_globbing: true | |
commit_message: "🤖 Updates release badging" | |
- name: Upload APKs | |
uses: actions/upload-artifact@v4 | |
with: | |
name: APKs | |
path: '**/build/outputs/apk/**/*.apk' | |
- name: Slack Upload APK For Testing | |
uses: MeilCli/slack-upload-file@v4 | |
with: | |
slack_token: ${{ secrets.SLACK_TOKEN }} | |
channel_id: ${{ secrets.SLACK_DEBUG_CHANNEL }} | |
file_path: './app/build/outputs/apk/**/*.apk' | |
file_name: 'app-demo-debug.apk' | |
file_type: 'apk' | |
initial_comment: 'demo-debug APK' | |
androidTest: | |
runs-on: ubuntu-latest | |
timeout-minutes: 360 | |
strategy: | |
matrix: | |
api-level: [ 30 ] | |
steps: | |
- name: Delete unnecessary tools 🔧 | |
uses: jlumbroso/free-disk-space@v1.3.1 | |
with: | |
android: false # Don't remove Android tools | |
tool-cache: true # Remove image tool cache - rm -rf "$AGENT_TOOLSDIRECTORY" | |
dotnet: true # rm -rf /usr/share/dotnet | |
haskell: true # rm -rf /opt/ghc... | |
swap-storage: true # rm -f /mnt/swapfile (4GiB) | |
docker-images: false # Takes 16s, enable if needed in the future | |
large-packages: false # includes google-cloud-sdk and it's slow | |
- 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 | |
ls /dev/kvm | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Copy CI gradle.properties | |
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
validate-wrappers: true | |
- name: Build projects and run instrumentation tests | |
uses: reactivecircus/android-emulator-runner@v2 | |
with: | |
api-level: ${{ matrix.api-level }} | |
arch: x86_64 | |
disable-animations: true | |
disk-size: 6000M | |
heap-size: 600M | |
script: ./gradlew connectedDemoDebugAndroidTest --daemon | |
- name: Run local tests (including Roborazzi) for the combined coverage report (only API 30) | |
if: matrix.api-level == 30 | |
# There is no need to verify Roborazzi tests to generate coverage. | |
run: ./gradlew testDemoDebugUnitTest -Proborazzi.test.verify=false # Add Prod if we ever add JVM tests for prod | |
# Add `createProdDebugUnitTestCoverageReport` if we ever add JVM tests for prod | |
- name: Generate coverage reports for Debug variants (only API 30) | |
if: matrix.api-level == 30 | |
run: ./gradlew createDemoDebugCombinedCoverageReport | |
- name: Upload test reports | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-reports-${{ matrix.api-level }} | |
path: '**/build/reports/androidTests' | |
- name: Display local test coverage (only API 30) | |
if: matrix.api-level == 30 | |
id: jacoco | |
uses: madrapps/jacoco-report@v1.6.1 | |
with: | |
title: Combined test coverage report | |
min-coverage-overall: 40 | |
min-coverage-changed-files: 60 | |
paths: | | |
${{ github.workspace }}/**/build/reports/jacoco/**/*Report.xml | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload local coverage reports (XML + HTML) (only API 30) | |
if: matrix.api-level == 30 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: coverage-reports | |
if-no-files-found: error | |
compression-level: 1 | |
overwrite: false | |
path: '**/build/reports/jacoco/' | |
- name: Upload Test Report | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: true | |
verbose: true | |
files: ${{ github.workspace }}/**/build/reports/jacoco/**/*Report.xml | |
token: ${{ secrets.CODECOV_TOKEN }} |