forked from square/dagger
-
Notifications
You must be signed in to change notification settings - Fork 2k
242 lines (237 loc) · 7.84 KB
/
Copy pathci.yml
File metadata and controls
242 lines (237 loc) · 7.84 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
# Cancel in-progress jobs for the same workflow and branch except for the master branch.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
permissions:
contents: read
env:
USE_AGP_VERSION: '9.0.0'
USE_JAVA_DISTRIBUTION: 'zulu'
USE_JAVA_VERSION_FOR_BAZEL: '21'
USE_JAVA_VERSION_FOR_GRADLE: '21'
# The default Maven 3.9.0 has a regression so we manually install 3.8.7.
# https://issues.apache.org/jira/browse/MNG-7679
USE_MAVEN_VERSION: '3.8.7'
jobs:
validate-latest-dagger-version:
name: 'Validate Dagger version'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/prechecks
bazel-build:
name: 'Bazel build'
needs: validate-latest-dagger-version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/bazel-build
bazel-test:
name: 'Bazel tests'
needs: validate-latest-dagger-version
runs-on:
group: large-runner-group
labels: ubuntu-22.04-16core
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/bazel-test
gradle-build:
name: 'Gradle build'
runs-on:
group: large-runner-group
labels: ubuntu-22.04-16core
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/gradle-build
artifact-verification-tests:
name: 'Artifact verification tests'
needs: bazel-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/artifact-verification-tests
run-artifact-java-local-tests:
name: 'Artifact Java local tests (Java ${{ matrix.java }}, Kotlin ${{ matrix.kotlin }})'
needs: bazel-build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- java: '11'
kotlin: '2.3.21'
ksp: '2.3.7'
- java: '21'
kotlin: '2.3.21'
ksp: '2.3.7'
env:
USE_JAVA_VERSION_FOR_GRADLE: ${{ matrix.java }}
USE_KOTLIN_VERSION: ${{ matrix.kotlin }}
USE_KSP_VERSION: ${{ matrix.ksp }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/artifact-java-local-tests
artifact-java-local-tests:
name: 'Artifact Java local tests'
needs: run-artifact-java-local-tests
runs-on: ubuntu-latest
steps:
- run: echo "All Java local tests passed"
test-gradle-plugin:
name: 'Test Hilt Gradle plugin'
needs: bazel-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/test-gradle-plugin
run-artifact-android-local-tests:
name: 'Artifact Android local tests (AGP ${{ matrix.agp }}, Java ${{ matrix.java }}, Kotlin ${{ matrix.kotlin }})'
needs: bazel-build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- agp: '9.0.0'
java: '11'
kotlin: '2.3.21'
ksp: '2.3.7'
- agp: '9.0.0'
java: '21'
kotlin: '2.3.21'
ksp: '2.3.7'
env:
USE_AGP_VERSION: ${{ matrix.agp }}
USE_JAVA_VERSION_FOR_GRADLE: ${{ matrix.java }}
USE_KOTLIN_VERSION: ${{ matrix.kotlin }}
USE_KSP_VERSION: ${{ matrix.ksp }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/artifact-android-local-tests
artifact-android-local-tests:
name: 'Artifact Android local tests'
needs: run-artifact-android-local-tests
runs-on: ubuntu-latest
steps:
- run: echo "All Android local tests passed"
artifact-android-emulator-legacy-api-tests:
name: 'Artifact Android emulator tests (API ${{ matrix.api-level }})'
# We only run this on master push (essentially a postsubmit) since these
# can take a while to run
if: github.event_name == 'push' && github.repository == 'google/dagger' && github.ref == 'refs/heads/master'
needs: bazel-build
runs-on: ubuntu-latest
strategy:
matrix:
api-level: [23, 26, 30]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/artifact-android-emulator-tests
timeout-minutes: 35
with:
api-level: '${{ matrix.api-level }}'
publish-snapshot:
name: 'Publish snapshot'
# TODO(bcorso): Consider also waiting on artifact-android-emulator-tests
# and artifact-android-emulator-legacy-api-tests after checking flakiness.
needs: [
bazel-test,
artifact-verification-tests,
artifact-java-local-tests,
artifact-android-local-tests,
test-gradle-plugin
]
if: github.event_name == 'push' && github.repository == 'google/dagger' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: 'Install Java ${{ env.USE_JAVA_VERSION_FOR_BAZEL }}'
uses: actions/setup-java@v4
with:
distribution: '${{ env.USE_JAVA_DISTRIBUTION }}'
java-version: '${{ env.USE_JAVA_VERSION_FOR_BAZEL }}'
server-id: sonatype-central-snapshots
server-username: CI_DEPLOY_USERNAME
server-password: CI_DEPLOY_PASSWORD
- name: 'Check out repository'
uses: actions/checkout@v4
- name: 'Cache local Maven repository'
uses: actions/cache@v4
with:
path: |
~/.m2/repository
!~/.m2/repository/com/google/dagger
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: 'Cache Bazel files'
uses: actions/cache@v4
with:
path: ~/.cache/bazel_github # The bazel cache path set in .bazelrc.
key: ${{ runner.os }}-bazel-build-${{ github.sha }}
restore-keys: |
${{ runner.os }}-bazel-build-
- name: 'Cache Gradle files'
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: 'Publish latest docs'
run: ./util/generate-latest-docs.sh
shell: bash
env:
GH_TOKEN: ${{ github.token }}
- name: 'Publish latest snapshot'
run: |
util/deploy-all.sh \
"deploy:deploy-file" \
"HEAD-SNAPSHOT" \
"-DrepositoryId=sonatype-central-snapshots" \
"-Durl=https://central.sonatype.com/repository/maven-snapshots"
shell: bash
env:
CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
- name: 'Clean bazel cache'
run: rm -rf $(bazel info repository_cache)
shell: bash
build-gradle-plugin-latest-agp:
name: 'Build Hilt Gradle plugin against latest AGP version'
# We only run this on master push (essentially a postsubmit) since we
# don't want this job to prevent merges
if: github.event_name == 'push' && github.repository == 'google/dagger' && github.ref == 'refs/heads/master'
needs: bazel-build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build-gradle-plugin
with:
agp: '+'
cleanup-caches:
name: 'Clean up GitHub Action caches'
# TODO(bcorso): Consider also waiting on artifact-android-emulator-tests
# and artifact-android-emulator-legacy-api-tests after checking flakiness.
needs: [
bazel-test,
artifact-verification-tests,
artifact-java-local-tests,
artifact-android-local-tests,
test-gradle-plugin
]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cleanup-caches