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: Thane Thomson <connect@thanethomson.com> Signed-off-by: Thane Thomson <connect@thanethomson.com>
- Loading branch information
1 parent
6e5d5ac
commit e4d0b69
Showing
2 changed files
with
45 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Check for Go vulnerabilities | ||
# Runs https://pkg.go.dev/golang.org/x/vuln/cmd/govulncheck to proactively | ||
# check for vulnerabilities in code packages if there were any changes made to | ||
# any Go code or dependencies. | ||
# | ||
# Run `make vulncheck` from the root of the repo to run this workflow locally. | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
- release/** | ||
|
||
jobs: | ||
govulncheck: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: "1.18" | ||
- uses: actions/checkout@v3 | ||
- uses: technote-space/get-diff-action@v6 | ||
with: | ||
PATTERNS: | | ||
**/*.go | ||
go.mod | ||
go.sum | ||
Makefile | ||
- name: govulncheck | ||
run: make vulncheck | ||
if: "env.GIT_DIFF != ''" |
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 |
---|---|---|
@@ -1,37 +1,48 @@ | ||
GOPATH ?= $(shell go env GOPATH) | ||
BUILD_DIR ?= ./build | ||
.PHONY: build build-tm-load-test build-tm-outage-sim-server \ | ||
build-linux build-tm-load-test-linux build-tm-outage-sim-server-linux \ | ||
test lint clean | ||
.DEFAULT_GOAL := build | ||
BUILD_FLAGS ?= -mod=readonly | ||
|
||
build: build-tm-load-test build-tm-outage-sim-server | ||
.PHONY: build | ||
|
||
build-tm-load-test: | ||
@go build $(BUILD_FLAGS) \ | ||
-ldflags "-X github.com/informalsystems/tm-load-test/pkg/loadtest.cliVersionCommitID=`git rev-parse --short HEAD`" \ | ||
-o $(BUILD_DIR)/tm-load-test ./cmd/tm-load-test/main.go | ||
.PHONY: build-tm-load-test | ||
|
||
build-tm-outage-sim-server: | ||
@go build $(BUILD_FLAGS) -o $(BUILD_DIR)/tm-outage-sim-server ./cmd/tm-outage-sim-server/main.go | ||
.PHONY: built-tm-outage-sim-server | ||
|
||
build-linux: build-tm-load-test-linux build-tm-outage-sim-server-linux | ||
.PHONY: build-linux | ||
|
||
build-tm-load-test-linux: | ||
GOOS=linux GOARCH=amd64 $(MAKE) build-tm-load-test | ||
.PHONY: build-tm-load-test-linux | ||
|
||
build-tm-outage-sim-server-linux: | ||
GOOS=linux GOARCH=amd64 $(MAKE) build-tm-outage-sim-server | ||
.PHONY: build-tm-outage-sim-server-linux | ||
|
||
test: | ||
go test -cover -race ./... | ||
.PHONY: test | ||
|
||
bench: | ||
go test -bench="Benchmark" -run="notests" ./... | ||
.PHONY: bench | ||
|
||
lint: | ||
golangci-lint run ./... | ||
.PHONY: lint | ||
|
||
clean: | ||
rm -rf $(BUILD_DIR) | ||
.PHONY: clean | ||
|
||
vulncheck: | ||
@go run golang.org/x/vuln/cmd/govulncheck@latest ./... | ||
.PHONY: vulncheck |