Repository navigation
102 lines (91 loc) · 3.91 KB
/
Copy pathvalidation.yml
File metadata and controls
102 lines (91 loc) · 3.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# Builds and tests the Kotlin ADK with Gradle on the supported JDKs.
name: validation
on:
pull_request:
branches:
- main
- 'release/**'
# A newer run for the same pull request supersedes this one.
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
# Read-only: no step in this workflow writes to the repository.
permissions:
contents: read
jobs:
build-modules:
runs-on: ubuntu-24.04
timeout-minutes: 30
strategy:
matrix:
java-version: ["17", "21", "25"]
steps:
- name: Checkout code
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
# Only local git commands run later; don't leave the token on disk.
persist-credentials: false
# JDK 21 is required by the litertlm/examples module toolchains (the
# upstream litert-lm artifacts are compiled for Java 21). The matrix JDK
# is used for the rest of the project; the last version listed becomes
# JAVA_HOME, so Gradle starts up on the matrix JDK.
- name: Set up JDK 21 and JDK ${{ matrix.java-version }}
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
with:
distribution: temurin
java-version: |
21
${{ matrix.java-version }}
# The `com.android.library` subprojects need an SDK to resolve
# compileSdk / minSdk. Installed explicitly to pin the components.
- name: Set up Android SDK
uses: android-actions/setup-android@be39fa834029ff78f1a44aa3bb0819b8fc2bd8fd # v4.0.4
with:
# Keep these in sync with the values in build.gradle.kts
# (androidCompileSdk / androidMinSdk).
packages: "platforms;android-37.0 build-tools;37.0.0"
- name: Cache Gradle packages
uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5.1.0
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ matrix.java-version }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', 'gradle/libs.versions.toml') }}
restore-keys: |
${{ runner.os }}-gradle-${{ matrix.java-version }}-
${{ runner.os }}-gradle-
- name: Build and test (Java ${{ matrix.java-version }})
env:
JDK_VERSION: ${{ matrix.java-version }}
FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }}
FIREBASE_API_KEY: ${{ secrets.FIREBASE_API_KEY }}
FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }}
FIREBASE_DISABLE_IT: ${{ vars.FIREBASE_DISABLE_IT }}
FIREBASE_MODEL_NAME: ${{ vars.FIREBASE_MODEL_NAME }}
run: |
./gradlew \
"-PjdkVersion=${JDK_VERSION}" \
"-Dorg.gradle.jvmargs=-Xmx6g -XX:MaxMetaspaceSize=2g" \
--no-daemon \
--stacktrace \
build
- name: Generate API docs (Dokka)
# Validates that KDoc `[references]` resolve. Run as a separate Gradle
# invocation from `build` so the two never run concurrently, capping
# peak memory at max(build, dokka) on the runner. Docs output is
# JDK-independent, so generate once. Keep the pinned JDK below in sync
# with the matrix's lowest entry so the step keeps running if
# the matrix changes. No FIREBASE_* env: dokkaGenerate reads none of it
# (the Firebase config is only consumed by tests and by assemble/install).
if: matrix.java-version == '17'
env:
JDK_VERSION: ${{ matrix.java-version }}
run: |
./gradlew \
"-PjdkVersion=${JDK_VERSION}" \
"-Dorg.gradle.jvmargs=-Xmx6g -XX:MaxMetaspaceSize=2g" \
--no-daemon \
--stacktrace \
dokkaGenerate
- name: Detect wrongly formatted files
run: git status && git diff --exit-code