diff --git a/.github/gradle-ci.properties b/.github/gradle-ci.properties new file mode 100644 index 000000000..786abbfd3 --- /dev/null +++ b/.github/gradle-ci.properties @@ -0,0 +1,6 @@ +# +# Copyright (c) SRG SSR. All rights reserved. +# License information is available from the LICENSE file. +# +org.gradle.configuration-cache=false +org.gradle.daemon=false diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3e1a077f2..07599efb6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,6 +26,8 @@ jobs: with: java-version: '17' distribution: 'temurin' + - name: Copy CI gradle.properties + run: mkdir -p ~/.gradle; cp .github/gradle-ci.properties ~/.gradle/gradle.properties - name: Build project run: ./gradlew :pillarbox-demo:assembleProdDebug :pillarbox-demo-tv:assembleDebug @@ -44,6 +46,8 @@ jobs: distribution: 'temurin' - uses: gradle/wrapper-validation-action@v1 - uses: gradle/gradle-build-action@v2 + - name: Copy CI gradle.properties + run: mkdir -p ~/.gradle; cp .github/gradle-ci.properties ~/.gradle/gradle.properties - name: Run Android Lint run: ./gradlew :pillarbox-demo:lintProdDebug :pillarbox-demo-tv:lintDebug :pillarbox-player-testutils:lintDebug - uses: github/codeql-action/upload-sarif@v3 @@ -67,6 +71,8 @@ jobs: distribution: 'temurin' - uses: gradle/wrapper-validation-action@v1 - uses: gradle/gradle-build-action@v2 + - name: Copy CI gradle.properties + run: mkdir -p ~/.gradle; cp .github/gradle-ci.properties ~/.gradle/gradle.properties - name: Run Detekt run: ./gradlew detekt - uses: github/codeql-action/upload-sarif@v3 @@ -90,6 +96,8 @@ jobs: distribution: 'temurin' - uses: gradle/wrapper-validation-action@v1 - uses: gradle/gradle-build-action@v2 + - name: Copy CI gradle.properties + run: mkdir -p ~/.gradle; cp .github/gradle-ci.properties ~/.gradle/gradle.properties - name: Run Dependency Analysis run: ./gradlew buildHealth - name: Archive analysis report @@ -114,6 +122,8 @@ jobs: distribution: 'temurin' - uses: gradle/wrapper-validation-action@v1 - uses: gradle/gradle-build-action@v2 + - name: Copy CI gradle.properties + run: mkdir -p ~/.gradle; cp .github/gradle-ci.properties ~/.gradle/gradle.properties - name: Run Unit Tests run: > ./gradlew @@ -124,7 +134,7 @@ jobs: android-tests: name: Android Tests - runs-on: macos-latest + runs-on: ubuntu-latest env: USERNAME: ${{ github.actor }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -132,6 +142,12 @@ jobs: matrix: api-level: [ 26 ] steps: + - name: Enable KVM + # https://github.blog/changelog/2023-02-23-hardware-accelerated-android-virtualization-on-actions-windows-and-linux-larger-hosted-runners/ + 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 - uses: actions/checkout@v4 - name: Set up JDK 17 uses: actions/setup-java@v4 @@ -140,30 +156,13 @@ jobs: distribution: 'temurin' - uses: gradle/wrapper-validation-action@v1 - uses: gradle/gradle-build-action@v2 - - name: AVD cache - uses: actions/cache@v3 - 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 }} - force-avd-creation: false - emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none - disable-animations: false - script: echo "Created new AVD snapshot for caching" + - name: Copy CI gradle.properties + run: mkdir -p ~/.gradle; cp .github/gradle-ci.properties ~/.gradle/gradle.properties - name: Run Android Tests uses: reactivecircus/android-emulator-runner@v2 with: api-level: ${{ matrix.api-level }} - force-avd-creation: false - emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none - disable-animations: true + arch: x86_64 script: > ./gradlew :pillarbox-analytics:connectedDebugAndroidTest diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 7cd5bc533..1075cc53e 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -26,7 +26,7 @@ jobs: - id: should_run name: Check that the last commit was made in the last 24h if: ${{ github.event_name == 'schedule' }} - run: > + run: | new_commits=$(git log --since="24 hours ago" --oneline) if [[ -n "$new_commits" ]]; then echo "should_run=true" >> "$GITHUB_OUTPUT" diff --git a/build.gradle.kts b/build.gradle.kts index 5c95d36f1..15070ef51 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -40,7 +40,7 @@ allprojects { } tasks.withType().configureEach { - jvmTarget = "17" + jvmTarget = AppConfig.javaVersion.majorVersion basePath = rootDir.absolutePath reports { xml.required = false @@ -91,25 +91,6 @@ dependencyAnalysis { } } - project(":pillarbox-demo") { - onUnusedDependencies { - // These dependencies are actually used, but only through inline code: https://github.com/autonomousapps/dependency-analysis-gradle-plugin/issues/795 - exclude(libs.androidx.compose.animation.asProvider()) - exclude(libs.androidx.compose.animation.core) - exclude(libs.androidx.compose.foundation.asProvider()) - exclude(libs.androidx.compose.foundation.layout) - exclude(libs.androidx.compose.material.icons.core) - exclude(libs.androidx.compose.material.icons.extended) - exclude(libs.androidx.compose.runtime.asProvider()) - exclude(libs.androidx.compose.ui.asProvider()) - exclude(libs.androidx.compose.ui.geometry) - exclude(libs.androidx.compose.ui.graphics) - exclude(libs.androidx.compose.ui.text) - exclude(libs.androidx.compose.ui.tooling.preview) - exclude(libs.androidx.compose.ui.unit) - } - } - project(":pillarbox-player") { onUnusedDependencies { // These dependencies are not used directly, but automatically used by libs.androidx.media3.exoplayer diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2bdfaf961..d8e726c02 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -18,7 +18,7 @@ androidx-test-runner = "1.5.2" androidx-tv = "1.0.0-alpha10" coil = "2.5.0" comscore = "6.10.0" -dependency-analysis-gradle-plugin = "1.28.0" +dependency-analysis-gradle-plugin = "1.29.0" detekt = "1.23.4" guava = "31.1-android" junit = "4.13.2"