Skip to content

Update google.dagger to v2.54 #110

Update google.dagger to v2.54

Update google.dagger to v2.54 #110

name: Build and test on push or pull request
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
name: Build
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
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 with Gradle Wrapper
env:
tmdbApiKey: ${{ secrets.TMDB_API_KEY }}
run: ./gradlew assembleDebug "-PtmdbApiKey=\"$tmdbApiKey\""
test:
name: Unit tests
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
- name: Run Debug Tests
env:
tmdbApiKey: ${{ secrets.TMDB_API_KEY }}
run: ./gradlew testDebugUnitTest --continue "-PtmdbApiKey=\"$tmdbApiKey\""
- name: Upload Test Reports
if: always()
uses: actions/upload-artifact@v4
with:
name: test-report
path: '**/build/reports/tests/'
# Mac Silicon does not work
# https://github:com/ReactiveCircus/android-emulator-runner/issues/350
# https://github.com/actions/runner-images/issues/9460
android-test:
name: UI tests
runs-on: ubuntu-latest
strategy:
matrix:
api-level: [24, 34]
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- 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: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-${{ matrix.api-level }}
- name: Create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
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: Run Android tests
uses: reactivecircus/android-emulator-runner@v2
env:
tmdbApiKey: ${{ secrets.TMDB_API_KEY }}
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: ./gradlew connectedAndroidTest "-PtmdbApiKey=\"$tmdbApiKey\""
- name: Upload Test Reports
if: always()
uses: actions/upload-artifact@v4
with:
name: android-test-report-${{ matrix.api-level }}
path: '**/build/reports/androidTests/connected/'
static-analysis:
name: Execute static analysis
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@0bdd871935719febd78681f197cd39af5b6e16a6 # v4.2.2
- name: Run detekt
env:
tmdbApiKey: ${{ secrets.TMDB_API_KEY }}
run: ./gradlew detekt "-PtmdbApiKey=\"$tmdbApiKey\""