| 1 |
version: 2.1 |
| 2 |
|
| 3 |
orbs: |
| 4 |
go: circleci/[email protected] |
| 5 |
|
| 6 |
references: |
| 7 |
environments: |
| 8 |
tmp: &TEST_RESULTS_PATH /tmp/test-results |
| 9 |
|
| 10 |
environment: &ENVIRONMENT |
| 11 |
TEST_RESULTS: "/tmp/test-results" |
| 12 |
|
| 13 |
jobs: |
| 14 |
run-tests: |
| 15 |
executor: |
| 16 |
name: go/default |
| 17 |
tag: << parameters.go-version >> |
| 18 |
parameters: |
| 19 |
go-version: |
| 20 |
type: string |
| 21 |
environment: |
| 22 |
TEST_RESULTS: *TEST_RESULTS_PATH |
| 23 |
steps: |
| 24 |
- checkout |
| 25 |
- run: mkdir -p $TEST_RESULTS/go-retryablyhttp |
| 26 |
- go/load-cache |
| 27 |
- go/mod-download |
| 28 |
- go/save-cache |
| 29 |
- run: |
| 30 |
name: Run go format |
| 31 |
command: | |
| 32 |
files=$(go fmt ./...) |
| 33 |
if [ -n "$files" ]; then |
| 34 |
echo "The following file(s) do not conform to go fmt:" |
| 35 |
echo "$files" |
| 36 |
exit 1 |
| 37 |
fi |
| 38 |
- run: |
| 39 |
name: Run tests with gotestsum |
| 40 |
command: | |
| 41 |
PACKAGE_NAMES=$(go list ./...) |
| 42 |
gotestsum --format=short-verbose --junitfile $TEST_RESULTS/go-retryablyhttp/gotestsum-report.xml -- $PACKAGE_NAMES |
| 43 |
- store_test_results: |
| 44 |
path: *TEST_RESULTS_PATH |
| 45 |
- store_artifacts: |
| 46 |
path: *TEST_RESULTS_PATH |
| 47 |
|
| 48 |
workflows: |
| 49 |
go-retryablehttp: |
| 50 |
jobs: |
| 51 |
- run-tests: |
| 52 |
matrix: |
| 53 |
parameters: |
| 54 |
go-version: ["1.14.2"] |
| 55 |
name: test-go-<< matrix.go-version >> |