-
Notifications
You must be signed in to change notification settings - Fork 242
360 lines (348 loc) · 12.7 KB
/
main.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
# Workflows pertaining to the main branch
name: Main
on:
pull_request:
branches: [main, release]
push:
branches: [main, release]
env:
DOTNET_NOLOGO: true
# This workflows currently has the following jobs:
# - build : Builds the source tree as-is
# - test : Runs all unit tests against the build result
# - create-release-package : Prepares a release package with the "real" version
# - integ-test : Runs integration tests against the release package
jobs:
build:
name: Build
permissions:
contents: read
runs-on: ubuntu-latest
steps:
# Check out the code
- name: Check out
uses: actions/checkout@v2.4.0
# Set up all of our standard runtimes
- name: Set up .NET 5
uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.x'
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: '1.17'
- name: Set up Java 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'zulu'
- name: Set up Node 12
uses: actions/setup-node@v2.5.1
with:
cache: yarn
node-version: '12'
- name: Set up Python 3.6
uses: actions/setup-python@v2
with:
python-version: '3.6'
- name: Install python3-venv
run: sudo apt install -y python3-venv
- name: Locate Caches
id: cache-locations
run: |-
echo "::group::Upgrade pip"
# Need to have PIP >= 20.1 for "pip cache dir" to work
python3 -m pip install --upgrade pip
echo "::endgroup"
echo "::set-output name=pip-cache::$(python3 -m pip cache dir)"
- name: Cache
uses: actions/cache@v2.1.6
with:
path: |-
${{ steps.cache-locations.outputs.pip-cache }}
~/.m2/repository
!~/.m2/repository/software/amazon/jsii/
~/.nuget/packages
!~/.nuget/packages/amazon.jsii.*
key: ${{ runner.os }}-node@12-python@3.6-${{ hashFiles('**/yarn.lock', '**/Directory.Build.targets') }}
restore-keys: |-
${{ runner.os }}-node@12-python@3.6-
${{ runner.os }}-node@12-
${{ runner.os }}-
# Prepare dependencies and build
- name: Install Dependencies
run: |-
yarn install --frozen-lockfile
- name: Full Build
run: |-
yarn build
- name: Prepare Artifact
run: |-
tar zcvf ${{ runner.temp }}/built-tree.tgz \
--exclude='**/.env' \
--exclude='**/.nuget' \
--exclude='**/node_modules' \
--exclude='**/project/.m2/repository' \
--exclude-tag-all='pyenv.cfg' \
--directory=${{ github.workspace }} \
.
# Upload artifact (we'll tar it up to save time)
- name: 'Upload Artifact: built-tree'
uses: actions/upload-artifact@v2
with:
name: built-tree
path: ${{ runner.temp }}/built-tree.tgz
# Ensure working directory is clean (build should not change checked in source code)
- name: 'Assert clean working directory'
if: runner.os != 'Windows' # Windows will see artificial permission changes, so we ignore it
run: |-
# Make sure the index is up-to-date (git diff-index assumes it was done)
git update-index --refresh
# Check for modifications in tracked files
git diff-index --exit-code --stat HEAD
# Check for new untracked files
untracked=$(git ls-files --others --exclude-standard) \
&& echo "Untracked files: ${untracked:-<none>}" \
&& test -z "${untracked}"
shell: bash
create-release-package:
name: Create Release Package
permissions:
contents: read
runs-on: ubuntu-latest
steps:
# Check out the code
- name: Check out
uses: actions/checkout@v2.4.0
# Set up all of our standard runtimes
- name: Set up .NET 5
uses: actions/setup-dotnet@v1
with:
dotnet-version: '5.0.x'
- name: Set up Go 1.17
uses: actions/setup-go@v2
with:
go-version: '1.17'
- name: Set up Java 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'zulu'
- name: Set up Node 12
uses: actions/setup-node@v2.5.1
with:
cache: yarn
node-version: '12'
- name: Set up Python 3.6
uses: actions/setup-python@v2
with:
python-version: '3.6'
- name: Install python3-venv
run: sudo apt install -y python3-venv
- name: Locate Caches
id: cache-locations
run: |-
echo "::group::Upgrade pip"
# Need to have PIP >= 20.1 for "pip cache dir" to work
python3 -m pip install --upgrade pip
echo "::endgroup"
echo "::set-output name=pip-cache::$(python3 -m pip cache dir)"
- name: Cache
uses: actions/cache@v2.1.6
with:
path: |-
${{ steps.cache-locations.outputs.pip-cache }}
~/.m2/repository
!~/.m2/repository/software/amazon/jsii/
~/.nuget/packages
!~/.nuget/packages/amazon.jsii.*
key: ${{ runner.os }}-node@12-python@3.6-${{ hashFiles('**/yarn.lock', '**/Directory.Build.targets') }}
restore-keys: |-
${{ runner.os }}-node@12-python@3.6-
${{ runner.os }}-node@12-
${{ runner.os }}-
# Prepare dependencies and build
- name: Install Dependencies
run: yarn install --frozen-lockfile
# Determine a prerelease version (depending on whether this is a PR or Push event)
- name: Standard Version (PR)
if: github.event_name == 'pull_request'
run: |-
npx standard-version \
--compareUrlFormat='{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...${{ github.sha }}' \
--prerelease=dev.${{ github.event.pull_request.number }} \
--skip.commit
- name: Standard Version (Nightly)
if: github.event_name == 'push'
run: |-
npx standard-version \
--compareUrlFormat='{{host}}/{{owner}}/{{repository}}/compare/{{previousTag}}...${{ github.sha }}' \
--prerelease=dev.$(date -u +'%Y%m%d') \
--skip.commit
# Now we'll be preparing a release package (with the "real" version)
- name: Run "align-version.sh"
run: |-
./scripts/align-version.sh
- name: Full Build
run: |-
yarn build
- name: Package
run: |-
yarn package
# Upload artifacts
- name: 'Upload Artifact: release-package'
uses: actions/upload-artifact@v2
with:
name: release-package
path: ${{ github.workspace }}/dist/
test:
name: Test (${{ matrix.os }} / dotnet ${{ matrix.dotnet }} / java ${{ matrix.java }} / node ${{ matrix.node }} / python ${{ matrix.python }})
needs: build
strategy:
fail-fast: false
matrix:
# All currently supported node versions (Maintenance LTS, Active LTS, Current)
dotnet: ['3.1.x']
go: ['1.17']
java: ['8']
node: ['12', '14', '16']
os: [ubuntu-latest]
python: ['3.6']
# Add specific combinations to be tested against "node 12" (to restrict cardinality)
include:
# Test using Windows
- os: windows-latest
dotnet: '3.1.x'
go: '1.17'
java: '8'
node: '12'
python: '3.6'
# Test using macOS
- os: macos-latest
dotnet: '3.1.x'
go: '1.17'
java: '8'
node: '12'
python: '3.6'
# Test alternate .NETs
- java: '8'
dotnet: '5.0.x'
go: '1.17'
node: '12'
os: ubuntu-latest
python: '3.6'
- java: '8'
dotnet: '6.0.x'
go: '1.17'
node: '12'
os: ubuntu-latest
python: '3.6'
# Test alternate Javas
- java: '11'
dotnet: '3.1.x'
go: '1.17'
node: '12'
os: ubuntu-latest
python: '3.6'
# Test alternate Pythons
- python: '3.7'
dotnet: '3.1.x'
go: '1.17'
java: '8'
node: '12'
os: ubuntu-latest
- python: '3.8'
dotnet: '3.1.x'
go: '1.17'
java: '8'
node: '12'
os: ubuntu-latest
- python: '3.9'
dotnet: '3.1.x'
go: '1.17'
java: '8'
node: '12'
os: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
# Check out the code
- name: Download Artifact
uses: actions/download-artifact@v2
with:
name: built-tree
- name: Extract Artifact
run: |-
echo "::group::Untar Archive"
tar zxvf built-tree.tgz
echo "::endgroup"
rm built-tree.tgz
# Set up all of our standard runtimes (this is matrix-based)
- name: Set up .NET ${{ matrix.dotnet }}
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet }}
include-prerelease: ${{ matrix.dotnet-prerelease }}
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go }}
- name: Set up Java ${{ matrix.java }}
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java }}
distribution: 'zulu'
- name: Set up Node ${{ matrix.node }}
uses: actions/setup-node@v2.5.1
with:
cache: yarn
node-version: ${{ matrix.node }}
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: 'Linux: Install python3-venv'
if: runner.os == 'Linux'
run: sudo apt install -y python3-venv
- name: Locate Caches
id: cache-locations
run: |-
echo "::group::Upgrade pip"
# Need to have PIP >= 20.1 for "pip cache dir" to work
python3 -m pip install --upgrade pip
echo "::endgroup"
echo "::set-output name=pip-cache::$(python3 -m pip cache dir)"
- name: Cache
uses: actions/cache@v2.1.6
with:
path: |-
${{ steps.cache-locations.outputs.pip-cache }}
~/.m2/repository
!~/.m2/repository/software/amazon/jsii/
~/.nuget/packages
!~/.nuget/packages/amazon.jsii.*
# Not including .NET / Java in the cache keys, those artifacts are SDK-version-independent
key: ${{ runner.os }}-node@${{ matrix.node }}-python@${{ matrix.python }}-${{ hashFiles('**/yarn.lock', '**/Directory.Build.targets') }}
restore-keys: |-
${{ runner.os }}-node@${{ matrix.node }}-python@${{ matrix.python }}-
${{ runner.os }}-node@${{ matrix.node }}-
${{ runner.os }}-
# Run the tests
- name: Install Dependencies
run: |-
yarn install --frozen-lockfile
- name: Test
run: |-
yarn test
# Ensure working directory is clean (tests should not change checked in source code)
- name: 'Assert clean working directory'
if: runner.os != 'Windows' # Windows will see artificial permission changes, so we ignore it
run: |-
# Make sure the index is up-to-date (git diff-index assumes it was done)
git update-index --refresh
# Check for modifications in tracked files
git diff-index --exit-code --stat HEAD
# Check for new untracked files
untracked=$(git ls-files --others --exclude-standard) \
&& echo "Untracked files: ${untracked:-<none>}" \
&& test -z "${untracked}"
shell: bash