Add development scripts #3369
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
concurrency: | |
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
name: tests | |
env: | |
GO111MODULE: on | |
permissions: | |
contents: read | |
jobs: | |
test: | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
matrix: | |
go-version: [1.x, 1.20.x] | |
platform: [ubuntu-latest] | |
include: | |
# include windows, but only with the latest Go version, since there | |
# is very little in the library that is platform specific | |
- go-version: 1.x | |
platform: windows-latest | |
# only update test coverage stats with the most recent go version on linux | |
- go-version: 1.x | |
platform: ubuntu-latest | |
update-coverage: true | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- uses: actions/checkout@v4 | |
# Get values for cache paths to be used in later steps | |
- id: cache-paths | |
run: | | |
echo "go-cache=$(go env GOCACHE)" >> $GITHUB_OUTPUT | |
echo "go-mod-cache=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT | |
- name: Cache go modules | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ steps.cache-paths.outputs.go-cache }} | |
${{ steps.cache-paths.outputs.go-mod-cache }} | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: ${{ runner.os }}-go- | |
- name: Run go test | |
run: | | |
if [ -n "${{ matrix.update-coverage }}" ]; then | |
scripts/test -race -covermode atomic -coverprofile coverage.txt ./... | |
exit | |
fi | |
scripts/test -race -covermode atomic ./... | |
- name: Ensure integration tests build | |
# don't actually run tests since they hit live GitHub API | |
run: go test -v -tags=integration -run=^$ ./test/integration | |
- name: Upload coverage to Codecov | |
if: ${{ matrix.update-coverage }} | |
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d #v3.1.4 |