The latest version of the setup-go action now caches the go module and
build cache by default, so it should no longer be done separately to
avoid saving the same data under two different cache keys.
This updates the caching logic accordingly to remove those directories
from the separate cache step and renames the step to reflect that it now
only involves the lint cache.
Finally, while here, it also switches the key over to use the hash of
the 'go.sum' file in the root of the repository as opposed to using the
commit hash as it produces significantly less cache objects.
This reverses the order of the checkout and setup actions so the setup
of Go itself is able to use the go.sum as a dependency as the newer
version expects.
This modifies the GitHub Action workflow to install golangci-lint from
source with go install instead of using the separate install script and
adds ~/.cache/golangci-lint to the saved cache for faster future runs.
The goal is to pin the dependency for the same reason the GitHub actions
are pinned by hash. Namely, it reduces potential security risks such as
compromised dependencies and dependency substitution attacks.
Using go install serves to pin the dependency because go verifies the
downloaded module contents against the original checksum hashes they
were first created with.
This separates the logic in run_tests.sh that runs all of the linters on
all modules in the repository to a separate lint.sh script and updates
run_tests.sh to call that script instead. Rather than listing every
linter in the script comments, it refers to the .golangci.yml
configuration file that specifies them now that it exists.
This allows developers to more easily selectively run only the linters
without needing to run all of the tests again.
It also cleans up the comments in run_test.sh to match reality while
here.
This makes use of the github actions cache to save and restore the Go
test and module caches. This should result in faster CI runs since most
changes only affect a small number of tests.
It also updates the RPC integration tests to ensure the logs directory
is not in the source code dir so the go testing cache can be used.
Next, it renames the txscript module's data dir to testdata so go does
not treat it like a package.
Finally, it adds a script that stabilizes the timestamps on all files in
testdata directories when running the github action. This is necessary
because the go testing cache logic uses the timestamps of all input
files when determining whether or not a test needs to be rerun and
github clones a fresh repo on every run which causes the timestamps of
the test data to change.
With the release of Go 1.18, the supported versions listed in the
README and used in the go.yml workflow should be 1.17 and 1.18.
Also update the golangci-lint to v1.45.2
The CI pipeline was previously downloading golangci-lint using the tool
goreleaser/godownloader which is now deprecated. This PR changes the GitHub
actions config file to use the latest recommended installation method.
This adds a pull request template which provides a checklist and links
to the code contribution guidelines to help contributors ensure they are
adhering to project standards.