-
Notifications
You must be signed in to change notification settings - Fork 24
287 lines (278 loc) · 9.73 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
name: Build and test
on:
merge_group:
pull_request:
push:
branches:
- main
env:
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN_PRODUCTION }}
AWS_REGION: us-west-2
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULUMI_TEST_OWNER: "moolumi"
jobs:
setup_matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
os="${{ contains(github.event.pull_request.labels.*.name, 'ci/test') && 'ubuntu-latest macos-latest windows-latest' || 'ubuntu-latest' }}"
echo "matrix={\"os\": $(echo $os | jq -cR 'split(" ")')}" >> $GITHUB_OUTPUT
format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup dotnet SDK
uses: actions/setup-dotnet@v4
- name: Setup dotnet SDK
uses: actions/setup-dotnet@v4
with:
# Install 6.0 for Build.fsproj
dotnet-version: 6.0.x
- name: Format Pulumi SDK
run: dotnet run format-sdk verify
build:
needs: setup_matrix
strategy:
matrix:
os: ${{ fromJson(needs.setup_matrix.outputs.matrix).os }}
dotnet-version: [6.0.x, 8.0.x]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup dotnet SDK
id: setup-dotnet
uses: actions/setup-dotnet@v4
with:
# Install 6.0 for Build.fsproj and the matrix version.
# `outputs.dotnet-version` is the latest version among the installed
# versions. Since Build.fsproj targets the lowest version we support,
# this works out ok for the matrix.
# https://github.com/actions/setup-dotnet?tab=readme-ov-file#dotnet-version
dotnet-version: |
6.0.x
${{ matrix.dotnet-version }}
- name: Create global.json
# This ensures that we use the matrix version instead of the runner's default version
# https://github.com/actions/setup-dotnet?tab=readme-ov-file#matrix-testing
run: |
echo '{"sdk":{"version": "${{ steps.setup-dotnet.outputs.dotnet-version }}"}}' > ./global.json
- name: Dotnet version
run: dotnet --version
- name: Install Pulumi CLI
uses: pulumi/actions@v5
with:
pulumi-version: latest
- name: Build Pulumi SDK
run: dotnet run build-sdk
- name: Workspace clean (are xml doc file updates committed?)
uses: pulumi/git-status-check-action@v1
with:
allowed-changes: ./global.json
- name: Test Pulumi SDK
run: dotnet run test-sdk coverage
- name: Test Pulumi Automation SDK
run: dotnet run test-automation-sdk coverage
- name: Upload coverage data
uses: codecov/codecov-action@v4
with:
directory: coverage
files: "*"
fail_ci_if_error: false
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
integration-tests:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13]
dotnet-version: [6.0.x, 8.0.x]
runs-on: ${{ matrix.os }}
steps:
- name: Set TARGET_FRAMEWORK
shell: bash
run: |
if [[ "${{ matrix.dotnet-version }}" == "6.0.x" ]]; then
echo "TARGET_FRAMEWORK=net6.0" >> $GITHUB_ENV
elif [[ "${{ matrix.dotnet-version }}" == "8.0.x" ]]; then
echo "TARGET_FRAMEWORK=net8.0" >> $GITHUB_ENV
elif [[ "${{ matrix.dotnet-version }}" == "9.0.x" ]]; then
echo "TARGET_FRAMEWORK=net9.0" >> $GITHUB_ENV
else
echo "Unexpected dotnet-version: ${{ matrix.dotnet-version }}"
exit 1
fi
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup dotnet SDK
id: setup-dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Create global.json
# This ensures that we use the matrix version instead of the runner's default version
# https://github.com/actions/setup-dotnet?tab=readme-ov-file#matrix-testing
run: |
echo '{"sdk":{"version": "${{ steps.setup-dotnet.outputs.dotnet-version }}"}}' > ./global.json
- name: Dotnet version
run: dotnet --version
- name: Set up Go 1.22.x
uses: actions/setup-go@v5
with:
go-version: 1.22.x
- name: Install Pulumi CLI
uses: pulumi/actions@v5
with:
pulumi-version: latest
- name: Install gotestsum
uses: jaxxstorm/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
repo: gotestyourself/gotestsum
tag: v1.8.1
cache: enable
- name: Install netcoredbg (Linux)
if: startsWith(matrix.os, 'ubuntu')
run: |
curl -sSL https://github.com/Samsung/netcoredbg/releases/download/3.1.1-1042/netcoredbg-linux-amd64.tar.gz -o netcoredbg.tar.gz
tar xzf netcoredbg.tar.gz
sudo cp netcoredbg/* /usr/bin/
- uses: MinoruSekine/[email protected]
if: startsWith(matrix.os, 'windows')
with:
buckets: extras
apps: doxygen plantuml
- name: Install netcoredbg (Windows)
if: startsWith(matrix.os, 'windows')
run: |
scoop install netcoredbg
- name: Install netcoredbg (MacOS)
if: startsWith(matrix.os, 'macos')
id: netcoredbg
run: |
curl -sSL https://github.com/Samsung/netcoredbg/releases/download/3.1.1-1042/netcoredbg-osx-amd64.tar.gz -o netcoredbg.tar.gz
tar xzf netcoredbg.tar.gz
echo "netcoredbgpath=$(pwd)/netcoredbg/" >> ${GITHUB_OUTPUT}
- name: Integration tests
if: startsWith(matrix.os, 'macos')
run: PATH="${{ steps.netcoredbg.outputs.netcoredbgpath}}":"$PATH" make test_integration
- name: Integration tests
if: startsWith(matrix.os, 'macos') != true
run: make test_integration
conformance-tests:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-13]
dotnet-version: [6.0.x]
runs-on: ${{ matrix.os }}
steps:
- name: Set TARGET_FRAMEWORK
shell: bash
run: |
if [[ "${{ matrix.dotnet-version }}" == "6.0.x" ]]; then
echo "TARGET_FRAMEWORK=net6.0" >> $GITHUB_ENV
elif [[ "${{ matrix.dotnet-version }}" == "8.0.x" ]]; then
echo "TARGET_FRAMEWORK=net8.0" >> $GITHUB_ENV
elif [[ "${{ matrix.dotnet-version }}" == "9.0.x" ]]; then
echo "TARGET_FRAMEWORK=net9.0" >> $GITHUB_ENV
else
echo "Unexpected dotnet-version: ${{ matrix.dotnet-version }}"
exit 1
fi
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup dotnet SDK
id: setup-dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Create global.json
# This ensures that we use the matrix version instead of the runner's default version
# https://github.com/actions/setup-dotnet?tab=readme-ov-file#matrix-testing
run: |
echo '{"sdk":{"version": "${{ steps.setup-dotnet.outputs.dotnet-version }}"}}' > ./global.json
- name: Dotnet version
run: dotnet --version
- name: Set up Go 1.22.x
uses: actions/setup-go@v5
with:
go-version: 1.22.x
- name: Install Pulumi CLI
uses: pulumi/actions@v5
with:
pulumi-version: latest
- name: Install gotestsum
uses: jaxxstorm/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
repo: gotestyourself/gotestsum
tag: v1.8.1
cache: enable
- name: Conformance tests
run: make test_conformance
info:
name: gather
runs-on: ubuntu-latest
outputs:
version: "${{ steps.version.outputs.version }}"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get the latest version
id: latest
uses: miniscruff/changie-action@v2
with:
args: next auto
continue-on-error: true
- name: Get the next patch version
id: patch
uses: miniscruff/changie-action@v2
with:
args: next patch
- name: Stitch version together
id: version
run: |
TAG="${{ steps.latest.outputs.output || steps.patch.outputs.output }}"
TAG="${TAG#v}" # remove prefix
OID="$(git rev-parse --short HEAD)"
PULUMI_VERSION="$TAG-alpha.$OID"
echo "version=${PULUMI_VERSION}" >> $GITHUB_OUTPUT
release-dev-sdk:
name: release-dev-sdk
needs: [build, integration-tests, info]
uses: ./.github/workflows/release-sdk.yml
if: ${{ github.event_name == 'merge_group' }}
with:
ref: ${{ github.event.release.tag_name }}
version: ${{ needs.info.outputs.version }}
release-notes: ${{ github.event.release.body }}
secrets: inherit
check-pr:
needs: ["build", "integration-tests", "format"]
runs-on: ubuntu-latest
if: always() # always report a status
steps:
- name: Build failed
if: ${{ needs.build.result != 'success' }}
run: exit 1
- name: Integration tests failed
if: ${{ needs.integration-tests.result != 'success' }}
run: exit 1
- name: Format failed
if: ${{ needs.format.result != 'success' }}
run: exit 1
- name: CI succeeded
run: exit 0