forked from txaty/go-merkletree
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request txaty#1 from elliotwutingfeng/main
1. Add helper Makefile for running tests/benchmarks, 2. Increase test coverage, 3. Bump GitHub Actions versions.
- Loading branch information
Showing
5 changed files
with
128 additions
and
92 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 |
---|---|---|
|
@@ -16,13 +16,13 @@ jobs: | |
- name: Set up Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: 1.19 | ||
go-version-file: './go.mod' | ||
|
||
- name: Build | ||
run: go build -v ./... | ||
run: make build | ||
|
||
- name: Test | ||
run: go test -v ./... | ||
run: make tests_race | ||
|
||
- name: Run golangci-lint | ||
# You may pin to the exact commit or the version. | ||
|
@@ -34,17 +34,17 @@ jobs: | |
name: Update coverage badge | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v3 | ||
with: | ||
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token. | ||
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. | ||
|
||
- name: Setup go | ||
uses: actions/setup-go@v2 | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.14.4' | ||
go-version-file: './go.mod' | ||
|
||
- uses: actions/cache@v2 | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
|
@@ -53,16 +53,15 @@ jobs: | |
- name: Run Test | ||
run: | | ||
go test -v ./... -covermode=count -coverprofile=coverage.out | ||
go tool cover -func=coverage.out -o=coverage.out | ||
make tests_race | ||
- name: Go Coverage Badge # Pass the `coverage.out` output to this action | ||
uses: tj-actions/[email protected] | ||
with: | ||
filename: coverage.out | ||
|
||
- name: Verify Changed files | ||
uses: tj-actions/verify-changed-files@v9.1 | ||
uses: tj-actions/verify-changed-files@v10.1 | ||
id: verify-changed-files | ||
with: | ||
files: README.md | ||
|
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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
tests: | ||
go test -v -covermode count -coverprofile coverage.out && go tool cover -html coverage.out -o coverage.html && go tool cover -func coverage.out -o coverage.out | ||
|
||
tests_race: | ||
go test -v -race -covermode atomic -coverprofile coverage.out && go tool cover -html coverage.out -o coverage.html && go tool cover -func coverage.out -o coverage.out | ||
|
||
format: | ||
go fmt . | ||
|
||
bench: | ||
go test -bench . -benchmem -cpu 1 | ||
|
||
report_bench: | ||
go test -cpuprofile cpu.prof -memprofile mem.prof -bench . -cpu 1 | ||
|
||
cpu_report: | ||
go tool pprof cpu.prof | ||
|
||
mem_report: | ||
go tool pprof mem.prof | ||
|
||
build: | ||
go build -v ./... |
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
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