Skip to content

Update gradle-updates #368

Update gradle-updates

Update gradle-updates #368

Workflow file for this run

name: ci
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
paths-ignore:
- '**.md'
jobs:
# Builds and checks .apk and .aar
assemble:
name: Assemble and check
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v3
- uses: actions/setup-java@v1
with:
java-version: 17
- name: Generate cache key
run: ./checksum.sh checksum.txt
- uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('checksum.txt') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Assemble and checks
run: ./gradlew spotlessCheck assemble apiCheck lintDebug --build-cache --no-daemon --stacktrace --scan
# Runs unit tests
unit-tests:
name: Unit tests
needs: assemble
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v3
- uses: actions/setup-java@v1
with:
java-version: 17
- name: Generate cache key
run: ./checksum.sh checksum.txt
- uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('checksum.txt') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Unit Tests with coverage
run: ./gradlew koverXmlReport --build-cache --no-daemon --stacktrace
- name: Zip test reports
run: zip -r reports.zip ./build/reports/kover/report.xml
- name: Upload test reports
if: always()
uses: actions/upload-artifact@v4
with:
name: unit-tests-reports
path: reports.zip
- name: Upload tests coverage
if: always()
uses: actions/upload-artifact@v4
with:
name: unit-tests-coverage
path: library/build/reports/kover
# Runs instrumentation tests
instrumentation-tests:
name: Instrumentation tests
needs: assemble
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
api-level:
# - 21 (comment for now: constant fails on emulator, locally - OK)
- 25
- 28
- 31
- 33
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v3
- uses: actions/setup-java@v1
with:
java-version: 17
- name: Enable KVM
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: Generate cache key
run: ./checksum.sh checksum.txt
- uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('checksum.txt') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Instrumentation Tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
script: ./gradlew connectedCheck mergeAndroidReports --build-cache --no-daemon --stacktrace
- name: Upload tests reports
if: always()
uses: actions/upload-artifact@v4
with:
name: 'android-tests-${{ matrix.api-level }}-reports'
path: build/androidTest-results
- name: Upload tests coverage
if: ${{ matrix.api-level == 25 }}
uses: actions/upload-artifact@v4
with:
name: 'android-tests-${{ matrix.api-level }}-coverage'
path: library/build/reports/coverage
# Runs screenshot tests
screenshot-tests:
name: Screenshot tests
needs: assemble
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: gradle/wrapper-validation-action@v3
- uses: actions/setup-java@v1
with:
java-version: 17
- name: Generate cache key
run: ./checksum.sh checksum.txt
- uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('checksum.txt') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Cache AVD snapshot
uses: actions/cache@v3
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-30-aosp-atd
- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
target: aosp_atd
api-level: 30
arch: x86
channel: canary
profile: pixel
avd-name: Pixel_3a_API_30_AOSP
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching"
- name: Screenshot Tests
uses: reactivecircus/android-emulator-runner@v2
with:
target: aosp_atd
api-level: 30
arch: x86
channel: canary
profile: pixel
avd-name: Pixel_3a_API_30_AOSP
script: ./gradlew :library:executeScreenshotTests --build-cache --no-daemon --stacktrace
- name: Upload tests reports
if: always()
uses: actions/upload-artifact@v4
with:
name: 'screenshot-tests-reports'
path: library/build/reports/shot
# Upload coverage
upload-coverage:
name: Upload coverage
needs: [unit-tests, instrumentation-tests]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- name: Download unit tests coverage
uses: actions/download-artifact@v4
with:
name: unit-tests-coverage
- name: Download android tests coverage
uses: actions/download-artifact@v4
with:
name: android-tests-25-coverage
- uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
directory: .