Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ubuntu-latest for Android Tests and enable KVM #399

Merged
merged 4 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/gradle-ci.properties
Original file line number Diff line number Diff line change
@@ -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
41 changes: 20 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -124,14 +134,20 @@ jobs:

android-tests:
name: Android Tests
runs-on: macos-latest
runs-on: ubuntu-latest
env:
USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strategy:
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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
21 changes: 1 addition & 20 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ allprojects {
}

tasks.withType<Detekt>().configureEach {
jvmTarget = "17"
jvmTarget = AppConfig.javaVersion.majorVersion
basePath = rootDir.absolutePath
reports {
xml.required = false
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down