-
Notifications
You must be signed in to change notification settings - Fork 21
459 lines (451 loc) · 15.2 KB
/
pr.yml
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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
on:
pull_request:
paths-ignore:
- 'CHANGELOG.md'
- 'CHANGELOG_PENDING.md'
push:
branches:
- main
tags:
- sdk/v*.*.*
paths-ignore:
- 'CHANGELOG.md'
- 'CHANGELOG_PENDING.md'
repository_dispatch:
types:
- run-acceptance-tests-command
# TODO[pulumi/java#10] protect jobs from crypto mining PR attacks
# before making the repo public.
env:
PULUMI_API: https://api.pulumi-staging.io
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
AWS_REGION: us-west-2
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GOOGLE_CI_SERVICE_ACCOUNT_EMAIL: [email protected]
GOOGLE_CI_WORKLOAD_IDENTITY_POOL: pulumi-ci
GOOGLE_CI_WORKLOAD_IDENTITY_PROVIDER: pulumi-ci
GOOGLE_PROJECT_NUMBER: 895284651812
GOLANGCI_LINT_VERSION: v1.60.3
jobs:
prerequisites:
runs-on: ubuntu-latest
timeout-minutes: 15
outputs:
gotcloudcreds: ${{ steps.gotcloudcreds.outputs.gotcloudcreds }}
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Fetch Tags
run: git fetch --quiet --prune --unshallow --tags
- name: Install Pulumi CLI
uses: pulumi/actions@v6
with:
pulumi-version: latest
- name: Install pulumictl
uses: jaxxstorm/[email protected]
with:
repo: pulumi/pulumictl
tag: v0.0.31
cache: enable
- run: ./scripts/versions.sh | tee versions.txt
- name: Setup versioning env vars
run: cat versions.txt | tee $GITHUB_ENV
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: 'gradle'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@8d49e559aae34d3e0eb16cde532684bc9702762b
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: stable
- name: Configure Go cache
id: go-cache-paths
run: |
echo "go-build=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
echo "go-mod=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT"
- name: Set up Go cache
uses: actions/cache@v3
id: go-cache
with:
path: |
${{ steps.go-cache-paths.outputs.go-build }}
${{ steps.go-cache-paths.outputs.go-mod }}
key: go-cache-${{ hashFiles('**/go.sum') }}
- name: Build and unit-test Pulumi Java SDK
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
with:
arguments: build
build-root-directory: sdk/java
- run: make build_go
- run: make bin/pulumi-java-gen
- run: make bin/pulumi-language-java
- uses: actions/upload-artifact@v4
with:
name: versions.txt
path: versions.txt
- uses: actions/upload-artifact@v4
with:
name: go-binaries
path: bin/
- name: Publish Pulumi Java SDK to Maven Local
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
with:
arguments: publishToMavenLocal
build-root-directory: sdk/java
- uses: actions/upload-artifact@v4
with:
name: java-sdk
path: ~/.m2/repository/com/pulumi
- name: Check whether cloud creds for test envs are available
id: gotcloudcreds
env:
KEY: ${{ secrets.AWS_ACCESS_KEY_ID }}
run: |
echo "Enable testing against cloud environments: ${{ env.KEY != '' }}"
echo "gotcloudcreds=${{ env.KEY != '' }}" >> "$GITHUB_OUTPUT"
strategy:
fail-fast: true
# Run Go tests, most notably codegen tests. These are in a separate
# job not to block other validations.
go-tests:
runs-on: ubuntu-latest
needs: prerequisites
timeout-minutes: 30
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Pulumi CLI
uses: pulumi/actions@v6
with:
pulumi-version: latest
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: 'gradle'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@8d49e559aae34d3e0eb16cde532684bc9702762b
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: stable
- name: Download go-binaries
uses: actions/download-artifact@v4
with:
name: go-binaries
path: ~/bin
- name: Activate go-binaries
run: |
chmod a+x ~/bin/pulumi-language-java
chmod a+x ~/bin/pulumi-java-gen
- name: Download versions.txt
uses: actions/download-artifact@v4
with:
name: versions.txt
path: artifacts
- name: Setup versioning env vars
run: cat artifacts/versions.txt | tee $GITHUB_ENV
- name: Publish Pulumi Java SDK to Maven Local to enable codegen tests
uses: gradle/gradle-build-action@749f47bda3e44aa060e82d7b3ef7e40d953bd629
env:
# Override to match gen_test.go
PULUMI_JAVA_SDK_VERSION: 0.0.1
with:
arguments: publishToMavenLocal
build-root-directory: sdk/java
- name: Configure Go cache
id: go-cache-paths
run: |
echo "go-build=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
echo "go-mod=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT"
- name: Set up Go cache
uses: actions/cache@v3
id: go-cache
with:
path: |
${{ steps.go-cache-paths.outputs.go-build }}
${{ steps.go-cache-paths.outputs.go-mod }}
key: go-cache-test-go-${{ hashFiles('**/go.sum') }}
- name: Download Java SDK
uses: actions/download-artifact@v4
with:
name: java-sdk
path: ~/.m2/repository/com/pulumi
- run: cd pkg && go test -timeout 25m ./...
examples:
runs-on: ubuntu-latest
needs: prerequisites
if: needs.prerequisites.outputs.gotcloudcreds == 'true'
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
example:
- aws-java-eks-minimal
- aws-java-webserver
- aws-native-java-s3-folder
- azure-java-appservice-sql
- azure-java-static-website
- gcp-java-gke-hello-world
- kubernetes
- minimal
- minimalsbt
- random
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Pulumi CLI
uses: pulumi/actions@v6
with:
pulumi-version: latest
- run: make clone_examples
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@8d49e559aae34d3e0eb16cde532684bc9702762b
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: stable
- name: Configure Go cache
id: go-cache-paths
run: |
echo "go-build=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
echo "go-mod=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT"
- name: Set up Go cache
uses: actions/cache@v3
id: go-cache
with:
path: |
${{ steps.go-cache-paths.outputs.go-build }}
${{ steps.go-cache-paths.outputs.go-mod }}
key: go-cache-examples-${{ hashFiles('**/go.sum') }}
- name: Install Pulumi CLI
uses: pulumi/actions@v6
- name: Download versions.txt
uses: actions/download-artifact@v4
with:
name: versions.txt
path: artifacts
- name: Setup versioning env vars
run: cat artifacts/versions.txt | tee $GITHUB_ENV
- name: Download Java SDK
uses: actions/download-artifact@v4
with:
name: java-sdk
path: ~/.m2/repository/com/pulumi
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-region: ${{ env.AWS_REGION }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-duration-seconds: 3600
role-session-name: ${{ env.PROVIDER }}@githubActions
role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }}
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
with:
workload_identity_provider: projects/${{ env.GOOGLE_PROJECT_NUMBER
}}/locations/global/workloadIdentityPools/${{
env.GOOGLE_CI_WORKLOAD_IDENTITY_POOL }}/providers/${{
env.GOOGLE_CI_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ env.GOOGLE_CI_SERVICE_ACCOUNT_EMAIL }}
- name: Setup gcloud auth
uses: google-github-actions/setup-gcloud@v2
with:
install_components: gke-gcloud-auth-plugin
- name: Run ${{ matrix.example }} example
env:
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }}
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
run: make test_example.${{ matrix.example }}
go-lint:
runs-on: ubuntu-latest
timeout-minutes: 10
name: Lint pkg
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
ref: ${{ env.PR_COMMIT_SHA }}
submodules: recursive
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: stable
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
working-directory: pkg
args: --config ../.golangci.yml ./...
- name: Ensure no pulumi/pkg
run: make lint_pkg_dependencies
test_integrations:
runs-on: ubuntu-latest
needs: prerequisites
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
integration:
- stack-reference
- stack-transformation
- adopt-into-component
- rename
- rename-component
- rename-component-and-child
- retype-component
- retype-parents
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Pulumi CLI
uses: pulumi/actions@v6
with:
pulumi-version: latest
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: 'gradle'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@8d49e559aae34d3e0eb16cde532684bc9702762b
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: stable
- name: Configure Go cache
id: go-cache-paths
run: |
echo "go-build=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
echo "go-mod=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT"
- name: Set up Go cache
uses: actions/cache@v3
id: go-cache
with:
path: |
${{ steps.go-cache-paths.outputs.go-build }}
${{ steps.go-cache-paths.outputs.go-mod }}
key: go-cache-integrations-${{ hashFiles('**/go.sum') }}
- name: Install Pulumi CLI
uses: pulumi/action-install-pulumi-cli@v2
- name: Download versions.txt
uses: actions/download-artifact@v4
with:
name: versions.txt
path: artifacts
- name: Setup versioning env vars
run: cat artifacts/versions.txt | tee $GITHUB_ENV
- name: Download Java SDK
uses: actions/download-artifact@v4
with:
name: java-sdk
path: ~/.m2/repository/com/pulumi
- name: Run ${{ matrix.integration }} integration
env:
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
run: make test_integration.${{ matrix.integration }}
test_templates:
runs-on: ubuntu-latest
needs: prerequisites
if: needs.prerequisites.outputs.gotcloudcreds == 'true'
timeout-minutes: 30
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Pulumi CLI
uses: pulumi/actions@v6
with:
pulumi-version: latest
- run: make clone_templates
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: 'gradle'
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: stable
- name: Configure Go cache
id: go-cache-paths
run: |
echo "go-build=$(go env GOCACHE)" >> "$GITHUB_OUTPUT"
echo "go-mod=$(go env GOMODCACHE)" >> "$GITHUB_OUTPUT"
- name: Set up Go cache
uses: actions/cache@v3
id: go-cache
with:
path: |
${{ steps.go-cache-paths.outputs.go-build }}
${{ steps.go-cache-paths.outputs.go-mod }}
key: go-cache-templates-${{ hashFiles('**/go.sum') }}
- name: Download versions.txt
uses: actions/download-artifact@v4
with:
name: versions.txt
path: artifacts
- name: Setup versioning env vars
run: cat artifacts/versions.txt | tee $GITHUB_ENV
- name: Download Java SDK
uses: actions/download-artifact@v4
with:
name: java-sdk
path: ~/.m2/repository/com/pulumi
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-region: ${{ env.AWS_REGION }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-duration-seconds: 3600
role-session-name: ${{ env.PROVIDER }}@githubActions
role-to-assume: ${{ secrets.AWS_CI_ROLE_ARN }}
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
with:
workload_identity_provider: projects/${{ env.GOOGLE_PROJECT_NUMBER
}}/locations/global/workloadIdentityPools/${{
env.GOOGLE_CI_WORKLOAD_IDENTITY_POOL }}/providers/${{
env.GOOGLE_CI_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ env.GOOGLE_CI_SERVICE_ACCOUNT_EMAIL }}
- name: Setup gcloud auth
uses: google-github-actions/setup-gcloud@v2
with:
install_components: gke-gcloud-auth-plugin
- env:
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }}
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
run: make test_templates