-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Alberto Ricart <[email protected]>
- Loading branch information
Showing
2 changed files
with
15 additions
and
47 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,26 +60,10 @@ jobs: | |
go-version: ${{ matrix.go }} | ||
# We're not doing releases, just checks, so we can live without check-latest here | ||
|
||
- name: Export Go environment to Actions outputs | ||
id: go-settings | ||
run: | | ||
echo "::set-output name=arch::$(go env GOARCH)" | ||
echo "::set-output name=hostarch::$(go env GOHOSTARCH)" | ||
echo "::set-output name=os::$(go env GOOS)" | ||
echo "::set-output name=hostos::$(go env GOHOSTOS)" | ||
echo "::set-output name=go-version::$(go env GOVERSION)" | ||
# Use with: | ||
# ${{ steps.go-settings.outputs.go-version }} | ||
# which will look like `go1.17.1` if matrix `1.17.x` matches `1.17.1`. | ||
# These are independent of how the matrix is setup, or if a matrix is even used. | ||
# | ||
# You can see the individual values in the "Set up Go" output, collapsed inside a "go env" group at the end. | ||
|
||
- name: Install additional check/lint tools | ||
id: tools-install | ||
run: | | ||
go install github.com/mattn/goveralls@latest | ||
go install github.com/wadey/gocovmerge@latest | ||
go install honnef.co/go/tools/cmd/[email protected] | ||
if: matrix.canonical | ||
|
||
|
@@ -92,38 +76,21 @@ jobs: | |
- name: Run Tests (with coverage enabled) | ||
id: coverage | ||
run: | | ||
mkdir cov | ||
echo "::group::Coverage of ./cmd" | ||
go test -v -failfast -covermode=atomic -coverprofile=./cov/cmd.out ./cmd | ||
echo "::endgroup::" | ||
echo "::group::Coverage of ./cmd/store" | ||
go test -v -failfast -covermode=atomic -coverprofile=./cov/store.out ./cmd/store | ||
echo "::endgroup::" | ||
if: runner.os != 'Windows' | ||
go test -v -failfast -coverpkg=./... -coverprofile=./coverage.out ./... | ||
# if: runner.os != 'Windows' | ||
|
||
- name: Run Tests (Windows) | ||
id: wintest | ||
# nb2: if we use the coverage approach on Windows, the -coverprofile flag appears to be looked for as a package, and I've no idea why (am not a Windows dev) | ||
# cannot find package "github.com/nats-io/nsc/cov/cmd.out" in any of: | ||
# C:\hostedtoolcache\windows\go\1.16.13\x64\src\github.com\nats-io\nsc\cov\cmd.out (from $GOROOT) | ||
# D:\a\nsc\nsc\go\src\github.com\nats-io\nsc\cov\cmd.out (from $GOPATH) | ||
run: | | ||
echo "::group::Testing of ./cmd" | ||
go test -v -failfast ./cmd | ||
echo "::endgroup::" | ||
echo "::group::Testing of ./cmd/store" | ||
go test -v -failfast ./cmd/store | ||
echo "::endgroup::" | ||
if: runner.os == 'Windows' | ||
# - name: Run Tests (windows) | ||
# run: | | ||
# go test -v -failfast ./... | ||
# if: runner.os == 'Windows' | ||
|
||
- name: Upload coverage results | ||
id: coverage-upload | ||
run: | | ||
gocovmerge ./cov/*.out > coverage.out | ||
goveralls -coverprofile=coverage.out -service=github | ||
env: | ||
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
if: matrix.canonical | ||
- name: Upload coverage | ||
uses: coverallsapp/github-action@v2 | ||
continue-on-error: true | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
flag-name: ${{ matrix.module }} | ||
file: ./coverage.out | ||
|
||
- name: Bad versions creep defense | ||
id: go-module-versions | ||
|
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