Skip to content

Merge pull request #155 from mkevac/patch-1 #50

Merge pull request #155 from mkevac/patch-1

Merge pull request #155 from mkevac/patch-1 #50

name: Build
on:
push:
jobs:
run-tests:
runs-on: ubuntu-latest
env:
TEST_RESULTS: "/tmp/test-results"
steps:
- name: Setup go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: 1.18
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- run: mkdir -p "$TEST_RESULTS"/go-retryablyhttp
- name: restore_cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
key: go-mod-v1-{{ checksum "go.sum" }}
restore-keys: go-mod-v1-{{ checksum "go.sum" }}
path: "/go/pkg/mod"
- run: go mod download
- run: go mod tidy
- name: Run go format
run: |-
files=$(go fmt ./...)
if [ -n "$files" ]; then
echo "The following file(s) do not conform to go fmt:"
echo "$files"
exit 1
fi
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Run unit tests
run: |-
PACKAGE_NAMES=$(go list ./...)
# shellcheck disable=SC2086 # can't quote package list
gotestsum --junitfile "${TEST_RESULTS}"/go-retryablyhttp/gotestsum-report.xml -- $PACKAGE_NAMES
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
path: "/tmp/test-results"
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
path: "/tmp/test-results"
permissions:
contents: read