Skip to content

Commit a47efae

Browse files
authored
Update dependencies and workflows, use gradle-managed device (#35)
* Update dependencies, use BOM for Compose * CI: update workflows, use gradle-managed device
1 parent f0964cb commit a47efae

File tree

8 files changed

+68
-87
lines changed

8 files changed

+68
-87
lines changed

.github/workflows/build-kdoc.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,30 @@ jobs:
77
name: Build and publish KDoc
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v2
11-
- uses: actions/setup-java@v2
10+
- uses: actions/checkout@v4
11+
- uses: actions/setup-java@v4
1212
with:
1313
distribution: temurin
1414
java-version: 17
15-
- uses: gradle/gradle-build-action@v2
15+
cache: gradle
16+
- uses: gradle/actions/setup-gradle@v3
1617

1718
- name: Build KDoc
1819
run: ./gradlew --no-daemon --no-configuration-cache cert4android:dokkaHtml
20+
1921
- name: Publish KDoc
2022
if: success()
21-
uses: crazy-max/ghaction-github-pages@v2
23+
uses: actions/upload-pages-artifact@v3
2224
with:
23-
target_branch: gh-pages
24-
build_dir: lib/build/dokka/html
25-
env:
26-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
path: lib/build/dokka/html
26+
27+
deploy:
28+
environment:
29+
name: github-pages
30+
url: ${{ steps.deployment.outputs.page_url }}
31+
runs-on: ubuntu-latest
32+
needs: build
33+
steps:
34+
- name: Deploy to GitHub Pages
35+
id: deployment
36+
uses: actions/deploy-pages@v4

.github/workflows/codeql.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ jobs:
2727

2828
steps:
2929
- name: Checkout repository
30-
uses: actions/checkout@v3
31-
- uses: actions/setup-java@v2
30+
uses: actions/checkout@v4
31+
- uses: actions/setup-java@v4
3232
with:
3333
distribution: temurin
3434
java-version: 17
3535
cache: gradle
36-
- uses: gradle/wrapper-validation-action@v1
36+
- uses: gradle/actions/setup-gradle@v3
3737

3838
# Initializes the CodeQL tools for scanning.
3939
- name: Initialize CodeQL
40-
uses: github/codeql-action/init@v2
40+
uses: github/codeql-action/init@v3
4141
with:
4242
languages: ${{ matrix.language }}
4343
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -56,6 +56,6 @@ jobs:
5656
run: ./gradlew --no-daemon cert4android:assemble
5757

5858
- name: Perform CodeQL Analysis
59-
uses: github/codeql-action/analyze@v2
59+
uses: github/codeql-action/analyze@v3
6060
with:
61-
category: "/language:${{matrix.language}}"
61+
category: "/language:${{matrix.language}}"

.github/workflows/test-dev.yml

Lines changed: 12 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,15 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- uses: actions/checkout@v2
13-
with:
14-
submodules: true
15-
- uses: actions/setup-java@v2
13+
- uses: actions/setup-java@v4
1614
with:
1715
distribution: temurin
1816
java-version: 17
19-
- uses: gradle/gradle-build-action@v2
17+
cache: gradle
18+
- uses: gradle/actions/setup-gradle@v3
2019

2120
- name: Check
2221
run: ./gradlew cert4android:check
23-
- name: Archive results
24-
uses: actions/upload-artifact@v2
25-
with:
26-
name: test-results
27-
path: |
28-
lib/build/outputs/lint*
29-
lib/build/reports
3022

3123
test_on_emulator:
3224
name: Tests with emulator
@@ -36,53 +28,24 @@ jobs:
3628
api-level: [ 31 ]
3729
steps:
3830
- uses: actions/checkout@v2
39-
with:
40-
submodules: true
41-
- uses: actions/setup-java@v2
31+
- uses: actions/setup-java@v4
4232
with:
4333
distribution: temurin
4434
java-version: 17
45-
- uses: gradle/gradle-build-action@v2
35+
cache: gradle
36+
- uses: gradle/actions/setup-gradle@v3
4637

4738
- name: Enable KVM group perms
4839
run: |
4940
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
5041
sudo udevadm control --reload-rules
5142
sudo udevadm trigger --name-match=kvm
5243
53-
- name: Cache AVD and APKs
54-
uses: actions/cache@v3
55-
id: avd-cache
56-
with:
57-
path: |
58-
~/.android/avd/*
59-
~/.android/adb*
60-
key: avd-${{ matrix.api-level }}
61-
62-
- name: Create AVD and generate snapshot for caching
63-
if: steps.avd-cache.outputs.cache-hit != 'true'
64-
uses: reactivecircus/android-emulator-runner@v2
65-
with:
66-
api-level: ${{ matrix.api-level }}
67-
arch: x86_64
68-
force-avd-creation: false
69-
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
70-
disable-animations: false
71-
script: echo "Generated AVD snapshot for caching."
72-
73-
- name: Run tests
74-
uses: reactivecircus/android-emulator-runner@v2
44+
- name: Cache AVD
45+
uses: actions/cache@v4
7546
with:
76-
api-level: ${{ matrix.api-level }}
77-
arch: x86_64
78-
force-avd-creation: false
79-
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
80-
disable-animations: true
81-
script: ./gradlew --no-daemon cert4android:connectedCheck
47+
path: ~/.config/.android/avd
48+
key: avd-${{ hashFiles('lib/build.gradle.kts') }} # gradle-managed devices are defined there
8249

83-
- name: Archive results
84-
uses: actions/upload-artifact@v2
85-
with:
86-
name: test-results
87-
path: |
88-
lib/build/reports
50+
- name: Run device tests
51+
run: ./gradlew --no-daemon virtualCheck

gradle/libs.versions.toml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[versions]
2-
agp = "8.2.2"
2+
agp = "8.3.1"
33
androidx-activityCompose = "1.8.2"
44
androidx-appcompat = "1.6.1"
55
androidx-core = "1.12.0"
@@ -8,19 +8,16 @@ androidx-test-core = "1.5.0"
88
androidx-test-runner = "1.5.2"
99
androidx-test-rules = "1.5.0"
1010
conscrypt = "2.5.2"
11-
compose-compiler = "1.5.8"
12-
compose-material = "1.6.0"
13-
compose-runtime = "1.6.0"
14-
compose-ui = "1.6.0"
11+
compose-bom = "2024.03.00"
12+
# https://developer.android.com/jetpack/androidx/releases/compose-kotlin
13+
compose-compiler = "1.5.11"
1514
dokka = "1.9.10"
1615
junit = "4.13.2"
17-
kotlin = "1.9.22"
18-
material = "1.11.0"
19-
mockk = "1.13.9"
16+
kotlin = "1.9.23"
17+
mockk = "1.13.10"
2018
okhttp3 = "4.12.0"
2119

2220
[libraries]
23-
android-material = { module = "com.google.android.material:material", version.ref = "material" }
2421
androidx-activityCompose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" }
2522
androidx-appcompat = { module = "androidx.appcompat:appcompat", version.ref = "androidx-appcompat" }
2623
androidx-core = { module = "androidx.core:core-ktx", version.ref = "androidx-core" }
@@ -30,20 +27,21 @@ androidx-lifecycle-viewmodel = { module = "androidx.lifecycle:lifecycle-viewmode
3027
androidx-test-core = { module = "androidx.test:core-ktx", version.ref = "androidx-test-core" }
3128
androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidx-test-runner" }
3229
androidx-test-rules = { module = "androidx.test:rules", version.ref = "androidx-test-rules" }
33-
compose-material = { module = "androidx.compose.material:material", version.ref = "compose-material" }
34-
compose-runtime-livedata = { module = "androidx.compose.runtime:runtime-livedata", version.ref = "compose-runtime" }
35-
compose-ui-base = { module = "androidx.compose.ui:ui", version.ref = "compose-ui" }
36-
compose-ui-graphics = { module = "androidx.compose.ui:ui-graphics", version.ref = "compose-ui" }
37-
compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose-ui" }
38-
compose-ui-toolingPreview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose-ui" }
30+
compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "compose-bom" }
31+
compose-material = { module = "androidx.compose.material:material" }
32+
compose-runtime-livedata = { module = "androidx.compose.runtime:runtime-livedata" }
33+
compose-ui-base = { module = "androidx.compose.ui:ui" }
34+
compose-ui-graphics = { module = "androidx.compose.ui:ui-graphics" }
35+
compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling" }
36+
compose-ui-toolingPreview = { module = "androidx.compose.ui:ui-tooling-preview" }
3937
conscrypt = { module = "org.conscrypt:conscrypt-android", version.ref = "conscrypt" }
4038
junit = { module = "junit:junit", version.ref = "junit" }
4139
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
42-
okttp3-mockwebserver = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "okhttp3" }
4340
mockk-android = { module = "io.mockk:mockk-android", version.ref = "mockk" }
41+
okttp3-mockwebserver = { module = "com.squareup.okhttp3:mockwebserver", version.ref = "okhttp3" }
4442

4543
[plugins]
4644
android-application = { id = "com.android.application", version.ref = "agp" }
4745
android-library = { id = "com.android.library", version.ref = "agp" }
4846
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
49-
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
47+
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Wed May 17 11:37:23 CEST 2023
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-all.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

lib/build.gradle.kts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ android {
1717
aarMetadata {
1818
minCompileSdk = 29
1919
}
20+
21+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2022
}
2123

2224
compileOptions {
@@ -39,8 +41,17 @@ android {
3941
disable += listOf("MissingTranslation", "ExtraTranslation")
4042
}
4143

42-
defaultConfig {
43-
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
44+
@Suppress("UnstableApiUsage")
45+
testOptions {
46+
managedDevices {
47+
localDevices {
48+
create("virtual") {
49+
device = "Pixel 3"
50+
apiLevel = 33
51+
systemImageSource = "aosp-atd"
52+
}
53+
}
54+
}
4455
}
4556

4657
testFixtures {
@@ -82,11 +93,11 @@ dependencies {
8293
implementation(libs.androidx.appcompat)
8394
implementation(libs.androidx.lifecycle.livedata)
8495
implementation(libs.androidx.lifecycle.viewmodel)
85-
implementation(libs.android.material)
8696
implementation(libs.conscrypt)
8797

8898
// Jetpack Compose
8999
implementation(libs.androidx.activityCompose)
100+
implementation(platform(libs.compose.bom))
90101
implementation(libs.compose.material)
91102
implementation(libs.compose.runtime.livedata)
92103
debugImplementation(libs.compose.ui.tooling)

sample-app/build.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ dependencies {
5252
implementation(libs.androidx.lifecycle.runtime)
5353

5454
implementation(libs.androidx.appcompat)
55-
implementation(libs.android.material)
5655

5756
implementation(libs.androidx.activityCompose)
5857
implementation(libs.compose.material)
@@ -62,4 +61,4 @@ dependencies {
6261
implementation(libs.compose.runtime.livedata)
6362

6463
implementation(project(":cert4android"))
65-
}
64+
}

sample-app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
android:label="@string/app_name"
1111
android:roundIcon="@mipmap/ic_launcher_round"
1212
android:supportsRtl="true"
13-
android:theme="@style/Theme.MaterialComponents.DayNight.NoActionBar"
13+
android:theme="@style/Theme.AppCompat.DayNight.NoActionBar"
1414
tools:targetApi="31">
1515

1616
<activity

0 commit comments

Comments
 (0)