ci: Run go tests in github action (#2997)

This runs the make targets:

- make test
- make test-api
- make test-sdk

The go tests in the main module are split by package and run in parallel
in a matrix build with GOMAXPROCS=1. This is done primarily to work
around an issue that is only seen on the github runners.  When running
at a higher GOMAXPROCS tests that use vault instances in docker
containers start to intermitently fail with errors from vault, usually
either a 400, 403, or TLS error. It is not clear what the cause of this
is, since the same tests run fine on self hosted runners and on
CircleCI.

Co-authored-by: Sarah Thompson <sthompson@hashicorp.com>
Co-authored-by: Daniel Kimsey <daniel.kimsey@hashicorp.com>
This commit is contained in:
authored and GitHub committed 2023-02-23 14:58:40 -05:00
1 parent 5ec75924df
commit 86214a85e1
4 files changed
+207 -3

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail
# set matrix var to list of unique packages containing tests
matrix="$(go list -json="ImportPath,TestGoFiles" ./... | jq --compact-output '. | select(.TestGoFiles != null) | .ImportPath' | jq --slurp --compact-output '.')"
echo "matrix=${matrix}" | tee -a "${GITHUB_OUTPUT}"