mirror of
https://github.com/FlipsideCrypto/dcrd.git
synced 2026-02-06 10:56:47 +00:00
TravisCI: Test and lint latest version modules.
The current approach of the CI tests of specifying the path to the directory that contains the module only tests version 1 of the module despite there being newer version available. The same is true for the lints. This resolves the test portion by obtaining a list of all modules required by the root go.mod file and providing the entire module path, which includes the version, to the go test command instead of the directory. Unfortunately, the linter does not recognize full module paths, however it will lint the latest module version from within the module directory itself, so this resolves the linting case by stripping the full module path and version down to the directory and changing into the directory to perform the lint checks.
This commit is contained in:
parent
1d133626ba
commit
9df07027ae
29
run_tests.sh
29
run_tests.sh
@ -41,23 +41,28 @@ testrepo () {
|
||||
cp "$REPO" "$GOPATH/bin/"
|
||||
|
||||
# run tests on all modules
|
||||
ROOTPATH=$($GO list -m -f {{.Dir}} 2>/dev/null)
|
||||
ROOTPATH=$($GO list -m)
|
||||
ROOTPATHPATTERN=$(echo $ROOTPATH | sed 's/\\/\\\\/g' | sed 's/\//\\\//g')
|
||||
MODPATHS=$($GO list -m -f {{.Dir}} all 2>/dev/null | grep "^$ROOTPATHPATTERN"\
|
||||
| sed -e "s/^$ROOTPATHPATTERN//" -e 's/^\\//' -e 's/^\///')
|
||||
MODPATHS=". $MODPATHS"
|
||||
MODPATHS=$($GO list -m all | grep "^$ROOTPATHPATTERN" | cut -d' ' -f1)
|
||||
for module in $MODPATHS; do
|
||||
echo "==> ${module}"
|
||||
env CC=gcc $GO test -short -tags rpctest ./${module}/...
|
||||
env CC=gcc $GO test -short -tags rpctest ${module}/...
|
||||
|
||||
# check linters
|
||||
golangci-lint run --build-tags rpctest --disable-all --deadline=10m \
|
||||
--enable=gofmt \
|
||||
--enable=gosimple \
|
||||
--enable=unconvert \
|
||||
--enable=ineffassign \
|
||||
--enable=govet \
|
||||
--enable=misspell ./${module}/...
|
||||
MODNAME=$(echo $module | sed -e "s/^$ROOTPATHPATTERN//" \
|
||||
-e 's/^\///' -e 's/\/v[0-9]\+$//')
|
||||
if [ -z "$MODNAME" ]; then
|
||||
MODNAME=.
|
||||
fi
|
||||
(cd $MODNAME && \
|
||||
golangci-lint run --build-tags=rpctest --disable-all --deadline=10m \
|
||||
--enable=gofmt \
|
||||
--enable=gosimple \
|
||||
--enable=unconvert \
|
||||
--enable=ineffassign \
|
||||
--enable=govet \
|
||||
--enable=misspell \
|
||||
)
|
||||
done
|
||||
|
||||
echo "------------------------------------------"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user