generated from pulumi/pulumi-provider-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 7
242 lines (237 loc) · 7.97 KB
/
run-acceptance-tests.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
name: Build and run tests
on:
push:
branches:
- main
tags-ignore:
- v*
- sdk/*
- '**'
pull_request:
branches:
- main
paths_ignore:
- CHANGELOG.md
repository_dispatch:
types:
- run-acceptance-tests-command
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
PULUMI_BACKEND_URL: https://api.pulumi-staging.io
# Required to properly write "go mod edit -replace=.." when running go examples
PULUMI_GO_DEP_ROOT: ${{ github.workspace }}/..
PROVIDER: pulumiservice
# Need to pin this as 0.8.0 until codegen is updated
PULUMI_JAVA_SDK_VERSION: 0.8.0
# Lookup nuget packages from this directory as well as default nuget directories
PULUMI_LOCAL_NUGET: ${{ github.workspace }}/nuget
PULUMI_TEST_OWNER: service-provider-test-org
PULUMI_TEST_USE_SERVICE: true
jobs:
build_sdks:
if: github.event_name == 'repository_dispatch' || github.event.pull_request.head.repo.full_name == github.repository
name: build_sdks
runs-on: ubuntu-latest
needs: prerequisites
strategy:
fail-fast: true
matrix:
dotnetversion: [ 3.1.301 ]
goversion: [ 1.19.x ]
language: [ nodejs, python, dotnet, go, java ]
nodeversion: [ 14.x ]
pythonversion: [ 3.7 ]
javaversion: [ 11 ]
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Checkout Scripts Repo
uses: actions/checkout@v3
with:
path: ci-scripts
repository: pulumi/scripts
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.goversion }}
cache-dependency-path: sdk/go.sum
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{matrix.nodeversion}}
registry-url: https://registry.npmjs.org
- name: Setup DotNet
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{matrix.dotnetversion}}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{matrix.pythonversion}}
- name: Set up JDK 11
uses: actions/setup-java@v3
if: ${{ matrix.language == 'java' }}
with:
java-version: ${{matrix.javaversion}}
distribution: 'adopt'
cache: 'gradle'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
if: ${{ matrix.language == 'java' }}
- name: Install pulumictl
uses: jaxxstorm/[email protected]
with:
repo: pulumi/pulumictl
- name: Install Pulumi CLI
uses: pulumi/actions@v4
- name: Download provider + tfgen binaries
uses: actions/download-artifact@v3
with:
name: pulumi-${{ env.PROVIDER }}
path: ${{ github.workspace }}/bin
- name: Restore binary perms
run: find ${{ github.workspace }} -name "pulumi-*-${{ env.PROVIDER }}" -print
-exec chmod +x {} \;
- name: Generate SDK
run: make ${{ matrix.language }}_sdk
- name: Check worktree clean
run: ./ci-scripts/ci/check-worktree-is-clean
- run: git status --porcelain
- name: Compress SDK folder
run: tar -zcf sdk/${{ matrix.language }}.tar.gz -C sdk/${{ matrix.language }} .
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.language }}-sdk.tar.gz
path: ${{ github.workspace}}/sdk/${{ matrix.language }}.tar.gz
prerequisites:
name: prerequisites
runs-on: ubuntu-latest
strategy:
matrix:
goversion: [1.19.x]
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
lfs: true
- name: Checkout Scripts Repo
uses: actions/checkout@v3
with:
path: ci-scripts
repository: pulumi/scripts
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.goversion }}
cache-dependency-path: examples/go.sum
- name: Install pulumictl
uses: jaxxstorm/[email protected]
with:
repo: pulumi/pulumictl
- name: Install Pulumi CLI
uses: pulumi/actions@v4
- name: Build codegen binaries
run: make gen
- name: Build provider binary
run: make provider
- name: Check worktree clean
run: ./ci-scripts/ci/check-worktree-is-clean
- run: git status --porcelain
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: pulumi-${{ env.PROVIDER }}
path: ${{ github.workspace }}/bin
- name: Test Provider Library
run: make test_provider
test:
name: ${{ matrix.language }} Tests
needs: build_sdks
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
language: [nodejs, java, yaml, go, dotnet, python]
dotnetversion: [3.1.301]
goversion: [1.19.x]
nodeversion: [14.x]
pythonversion: [3.7]
javaversion: [11]
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Checkout Scripts Repo
uses: actions/checkout@v3
with:
path: ci-scripts
repository: pulumi/scripts
- name: Unshallow clone for tags
run: git fetch --prune --unshallow --tags
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.goversion }}
cache-dependency-path: examples/go.sum
- name: Install pulumictl
uses: jaxxstorm/[email protected]
with:
repo: pulumi/pulumictl
- name: Install Pulumi CLI
uses: pulumi/actions@v4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{matrix.nodeversion}}
registry-url: https://registry.npmjs.org
- name: Setup DotNet
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{matrix.dotnetversion}}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{matrix.pythonversion}}
- name: Download binaries
uses: actions/download-artifact@v3
with:
name: pulumi-${{ env.PROVIDER }}
path: ${{ github.workspace }}/bin
- name: Restore binary perms
run: find ${{ github.workspace }} -name "pulumi-*-${{ env.PROVIDER }}" -print
-exec chmod +x {} \;
- name: Download SDK
if: ${{ matrix.language != 'yaml' }}
uses: actions/download-artifact@v3
with:
name: ${{ matrix.language }}-sdk.tar.gz
path: ${{ github.workspace}}/sdk
- name: Uncompress SDK folder
if: ${{ matrix.language != 'yaml' }}
run: tar -zxf ${{ github.workspace}}/sdk/${{ matrix.language}}.tar.gz -C ${{ github.workspace}}/sdk/${{ matrix.language}}
- name: Update path
run: echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
- name: Install Node deps
run: yarn global add typescript
- run: dotnet nuget add source ${{ github.workspace }}/nuget
- name: Install Python deps
run: |-
pip3 install virtualenv==20.0.23
pip3 install pipenv
- name: Install dependencies
if: ${{ matrix.language != 'yaml' }}
run: make install_${{ matrix.language}}_sdk
- name: Set up gotestfmt
uses: haveyoudebuggedit/gotestfmt-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run tests
run: |
set -euo pipefail
cd examples && go test -json -v -count=1 -cover -timeout 2h -tags=${{ matrix.language
}} -parallel 4 . 2>&1 | tee /tmp/gotest.log | gotestfmt