Update dependency gradle to v8.11.1 #26087
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: | |
- main | |
pull_request: | |
schedule: | |
- cron: '0 8 * * *' | |
workflow_dispatch: | |
jobs: | |
build-cfg: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- id: set-matrix | |
run: | | |
if ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch') }} | |
then | |
MATRIX=' | |
{"sdk": "21"}, | |
{"sdk": "22"}, | |
{"sdk": "23"}, | |
{"sdk": "24"}, | |
{"sdk": "25"}, | |
{"sdk": "26"}, | |
{"sdk": "27"}, | |
{"sdk": "28"}, | |
{"sdk": "29"}, | |
{"sdk": "30"}, | |
{"sdk": "31"}, | |
{"sdk": "32"}, | |
{"sdk": "33"}, | |
{"sdk": "34"}, | |
{"sdk": "35"} | |
' | |
else | |
MATRIX=' | |
{"sdk": "21"}, | |
{"sdk": "35"} | |
' | |
fi | |
echo "matrix={\"include\":[${MATRIX//$'\n'/}]}" >> $GITHUB_OUTPUT | |
build-cfg-check: | |
needs: build-cfg | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check matrix configuration | |
run: | | |
matrix='${{ needs.build-cfg.outputs.matrix }}' | |
echo $matrix | |
echo $matrix | jq . | |
build: | |
needs: build-cfg | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ci-build-${{ github.event_name }}-${{ github.ref }}-${{ matrix.sdk }} | |
cancel-in-progress: true | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.build-cfg.outputs.matrix) }} | |
steps: | |
- name: Set ANDROID_USER_HOME | |
run: echo "ANDROID_USER_HOME=$HOME/.android" >> $GITHUB_ENV | |
- 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: Download emulator package | |
run: $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager emulator | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
# Use PAT if on a pull request from the main repo, in preparation for auto-committing fixes | |
# Otherwise use the default token | |
token: ${{ (matrix.sdk == '35' && github.event.pull_request.head.repo.full_name == github.repository && github.event_name == 'pull_request' && secrets.PAT) || github.token}} | |
- name: Copy ci-gradle.properties | |
run: | | |
mkdir -p ~/.gradle | |
cp .github/ci-gradle.properties ~/.gradle/gradle.properties | |
- name: Configure JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 21 | |
- name: Accept license | |
run: echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_SDK_ROOT/licenses/android-sdk-preview-license" | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Create CI robolectric.properties | |
run: | | |
robolectric_projects=($(find . -regex ".*/src/androidUnitTest/resources/com/alexvanyo/robolectric.properties" | grep -oP '\./(.*?)/')) | |
for project in "${robolectric_projects[@]}" | |
do | |
mkdir "$project"src/androidUnitTest/resources/com/alexvanyo/composelife | |
echo sdk=${{ matrix.sdk }} > "$project"src/androidUnitTest/resources/com/alexvanyo/composelife/robolectric.properties | |
done | |
- name: Run checks | |
id: check | |
run: ./gradlew check --stacktrace | |
- name: Auto-commit formatting changes | |
if: ${{ !cancelled() && matrix.sdk == '35' && steps.check.outcome == 'failure' && github.event.pull_request.head.repo.full_name == github.repository && github.event_name == 'pull_request' }} | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Fix formatting issues | |
push_options: --force-with-lease | |
- name: Update dependency guard baseline | |
if: ${{ !cancelled() && matrix.sdk == '35' && steps.check.outcome == 'failure' && github.event.pull_request.head.repo.full_name == github.repository && github.event_name == 'pull_request' }} | |
run: ./gradlew dependencyGuardBaseline | |
- name: Auto-commit dependency guard baseline changes | |
if: ${{ !cancelled() && matrix.sdk == '35' && steps.check.outcome == 'failure' && github.event.pull_request.head.repo.full_name == github.repository && github.event_name == 'pull_request' }} | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Auto update dependency guard baseline | |
push_options: --force-with-lease | |
- name: Update screenshots | |
if: ${{ !cancelled() && matrix.sdk == '35' && steps.check.outcome == 'failure' && github.event.pull_request.head.repo.full_name == github.repository && github.event_name == 'pull_request' }} | |
run: ./gradlew recordRoborazziDebug | |
- name: Auto-commit screenshot changes | |
if: ${{ !cancelled() && matrix.sdk == '35' && steps.check.outcome == 'failure' && github.event.pull_request.head.repo.full_name == github.repository && github.event_name == 'pull_request' }} | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Auto update screenshots | |
push_options: --force-with-lease | |
- name: Update badging | |
if: ${{ !cancelled() && matrix.sdk == '35' && steps.check.outcome == 'failure' && github.event.pull_request.head.repo.full_name == github.repository && github.event_name == 'pull_request' }} | |
run: ./gradlew updateReleaseBadging | |
- name: Auto-commit badging changes | |
if: ${{ !cancelled() && matrix.sdk == '35' && steps.check.outcome == 'failure' && github.event.pull_request.head.repo.full_name == github.repository && github.event_name == 'pull_request' }} | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Auto update badging | |
push_options: --force-with-lease | |
- name: Upload unit test results | |
if: ${{ !cancelled() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: unit-test-results-${{ matrix.sdk }} | |
path: '**/build/test-results/*Test/**.xml' | |
- name: Generate code coverage | |
run: ./gradlew jacocoUnitTestCoverageReport --stacktrace | |
- name: Upload code coverage to GitHub | |
uses: actions/upload-artifact@v4 | |
with: | |
name: unit-code-coverage-${{ matrix.sdk }} | |
path: build/reports/jacoco/**/*.xml | |
- name: Assemble | |
if: matrix.sdk == '35' | |
# Assemble with running benchmarks and generating baseline profile to ensure those compile | |
run: ./gradlew assemble -Pcom.alexvanyo.composelife.runBenchmarks=true -Pandroidx.baselineprofile.skipgeneration | |
- name: Upload APKs | |
if: matrix.sdk == '35' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: apks | |
path: "**/build/outputs/apk/**/*.apk" | |
codecov-unit-coverage-upload: | |
needs: [build, build-cfg] | |
if: always() | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.build-cfg.outputs.matrix) }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download code coverage from GitHub | |
uses: actions/download-artifact@v4 | |
with: | |
name: unit-code-coverage-${{ matrix.sdk }} | |
path: codecoverage | |
- name: List code coverage | |
run: ls -R codecoverage | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
directory: codecoverage | |
flags: unit,${{ matrix.sdk }} | |
codecov-unit-test-upload: | |
needs: [build, build-cfg] | |
if: always() | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.build-cfg.outputs.matrix) }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download test results from GitHub | |
uses: actions/download-artifact@v4 | |
with: | |
name: unit-test-results-${{ matrix.sdk }} | |
path: testresults | |
- id: test-result-files | |
run: | | |
echo -n "files=" >> $GITHUB_OUTPUT | |
find testresults -name "*.xml" | paste -s -d "," - >> $GITHUB_OUTPUT | |
- name: Upload test results to Codecov | |
uses: codecov/test-results-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
files: ${{ steps.test-result-files.outputs.files }} | |
flags: unit,${{ matrix.sdk }} | |
android-test-gmd-cfg: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- id: set-matrix | |
run: | | |
if ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch') }} | |
then | |
MATRIX=' | |
{"api-level": "21", "target": "aosp", "device": "nexus4"}, | |
{"api-level": "22", "target": "aosp", "device": "nexus4"}, | |
{"api-level": "23", "target": "aosp", "device": "nexus4"}, | |
{"api-level": "24", "target": "aosp", "device": "nexus4"}, | |
{"api-level": "25", "target": "aosp", "device": "nexus4"}, | |
{"api-level": "26", "target": "aosp", "device": "nexus4"}, | |
{"api-level": "27", "target": "aosp", "device": "pixel2"}, | |
{"api-level": "28", "target": "aosp", "device": "pixel2"}, | |
{"api-level": "28", "target": "wear", "device": "wearoslargeround"}, | |
{"api-level": "28", "target": "wear", "device": "wearossquare"}, | |
{"api-level": "29", "target": "aosp", "device": "pixel2"}, | |
{"api-level": "30", "target": "aosp", "device": "pixel3xl"}, | |
{"api-level": "30", "target": "aospatd", "device": "pixel2"}, | |
{"api-level": "30", "target": "wear", "device": "wearoslargeround"}, | |
{"api-level": "30", "target": "wear", "device": "wearossquare"}, | |
{"api-level": "31", "target": "aospatd", "device": "pixel2"}, | |
{"api-level": "32", "target": "aospatd", "device": "pixel6pro"}, | |
{"api-level": "32", "target": "aospatd", "device": "pixeltablet"}, | |
{"api-level": "32", "target": "desktop", "device": "mediumdesktop"}, | |
{"api-level": "33", "target": "aospatd", "device": "pixel6pro"}, | |
{"api-level": "33", "target": "aospatd", "device": "pixeltablet"}, | |
{"api-level": "33", "target": "wear", "device": "wearoslargeround"}, | |
{"api-level": "33", "target": "wear", "device": "wearossquare"}, | |
{"api-level": "34", "target": "aospatd", "device": "pixel6pro"}, | |
{"api-level": "34", "target": "aosptablet", "device": "pixeltablet"}, | |
{"api-level": "34", "target": "wear", "device": "wearoslargeround"}, | |
{"api-level": "34", "target": "wear", "device": "wearossquare"}, | |
{"api-level": "35", "target": "google", "device": "pixel6pro"}, | |
{"api-level": "35", "target": "googletablet", "device": "pixeltablet"} | |
' | |
else | |
MATRIX=' | |
{"api-level": "23", "target": "aosp", "device": "nexus4"}, | |
{"api-level": "34", "target": "aosp", "device": "pixel2"}, | |
{"api-level": "30", "target": "wear", "device": "wearoslargeround"} | |
' | |
fi | |
echo "matrix={\"include\":[${MATRIX//$'\n'/}]}" >> $GITHUB_OUTPUT | |
android-test-gmd-cfg-check: | |
needs: android-test-gmd-cfg | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check matrix configuration | |
run: | | |
matrix='${{ needs.android-test-gmd-cfg.outputs.matrix }}' | |
echo $matrix | |
echo $matrix | jq . | |
android-test-gmd: | |
needs: android-test-gmd-cfg | |
runs-on: ubuntu-latest | |
timeout-minutes: 120 | |
concurrency: | |
group: ci-android-test-gmd-${{ github.event_name }}-${{ github.ref }}-${{ matrix.device }}-${{ matrix.api-level }} | |
cancel-in-progress: true | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.android-test-gmd-cfg.outputs.matrix) }} | |
steps: | |
- name: Set ANDROID_USER_HOME | |
run: echo "ANDROID_USER_HOME=$HOME/.android" >> $GITHUB_ENV | |
- 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: Download emulator package | |
run: $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager emulator | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Copy ci-gradle.properties | |
run: | | |
mkdir -p ~/.gradle | |
cp .github/ci-gradle.properties ~/.gradle/gradle.properties | |
- name: Update gradle.properties with chosen device | |
run: | | |
echo "com.alexvanyo.composelife.enabledGradleManagedDevices=${{ matrix.target }}${{ matrix.device }}api${{ matrix.api-level }}" > ~/.gradle/gradle.properties | |
- name: Cache AVD | |
if: false | |
uses: actions/cache@v4 | |
id: avd-cache | |
with: | |
path: | | |
${{ env.ANDROID_USER_HOME }}/avd/gradle-managed/* | |
${{ env.ANDROID_USER_HOME }}/adb* | |
key: v5-${{ runner.os }}-gmd-${{ matrix.device }}-${{ matrix.api-level }}-${{ matrix.target }} | |
- name: Configure JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 21 | |
- name: Accept licenses | |
run: yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Run device checks | |
run: | | |
# run the tests, with one retry attempt | |
run_tests () { ./gradlew ${{ matrix.target }}${{ matrix.device }}api${{ matrix.api-level }}Check --no-parallel -Dorg.gradle.workers.max=1 --stacktrace; } | |
(echo "==== Attempt 1 ====" && run_tests) || (echo "==== Attempt 2 ====" && run_tests) || (echo "==== Both attempts failed ====" && exit 1) | |
- name: Upload device test results | |
if: ${{ !cancelled() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: device-test-results-${{ matrix.target }}-${{ matrix.device }}-${{ matrix.api-level }} | |
path: '**/build/outputs/androidTest-results/managedDevice/**/TEST*.xml' | |
- name: Generate coverage report | |
run: | | |
run_tests () { ./gradlew jacocoAndroidTestCoverageReport --stacktrace; } | |
(echo "==== Attempt 1 ====" && run_tests) || (echo "==== Attempt 2 ====" && run_tests) || (echo "==== Both attempts failed ====" && exit 1) | |
- name: Upload code coverage to GitHub | |
uses: actions/upload-artifact@v4 | |
with: | |
name: device-code-coverage-${{ matrix.target }}-${{ matrix.device }}-${{ matrix.api-level }} | |
path: build/reports/jacoco/**/*.xml | |
codecov-device-coverage-upload: | |
needs: [android-test-gmd, android-test-gmd-cfg] | |
if: always() | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.android-test-gmd-cfg.outputs.matrix) }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download code coverage from GitHub | |
uses: actions/download-artifact@v4 | |
with: | |
name: device-code-coverage-${{ matrix.target }}-${{ matrix.device }}-${{ matrix.api-level }} | |
path: codecoverage | |
- name: List code coverage | |
run: ls -R codecoverage | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v5 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
directory: codecoverage | |
flags: device,${{ matrix.target }}-${{ matrix.device }}-${{ matrix.api-level }} | |
codecov-device-test-upload: | |
needs: [android-test-gmd, android-test-gmd-cfg] | |
if: always() | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJson(needs.android-test-gmd-cfg.outputs.matrix) }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download test results from GitHub | |
uses: actions/download-artifact@v4 | |
with: | |
name: device-test-results-${{ matrix.target }}-${{ matrix.device }}-${{ matrix.api-level }} | |
path: testresults | |
- id: test-result-files | |
run: | | |
echo -n "files=" >> $GITHUB_OUTPUT | |
find testresults -name "*.xml" | paste -s -d "," - >> $GITHUB_OUTPUT | |
- name: Upload test results to Codecov | |
uses: codecov/test-results-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
files: ${{ steps.test-result-files.outputs.files }} | |
flags: device,${{ matrix.target }}-${{ matrix.device }}-${{ matrix.api-level }} |