Consistently only conditionally install tools in soundness checks #68
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Some of the soundness checks rely on other tools, e.g.
curl
,yq
,yamllint
. These are installed as part of the command in the workflow. Some of them conditionally do this only if the tool wasn't detected as already installed; others check first, usingwhich
. The latter approach is better because it saves time performing theapt update
andapt install
commands if they are not necessary. In CI this is speed up in returning the check status and saves wasted compute. But it also has an important impact locally when running these checks is part of the developer workflow, usually withact
.Concretely, running
soundness-format
(an alias for the expandedact
command to only run the format check) takes 38s in CI on a recent PR, but only 7s of this is actually running the check. The rest is pulling the Docker base image and doing the installation ofcurl
.Modifications
This PR updates all the soundness checks to be consistent with what we were already doing for the
yamllint
check: to only install missing tools.As an aside, the use of
apt
was also inconsistent across the various soundness checks. This PR makes them consistent and:qq
withq
— the use ofqq
is strongly discouraged in the man page without a no-action specifier.apt-cache
andapt-get
with justapt
, which has been supported for a long time.Result
Faster CI, faster local workflow.