Run tests and linters against a hard-coded set of local submodules instead of attempting to find submodules dynamically. While this has the obvious drawback of needing to manually update the list of submodules, it greatly simplifies the script by removing a bunch of regexes and string manipulation. This trade-off seems worthwhile because the list of submodules in this repo will not be something which changes often. This change makes the script less brittle because it is hard-coded to always run against the local code, regardless of any changes to module versionining or project dependencies.
47 lines
871 B
Bash
Executable File
47 lines
871 B
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Copyright (c) 2020-2024 The Decred developers
|
|
# Use of this source code is governed by an ISC
|
|
# license that can be found in the LICENSE file.
|
|
#
|
|
# Usage:
|
|
# ./run_tests.sh
|
|
|
|
set -e
|
|
|
|
go version
|
|
|
|
# This list needs to be updated if new submodules are added to the vspd repo.
|
|
submodules="client types"
|
|
|
|
# Test main module.
|
|
echo "==> test main module"
|
|
GORACE="halt_on_error=1" go test -race ./...
|
|
|
|
# Test all submodules in a subshell.
|
|
for module in $submodules
|
|
do
|
|
echo "==> test ${module}"
|
|
(
|
|
cd $module
|
|
GORACE="halt_on_error=1" go test -race .
|
|
)
|
|
done
|
|
|
|
# Lint main module.
|
|
echo "==> lint main module"
|
|
golangci-lint run
|
|
|
|
# Lint all submodules in a subshell.
|
|
for module in $submodules
|
|
do
|
|
echo "==> lint ${module}"
|
|
(
|
|
cd $module
|
|
golangci-lint run
|
|
)
|
|
done
|
|
|
|
echo "-----------------------------"
|
|
echo "Tests completed successfully!"
|