2
2
name : build
3
3
4
4
on :
5
- push :
5
+ merge_group :
6
+ types :
7
+ - checks_requested
6
8
pull_request :
9
+ push :
7
10
repository_dispatch :
8
- types : [apb]
11
+ types :
12
+ - apb
13
+
14
+ # Set a default shell for any run steps. The `-Eueo pipefail` sets errtrace,
15
+ # nounset, errexit, and pipefail. The `-x` will print all commands as they are
16
+ # run. Please see the GitHub Actions documentation for more information:
17
+ # https://docs.github.com/en/actions/using-jobs/setting-default-values-for-jobs
18
+ defaults :
19
+ run :
20
+ shell : bash -Eueo pipefail -x {0}
9
21
10
22
env :
11
23
CURL_CACHE_DIR : ~/.cache/curl
12
24
PIP_CACHE_DIR : ~/.cache/pip
13
25
PRE_COMMIT_CACHE_DIR : ~/.cache/pre-commit
14
26
RUN_TMATE : ${{ secrets.RUN_TMATE }}
27
+ TERRAFORM_DOCS_REPO_BRANCH_NAME : improvement/support_atx_closed_markdown_headers
28
+ TERRAFORM_DOCS_REPO_DEPTH : 1
29
+ TERRAFORM_DOCS_REPO_URL : https://github.com/mcdonnnj/terraform-docs.git
15
30
16
31
jobs :
17
32
diagnostics :
27
42
egress-policy : audit
28
43
- id : github-status
29
44
name : Check GitHub status
30
- uses : crazy-max/ghaction-github-status@v3
45
+ uses : crazy-max/ghaction-github-status@v4
31
46
- id : dump-context
32
47
name : Dump context
33
48
uses : crazy-max/ghaction-dump-context@v2
@@ -45,20 +60,20 @@ jobs:
45
60
uses : cisagov/setup-env-github-action@develop
46
61
- uses : actions/checkout@v4
47
62
- id : setup-python
48
- uses : actions/setup-python@v4
63
+ uses : actions/setup-python@v5
49
64
with :
50
- python-version : " 3.11 "
65
+ python-version : ${{ steps.setup-env.outputs.python-version }}
51
66
# We need the Go version and Go cache location for the actions/cache step,
52
67
# so the Go installation must happen before that.
53
68
- id : setup-go
54
- uses : actions/setup-go@v4
69
+ uses : actions/setup-go@v5
55
70
with :
56
71
# There is no expectation for actual Go code so we disable caching as
57
72
# it relies on the existence of a go.sum file.
58
73
cache : false
59
- go-version : " 1.20 "
60
- - name : Lookup Go cache directory
61
- id : go- cache
74
+ go-version : ${{ steps.setup-env.outputs.go-version }}
75
+ - id : go- cache
76
+ name : Lookup Go cache directory
62
77
run : |
63
78
echo "dir=$(go env GOCACHE)" >> $GITHUB_OUTPUT
64
79
- uses : actions/cache@v3
69
84
packer${{ steps.setup-env.outputs.packer-version }}-\
70
85
tf${{ steps.setup-env.outputs.terraform-version }}-"
71
86
with :
87
+ # We do not use '**/setup.py' in the cache key so only the 'setup.py'
88
+ # file in the root of the repository is used. This is in case a Python
89
+ # package were to have a 'setup.py' as part of its internal codebase.
90
+ key : " ${{ env.BASE_CACHE_KEY }}\
91
+ ${{ hashFiles('**/requirements-test.txt') }}-\
92
+ ${{ hashFiles('**/requirements.txt') }}-\
93
+ ${{ hashFiles('**/.pre-commit-config.yaml') }}-\
94
+ ${{ hashFiles('setup.py') }}"
72
95
# Note that the .terraform directory IS NOT included in the
73
96
# cache because if we were caching, then we would need to use
74
97
# the `-upgrade=true` option. This option blindly pulls down the
@@ -80,14 +103,6 @@ jobs:
80
103
${{ env.PRE_COMMIT_CACHE_DIR }}
81
104
${{ env.CURL_CACHE_DIR }}
82
105
${{ steps.go-cache.outputs.dir }}
83
- # We do not use '**/setup.py' in the cache key so only the 'setup.py'
84
- # file in the root of the repository is used. This is in case a Python
85
- # package were to have a 'setup.py' as part of its internal codebase.
86
- key : " ${{ env.BASE_CACHE_KEY }}\
87
- ${{ hashFiles('**/requirements-test.txt') }}-\
88
- ${{ hashFiles('**/requirements.txt') }}-\
89
- ${{ hashFiles('**/.pre-commit-config.yaml') }}-\
90
- ${{ hashFiles('setup.py') }}"
91
106
restore-keys : |
92
107
${{ env.BASE_CACHE_KEY }}
93
108
- name : Setup curl cache
@@ -105,34 +120,46 @@ jobs:
105
120
${{ env.CURL_CACHE_DIR }}/"${PACKER_ZIP}"
106
121
sudo mv /usr/local/bin/packer /usr/local/bin/packer-default
107
122
sudo ln -s /opt/packer/packer /usr/local/bin/packer
108
- - uses : hashicorp/setup-terraform@v2
123
+ - uses : hashicorp/setup-terraform@v3
109
124
with :
110
125
terraform_version : ${{ steps.setup-env.outputs.terraform-version }}
111
126
- name : Install go-critic
112
127
env :
113
128
PACKAGE_URL : github.com/go-critic/go-critic/cmd/gocritic
114
129
PACKAGE_VERSION : ${{ steps.setup-env.outputs.go-critic-version }}
115
130
run : go install ${PACKAGE_URL}@${PACKAGE_VERSION}
131
+ - name : Install goimports
132
+ env :
133
+ PACKAGE_URL : golang.org/x/tools/cmd/goimports
134
+ PACKAGE_VERSION : ${{ steps.setup-env.outputs.goimports-version }}
135
+ run : go install ${PACKAGE_URL}@${PACKAGE_VERSION}
116
136
- name : Install gosec
117
137
env :
118
138
PACKAGE_URL : github.com/securego/gosec/v2/cmd/gosec
119
139
PACKAGE_VERSION : ${{ steps.setup-env.outputs.gosec-version }}
120
140
run : go install ${PACKAGE_URL}@${PACKAGE_VERSION}
121
- - name : Install shfmt
122
- env :
123
- PACKAGE_URL : mvdan.cc/sh/v3/cmd/shfmt
124
- PACKAGE_VERSION : ${{ steps.setup-env.outputs.shfmt-version }}
125
- run : go install ${PACKAGE_URL}@${PACKAGE_VERSION}
126
141
- name : Install staticcheck
127
142
env :
128
143
PACKAGE_URL : honnef.co/go/tools/cmd/staticcheck
129
144
PACKAGE_VERSION : ${{ steps.setup-env.outputs.staticcheck-version }}
130
145
run : go install ${PACKAGE_URL}@${PACKAGE_VERSION}
131
- - name : Install Terraform-docs
132
- env :
133
- PACKAGE_URL : github.com/terraform-docs/terraform-docs
134
- PACKAGE_VERSION : ${{ steps.setup-env.outputs.terraform-docs-version }}
135
- run : go install ${PACKAGE_URL}@${PACKAGE_VERSION}
146
+ # TODO: https://github.com/cisagov/skeleton-generic/issues/165
147
+ # We are temporarily using @mcdonnnj's forked branch of terraform-docs
148
+ # until his PR: https://github.com/terraform-docs/terraform-docs/pull/745
149
+ # is approved. This temporary fix will allow for ATX header support when
150
+ # terraform-docs is run during linting.
151
+ - name : Clone ATX headers branch from terraform-docs fork
152
+ run : |
153
+ git clone \
154
+ --branch $TERRAFORM_DOCS_REPO_BRANCH_NAME \
155
+ --depth $TERRAFORM_DOCS_REPO_DEPTH \
156
+ --single-branch \
157
+ $TERRAFORM_DOCS_REPO_URL /tmp/terraform-docs
158
+ - name : Build and install terraform-docs binary
159
+ run : |
160
+ go build \
161
+ -C /tmp/terraform-docs \
162
+ -o $(go env GOPATH)/bin/terraform-docs
136
163
- name : Install dependencies
137
164
run : |
138
165
python -m pip install --upgrade pip setuptools wheel
@@ -148,22 +175,17 @@ jobs:
148
175
name : test source - py${{ matrix.python-version }}
149
176
needs :
150
177
- diagnostics
151
- runs-on : ${{ matrix.os }}
178
+ runs-on : ubuntu-latest
152
179
strategy :
153
180
fail-fast : false
154
181
matrix :
155
- os :
156
- - ubuntu-latest
157
182
python-version :
158
183
- " 3.7"
159
184
- " 3.8"
160
185
- " 3.9"
161
186
- " 3.10"
162
187
- " 3.11"
163
188
- " 3.12"
164
- include :
165
- - os : ubuntu-20.04
166
- python-version : " 3.6"
167
189
steps :
168
190
- id : harden-runner
169
191
name : Harden the runner
@@ -172,7 +194,7 @@ jobs:
172
194
egress-policy : audit
173
195
- uses : actions/checkout@v4
174
196
- id : setup-python
175
- uses : actions/setup-python@v4
197
+ uses : actions/setup-python@v5
176
198
with :
177
199
python-version : ${{ matrix.python-version }}
178
200
- uses : actions/cache@v3
@@ -221,10 +243,12 @@ jobs:
221
243
with :
222
244
egress-policy : audit
223
245
- uses : actions/checkout@v4
246
+ - id : setup-env
247
+ uses : cisagov/setup-env-github-action@develop
224
248
- id : setup-python
225
- uses : actions/setup-python@v4
249
+ uses : actions/setup-python@v5
226
250
with :
227
- python-version : " 3.10 "
251
+ python-version : ${{ steps.setup-env.outputs.python-version }}
228
252
- uses : actions/cache@v3
229
253
env :
230
254
BASE_CACHE_KEY : " ${{ github.job }}-${{ runner.os }}-\
@@ -257,22 +281,17 @@ jobs:
257
281
- diagnostics
258
282
- lint
259
283
- test
260
- runs-on : ${{ matrix.os }}
284
+ runs-on : ubuntu-latest
261
285
strategy :
262
286
fail-fast : false
263
287
matrix :
264
- os :
265
- - ubuntu-latest
266
288
python-version :
267
289
- " 3.7"
268
290
- " 3.8"
269
291
- " 3.9"
270
292
- " 3.10"
271
293
- " 3.11"
272
294
- " 3.12"
273
- include :
274
- - os : ubuntu-20.04
275
- python-version : " 3.6"
276
295
steps :
277
296
- id : harden-runner
278
297
name : Harden the runner
@@ -281,7 +300,7 @@ jobs:
281
300
egress-policy : audit
282
301
- uses : actions/checkout@v4
283
302
- id : setup-python
284
- uses : actions/setup-python@v4
303
+ uses : actions/setup-python@v5
285
304
with :
286
305
python-version : ${{ matrix.python-version }}
287
306
- uses : actions/cache@v3
@@ -305,7 +324,7 @@ jobs:
305
324
- name : Build artifacts
306
325
run : python -m build
307
326
- name : Upload artifacts
308
- uses : actions/upload-artifact@v3
327
+ uses : actions/upload-artifact@v4
309
328
with :
310
329
name : dist-${{ matrix.python-version }}
311
330
path : dist
@@ -317,22 +336,17 @@ jobs:
317
336
needs :
318
337
- diagnostics
319
338
- build
320
- runs-on : ${{ matrix.os }}
339
+ runs-on : ubuntu-latest
321
340
strategy :
322
341
fail-fast : false
323
342
matrix :
324
- os :
325
- - ubuntu-latest
326
343
python-version :
327
344
- " 3.7"
328
345
- " 3.8"
329
346
- " 3.9"
330
347
- " 3.10"
331
348
- " 3.11"
332
349
- " 3.12"
333
- include :
334
- - os : ubuntu-20.04
335
- python-version : " 3.6"
336
350
steps :
337
351
- id : harden-runner
338
352
name : Harden the runner
@@ -341,7 +355,7 @@ jobs:
341
355
egress-policy : audit
342
356
- uses : actions/checkout@v4
343
357
- id : setup-python
344
- uses : actions/setup-python@v4
358
+ uses : actions/setup-python@v5
345
359
with :
346
360
python-version : ${{ matrix.python-version }}
347
361
- uses : actions/cache@v3
@@ -359,7 +373,7 @@ jobs:
359
373
restore-keys : |
360
374
${{ env.BASE_CACHE_KEY }}
361
375
- name : Retrieve the built wheel
362
- uses : actions/download-artifact@v3
376
+ uses : actions/download-artifact@v4
363
377
with :
364
378
name : dist-${{ matrix.python-version }}
365
379
path : dist
0 commit comments