ci: small improvements
Run 'go mod download' first so that dependencies are pulled in a separate step. This makes the test splitting and test output easier to scroll through. Remove test splitting from the api/sdk test runs. These jobs do not use parallelism, so there is no test timing data injected into the job. They can't be split. Remove the dependencies from the go-test job, so that we can start the slowest test job earlier in the workflow.
This commit is contained in:
parent
db1fb95f21
commit
62ed95fbef
|
@ -89,14 +89,21 @@ jobs:
|
|||
- checkout
|
||||
- attach_workspace:
|
||||
at: /go/bin
|
||||
- run: mkdir -p $TEST_RESULTS_DIR
|
||||
- run: sudo apt-get update && sudo apt-get install -y rsyslog
|
||||
- run: sudo service rsyslog start
|
||||
- run: |
|
||||
- run: go mod download
|
||||
- run:
|
||||
name: go test
|
||||
command: |
|
||||
mkdir -p $TEST_RESULTS_DIR
|
||||
PACKAGE_NAMES=$(go list ./... | circleci tests split --split-by=timings --timings-type=classname)
|
||||
echo "Running $(echo $PACKAGE_NAMES | wc -w) packages"
|
||||
echo $PACKAGE_NAMES
|
||||
gotestsum --format=short-verbose --junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- -tags="$GOTAGS" -p 2 -cover -coverprofile=cov_$CIRCLE_NODE_INDEX.part $PACKAGE_NAMES
|
||||
gotestsum --format=short-verbose \
|
||||
--junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- \
|
||||
-tags="$GOTAGS" -p 2 \
|
||||
-cover -coverprofile=cov_$CIRCLE_NODE_INDEX.part \
|
||||
$PACKAGE_NAMES
|
||||
|
||||
# save coverage report parts
|
||||
- persist_to_workspace:
|
||||
|
@ -120,12 +127,17 @@ jobs:
|
|||
- checkout
|
||||
- attach_workspace:
|
||||
at: /go/bin
|
||||
- run: mkdir -p $TEST_RESULTS_DIR
|
||||
- run: go mod download
|
||||
- run:
|
||||
working_directory: api
|
||||
name: go test
|
||||
command: |
|
||||
PACKAGE_NAMES=$(go list ./... | circleci tests split --split-by=timings --timings-type=classname)
|
||||
gotestsum --format=short-verbose --junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- -tags="$GOTAGS" -cover -coverprofile=cov_api.part $PACKAGE_NAMES
|
||||
mkdir -p $TEST_RESULTS_DIR
|
||||
gotestsum \
|
||||
--format=short-verbose \
|
||||
--junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- \
|
||||
-tags="$GOTAGS" -cover -coverprofile=cov_api.part \
|
||||
./...
|
||||
|
||||
# save coverage report parts
|
||||
- persist_to_workspace:
|
||||
|
@ -149,12 +161,17 @@ jobs:
|
|||
- checkout
|
||||
- attach_workspace:
|
||||
at: /go/bin
|
||||
- run: mkdir -p $TEST_RESULTS_DIR
|
||||
- run: go mod download
|
||||
- run:
|
||||
working_directory: sdk
|
||||
name: go test
|
||||
command: |
|
||||
PACKAGE_NAMES=$(go list ./... | circleci tests split --split-by=timings --timings-type=classname)
|
||||
gotestsum --format=short-verbose --junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- -tags=$GOTAGS -cover -coverprofile=cov_sdk.part $PACKAGE_NAMES
|
||||
mkdir -p $TEST_RESULTS_DIR
|
||||
gotestsum \
|
||||
--format=short-verbose \
|
||||
--junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- \
|
||||
-tags=$GOTAGS -cover -coverprofile=cov_sdk.part \
|
||||
./...
|
||||
|
||||
# save coverage report parts
|
||||
- persist_to_workspace:
|
||||
|
@ -177,10 +194,10 @@ jobs:
|
|||
- checkout
|
||||
- attach_workspace:
|
||||
at: .
|
||||
- run: mkdir -p $TEST_RESULTS_DIR
|
||||
- run:
|
||||
name: merge coverage reports
|
||||
command: |
|
||||
mkdir -p $TEST_RESULTS_DIR
|
||||
echo "mode: set" > coverage.out
|
||||
grep -h -v "mode: set" cov_*.part >> coverage.out
|
||||
go tool cover -html=coverage.out -o $TEST_RESULTS_DIR/coverage.html
|
||||
|
@ -328,9 +345,6 @@ jobs:
|
|||
- attach_workspace:
|
||||
at: /go/bin
|
||||
|
||||
# make test result directory
|
||||
- run: mkdir -p $TEST_RESULTS_DIR
|
||||
|
||||
# make dev build of nomad
|
||||
- run:
|
||||
command: make pkg/linux_amd64/nomad
|
||||
|
@ -341,7 +355,13 @@ jobs:
|
|||
|
||||
# run integration tests
|
||||
- run:
|
||||
command: gotestsum --format=short-verbose --junitfile $TEST_RESULTS_DIR/results.xml -- ./command/agent/consul -run TestConsul
|
||||
name: go test
|
||||
command: |
|
||||
mkdir -p $TEST_RESULTS_DIR
|
||||
gotestsum \
|
||||
--format=short-verbose \
|
||||
--junitfile $TEST_RESULTS_DIR/results.xml -- \
|
||||
./command/agent/consul -run TestConsul
|
||||
working_directory: *NOMAD_WORKING_DIR
|
||||
|
||||
# store test results for CircleCI
|
||||
|
@ -612,17 +632,19 @@ jobs:
|
|||
environment:
|
||||
<<: *ENVIRONMENT
|
||||
steps:
|
||||
# Install vault
|
||||
- run: |
|
||||
- run:
|
||||
name: Install vault
|
||||
command: |
|
||||
wget -q -O /tmp/vault.zip https://releases.hashicorp.com/vault/${VAULT_BINARY_VERSION}/vault_${VAULT_BINARY_VERSION}_linux_amd64.zip
|
||||
sudo unzip -d /usr/local/bin /tmp/vault.zip
|
||||
rm -rf /tmp/vault*
|
||||
# Create directory to store test results
|
||||
- run: mkdir -p $TEST_RESULTS_DIR
|
||||
# Gather deps to run go tests
|
||||
- checkout
|
||||
# Run go tests
|
||||
- run: make test-connect-ca-providers
|
||||
- run: go mod download
|
||||
- run:
|
||||
name: go test
|
||||
command: |
|
||||
mkdir -p $TEST_RESULTS_DIR
|
||||
make test-connect-ca-providers
|
||||
- store_test_results:
|
||||
path: *TEST_RESULTS_DIR
|
||||
|
||||
|
@ -658,19 +680,17 @@ workflows:
|
|||
- /^ui\/.*/
|
||||
- lint
|
||||
- dev-build
|
||||
- go-test: &go-test
|
||||
requires:
|
||||
- dev-build
|
||||
- lint
|
||||
- check-vendor
|
||||
- go-test-api: *go-test
|
||||
- go-test-sdk: *go-test
|
||||
- go-test:
|
||||
requires: [dev-build]
|
||||
- go-test-api:
|
||||
requires: [dev-build]
|
||||
- go-test-sdk
|
||||
- coverage-merge:
|
||||
requires:
|
||||
- go-test
|
||||
- go-test-api
|
||||
- go-test-sdk
|
||||
- test-connect-ca-providers: *go-test
|
||||
- test-connect-ca-providers
|
||||
|
||||
build-distros:
|
||||
jobs:
|
||||
|
|
Loading…
Reference in New Issue