e2e5e16ff2
* ci: break config into separate files * Untangle githooks * githooks: fix whitespace * .hooks/pre-commit: add ui -> lint-staged check - We no longer require dependency on husky with this change. * ui: remove husky dependency and config - The previous commit obviates the need for it. - We will now have to manage these hooks by hand, but this removes the conflict between husky-installed hooks and those in the .hooks dir. * ui: update yarn.lock with husky removed * .hooks/pre-commit: always use subshell + docs - Always use subshell means we consistently exit from the same place which feels less complex. - Docs are necessary for horrible bash like this I think... * Makefile: remove old husky githooks - Husky has installed a handler for every single git hook. - This causes warnings on every git operation. - Eventually we can remove this, but better not to confuse people with these messages for now. * ci: fix go build tags * Makefile: improve compatibility of rm call - Looks like the xargs in Travis does something different to the one on my mac, this more verbose call should be safe everywhere. * ci: fix make target names * ci: fix test-ui invocation * Makefile: simplify husky hook cleanup * ci: more focussed readme
56 lines
1.9 KiB
YAML
56 lines
1.9 KiB
YAML
description: run go tests
|
|
parameters:
|
|
extra_flags:
|
|
type: string
|
|
default: ""
|
|
steps:
|
|
- run:
|
|
name: Run Go tests
|
|
no_output_timeout: 20m
|
|
command: |
|
|
set -eux -o pipefail
|
|
|
|
# Install Go
|
|
curl -sSLO "https://dl.google.com/go/go${GO_VERSION}.linux-amd64.tar.gz"
|
|
sudo rm -rf /usr/local/go
|
|
sudo tar -C /usr/local -xzf "go${GO_VERSION}.linux-amd64.tar.gz"
|
|
rm -f "go${GO_VERSION}.linux-amd64.tar.gz"
|
|
export GOPATH=/go
|
|
export PATH="${PATH}:${GOPATH}/bin:/usr/local/go/bin"
|
|
|
|
# Install CircleCI CLI
|
|
curl -sSL \
|
|
"https://github.com/CircleCI-Public/circleci-cli/releases/download/v${CIRCLECI_CLI_VERSION}/circleci-cli_${CIRCLECI_CLI_VERSION}_linux_amd64.tar.gz" \
|
|
| sudo tar --overwrite -xz \
|
|
-C /usr/local/bin \
|
|
"circleci-cli_${CIRCLECI_CLI_VERSION}_linux_amd64/circleci"
|
|
|
|
# Split Go tests by prior test times
|
|
package_names=$(go list \
|
|
-tags "${GO_TAGS}" \
|
|
./... \
|
|
| grep -v /integ \
|
|
| grep -v /vendor/ \
|
|
| sort \
|
|
| circleci tests split --split-by=timings --timings-type=classname)
|
|
|
|
# Install gotestsum
|
|
curl -sSL "https://github.com/gotestyourself/gotestsum/releases/download/v${GOTESTSUM_VERSION}/gotestsum_${GOTESTSUM_VERSION}_linux_amd64.tar.gz" \
|
|
| sudo tar --overwrite -xz -C /usr/local/bin gotestsum
|
|
|
|
# Run tests
|
|
make prep
|
|
mkdir -p test-results/go-test
|
|
CGO_ENABLED= \
|
|
VAULT_ADDR= \
|
|
VAULT_TOKEN= \
|
|
VAULT_DEV_ROOT_TOKEN_ID= \
|
|
VAULT_ACC= \
|
|
gotestsum --format=short-verbose --junitfile test-results/go-test/results.xml -- \
|
|
-tags "${GO_TAGS}" \
|
|
-timeout=40m \
|
|
-parallel=20 \
|
|
<< parameters.extra_flags >> \
|
|
${package_names}
|
|
|