Merge pull request #5 from ts170710/hhtest #24
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
on: [push, pull_request] | |
name: Unit Testing | |
permissions: | |
contents: read | |
jobs: | |
test: | |
permissions: | |
checks: write # for shogo82148/actions-goveralls to create a new check based on the results | |
contents: read # for actions/checkout to fetch code | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
go-version: | |
- "1.14" | |
- "1" | |
env: | |
GO111MODULE: "on" | |
steps: | |
- name: Setup Go ${{ matrix.go-version }} | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- uses: actions/checkout@v3 | |
- name: Setup environment | |
run: | | |
# Changing into a different directory to avoid polluting go.sum with "go get" | |
cd "$(mktemp -d)" | |
go mod init unit_tests | |
# we use "go get" for Go v1.14 | |
go install github.com/wadey/gocovmerge@master || go get github.com/wadey/gocovmerge | |
go install golang.org/x/tools/cmd/goimports@latest || go get golang.org/x/tools/cmd/goimports@v0.8.0 | |
- name: Run go vet | |
run: | | |
go vet ./... | |
- name: Run unit tests | |
run: | | |
./script/coverage | |
./script/format | |
./script/unittest -v | |
- uses: shogo82148/actions-goveralls@v1 | |
with: | |
path-to-profile: cover.out | |
flag-name: Go-${{ matrix.go-version }} | |
parallel: true | |
finish: | |
permissions: | |
checks: write # for shogo82148/actions-goveralls to create a new check based on the results | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: shogo82148/actions-goveralls@v1 | |
with: | |
parallel-finished: true |