@@ -5,6 +5,8 @@ on: # yamllint disable-line rule:truthy
55 merge_group :
66 types :
77 - checks_requested
8+ # We use the default activity types for the pull_request event as specified here:
9+ # https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#pull_request
810 pull_request :
911 push :
1012 repository_dispatch :
2325 PIP_CACHE_DIR : ~/.cache/pip
2426 PRE_COMMIT_CACHE_DIR : ~/.cache/pre-commit
2527 RUN_TMATE : ${{ secrets.RUN_TMATE }}
26- TERRAFORM_DOCS_REPO_BRANCH_NAME : improvement/support_atx_closed_markdown_headers
28+ TERRAFORM_DOCS_REPO_BRANCH_NAME : cisagov
2729 TERRAFORM_DOCS_REPO_DEPTH : 1
2830 TERRAFORM_DOCS_REPO_URL : https://github.com/mcdonnnj/terraform-docs.git
2931
@@ -118,22 +120,21 @@ jobs:
118120 name : Lookup Go cache directory
119121 run : |
120122 echo "dir=$(go env GOCACHE)" >> $GITHUB_OUTPUT
121- - uses : actions/cache@v4
123+ - uses : actions/cache@v5
122124 env :
123- BASE_CACHE_KEY : ${{ github.job }}-${{ runner.os }}-\
124- py${{ steps.setup-python.outputs.python-version }}-\
125- go${{ steps.setup-go.outputs.go-version }}-\
126- packer${{ steps.setup-env.outputs.packer-version }}-\
127- tf${{ steps.setup-env.outputs.terraform-version }}-
125+ BASE_CACHE_KEY : >-
126+ ${{ github.job }}-${{ runner.os
127+ }}-py${{ steps.setup-python.outputs.python-version
128+ }}-go${{ steps.setup-go.outputs.go-version
129+ }}-packer${{ steps.setup-env.outputs.packer-version
130+ }}-tf${{ steps.setup-env.outputs.terraform-version }}-
128131 with :
129- # We do not use '**/setup.py' in the cache key so only the 'setup.py'
130- # file in the root of the repository is used. This is in case a Python
131- # package were to have a 'setup.py' as part of its internal codebase.
132- key : ${{ env.BASE_CACHE_KEY }}\
133- ${{ hashFiles('**/requirements-test.txt') }}-\
134- ${{ hashFiles('**/requirements.txt') }}-\
135- ${{ hashFiles('**/.pre-commit-config.yaml') }}-\
136- ${{ hashFiles('setup.py') }}
132+ key : >-
133+ ${{ env.BASE_CACHE_KEY }}${{
134+ hashFiles('**/requirements-test.txt')}}-${{
135+ hashFiles('**/requirements.txt') }}-${{
136+ hashFiles('**/.pre-commit-config.yaml') }}-${{
137+ hashFiles('pyproject.toml') }}
137138 # Note that the .terraform directory IS NOT included in the
138139 # cache because if we were caching, then we would need to use
139140 # the `-upgrade=true` option. This option blindly pulls down the
@@ -149,12 +150,12 @@ jobs:
149150 - uses : hashicorp/setup-packer@v3
150151 with :
151152 version : ${{ steps.setup-env.outputs.packer-version }}
152- - uses : hashicorp/setup-terraform@v3
153+ - uses : hashicorp/setup-terraform@v4
153154 with :
154155 terraform_version : ${{ steps.setup-env.outputs.terraform-version }}
155156 - name : Install go-critic
156157 env :
157- PACKAGE_URL : github.com/go-critic/go-critic/cmd/gocritic
158+ PACKAGE_URL : github.com/go-critic/go-critic/cmd/go-critic
158159 PACKAGE_VERSION : ${{ steps.setup-env.outputs.go-critic-version }}
159160 run : go install ${PACKAGE_URL}@${PACKAGE_VERSION}
160161 - name : Install goimports
@@ -173,10 +174,13 @@ jobs:
173174 PACKAGE_VERSION : ${{ steps.setup-env.outputs.staticcheck-version }}
174175 run : go install ${PACKAGE_URL}@${PACKAGE_VERSION}
175176 # TODO: https://github.com/cisagov/skeleton-generic/issues/165
176- # We are temporarily using @mcdonnnj's forked branch of terraform-docs
177- # until his PR: https://github.com/terraform-docs/terraform-docs/pull/745
178- # is approved. This temporary fix will allow for ATX header support when
179- # terraform-docs is run during linting.
177+ # We are temporarily using a branch of @mcdonnnj's fork of terraform-docs that
178+ # groups changes from his PRs until they are approved and merged:
179+ # https://github.com/terraform-docs/terraform-docs/pull/745
180+ # https://github.com/terraform-docs/terraform-docs/pull/901
181+ # This temporary fix will allow for ATX header support when terraform-docs is run
182+ # during linting and output delimiter rows with cell spacing that passes
183+ # Markdownlint's MD060/table-column-style rule.
180184 - name : Clone ATX headers branch from terraform-docs fork
181185 run : |
182186 git clone \
@@ -191,7 +195,7 @@ jobs:
191195 -o $(go env GOPATH)/bin/terraform-docs
192196 - name : Install dependencies
193197 run : |
194- python -m pip install --upgrade pip setuptools wheel
198+ python -m pip install --upgrade pip setuptools
195199 pip install --upgrade --requirement requirements-test.txt
196200 - name : Set up pre-commit hook environments
197201 run : pre-commit install-hooks
@@ -200,7 +204,7 @@ jobs:
200204 - name : Setup tmate debug session
201205 uses : mxschmitt/action-tmate@v3
202206 if : env.RUN_TMATE
203- test :
207+ test-source :
204208 name : test source - py${{ matrix.python-version }} - ${{ matrix.platform }}
205209 needs :
206210 - diagnostics
@@ -256,20 +260,19 @@ jobs:
256260 uses : actions/setup-python@v6
257261 with :
258262 python-version : ${{ matrix.python-version }}
259- - uses : actions/cache@v4
263+ - uses : actions/cache@v5
260264 env :
261- BASE_CACHE_KEY : ${{ github.job }}-\
262- ${{ runner.os }}-${{ runner.arch }}-\
263- py${{ steps.setup-python.outputs.python-version }}-
265+ BASE_CACHE_KEY : >-
266+ ${{ github.job }}-${{
267+ runner.os }}-${{ runner.arch }}-py${{
268+ steps.setup-python.outputs.python-version }}-
264269 with :
265270 path : ${{ env.PIP_CACHE_DIR }}
266- # We do not use '**/setup.py' in the cache key so only the 'setup.py'
267- # file in the root of the repository is used. This is in case a Python
268- # package were to have a 'setup.py' as part of its internal codebase.
269- key : ${{ env.BASE_CACHE_KEY }}\
270- ${{ hashFiles('**/requirements-test.txt') }}-\
271- ${{ hashFiles('**/requirements.txt') }}-\
272- ${{ hashFiles('setup.py') }}
271+ key : >-
272+ ${{ env.BASE_CACHE_KEY }}${{
273+ hashFiles('**/requirements-test.txt') }}-${{
274+ hashFiles('**/requirements.txt') }}${{
275+ hashFiles('pyproject.toml') }}
273276 restore-keys : |
274277 ${{ env.BASE_CACHE_KEY }}
275278 - name : Install dependencies
@@ -296,7 +299,7 @@ jobs:
296299 runs-on : ubuntu-latest
297300 needs :
298301 - diagnostics
299- - test
302+ - test-source
300303 steps :
301304 - name : Apply standard cisagov job preamble
302305 uses : cisagov/action-job-preamble@v1
@@ -332,12 +335,10 @@ jobs:
332335 - name : Setup tmate debug session
333336 uses : mxschmitt/action-tmate@v3
334337 if : env.RUN_TMATE
335- build :
338+ build-wheel :
336339 name : build wheel - py${{ matrix.python-version }}
337340 needs :
338341 - diagnostics
339- - lint
340- - test
341342 permissions :
342343 # actions/checkout needs this to fetch code
343344 contents : read
@@ -383,39 +384,39 @@ jobs:
383384 uses : actions/setup-python@v6
384385 with :
385386 python-version : ${{ matrix.python-version }}
386- - uses : actions/cache@v4
387+ - uses : actions/cache@v5
387388 env :
388- BASE_CACHE_KEY : ${{ github.job }}-${{ runner.os }}-\
389- py${{ steps.setup-python.outputs.python-version }}-
389+ BASE_CACHE_KEY : >-
390+ ${{ github.job }}-${{ runner.os }}-py${{
391+ steps.setup-python.outputs.python-version }}-
390392 with :
391393 path : ${{ env.PIP_CACHE_DIR }}
392- # We do not use '**/setup.py' in the cache key so only the 'setup.py'
393- # file in the root of the repository is used. This is in case a Python
394- # package were to have a 'setup.py' as part of its internal codebase.
395- key : ${{ env.BASE_CACHE_KEY }}\
396- ${{ hashFiles('**/requirements.txt') }}-\
397- ${{ hashFiles('setup.py') }}
394+ key : >-
395+ ${{ env.BASE_CACHE_KEY }}${{
396+ hashFiles('**/requirements.txt') }}-${{
397+ hashFiles('pyproject.toml') }}
398398 restore-keys : |
399399 ${{ env.BASE_CACHE_KEY }}
400400 - name : Install build dependencies
401401 run : |
402- python -m pip install --upgrade pip setuptools wheel
402+ python -m pip install --upgrade pip setuptools
403403 python -m pip install --upgrade build
404404 - name : Build artifacts
405405 run : python -m build
406406 - name : Upload artifacts
407- uses : actions/upload-artifact@v6
407+ uses : actions/upload-artifact@v7
408408 with :
409409 name : dist-${{ matrix.python-version }}
410410 path : dist
411411 - name : Setup tmate debug session
412412 uses : mxschmitt/action-tmate@v3
413413 if : env.RUN_TMATE
414- test-build :
414+ test-wheel :
415415 name : test built wheel - py${{ matrix.python-version }} - ${{ matrix.platform }}
416416 needs :
417417 - diagnostics
418- - build
418+ - build-wheel
419+ - test-source
419420 permissions :
420421 # actions/checkout needs this to fetch code
421422 contents : read
@@ -468,31 +469,30 @@ jobs:
468469 uses : actions/setup-python@v6
469470 with :
470471 python-version : ${{ matrix.python-version }}
471- - uses : actions/cache@v4
472+ - uses : actions/cache@v5
472473 env :
473- BASE_CACHE_KEY : ${{ github.job }}-\
474- ${{ runner.os }}-${{ runner.arch }}-\
475- py${{ steps.setup-python.outputs.python-version }}-
474+ BASE_CACHE_KEY : >-
475+ ${{ github.job }}-${{
476+ runner.os }}-${{ runner.arch }}-py${{
477+ steps.setup-python.outputs.python-version }}-
476478 with :
477479 path : ${{ env.PIP_CACHE_DIR }}
478- # We do not use '**/setup.py' in the cache key so only the 'setup.py'
479- # file in the root of the repository is used. This is in case a Python
480- # package were to have a 'setup.py' as part of its internal codebase.
481- key : ${{ env.BASE_CACHE_KEY }}\
482- ${{ hashFiles('**/requirements.txt') }}-\
483- ${{ hashFiles('setup.py') }}
480+ key : >-
481+ ${{ env.BASE_CACHE_KEY }}${{
482+ hashFiles('**/requirements.txt') }}-${{
483+ hashFiles('pyproject.toml') }}
484484 restore-keys : |
485485 ${{ env.BASE_CACHE_KEY }}
486486 - name : Retrieve the built wheel
487- uses : actions/download-artifact@v7
487+ uses : actions/download-artifact@v8
488488 with :
489489 name : dist-${{ matrix.python-version }}
490490 path : dist
491491 - id : find-wheel
492492 name : Get the name of the retrieved wheel (there should only be one)
493493 run : echo "wheel=$(ls dist/*whl)" >> $GITHUB_OUTPUT
494494 - name : Update core Python packages
495- run : python -m pip install --upgrade pip setuptools wheel
495+ run : python -m pip install --upgrade pip setuptools
496496 - name : Install the built wheel (along with testing dependencies)
497497 run : python -m pip install ${{ steps.find-wheel.outputs.wheel }}[test]
498498 - name : Run tests
0 commit comments