File tree Expand file tree Collapse file tree 4 files changed +66
-9
lines changed
Expand file tree Collapse file tree 4 files changed +66
-9
lines changed Original file line number Diff line number Diff line change 1+ name : CI
2+
3+ on :
4+ push :
5+ branches :
6+ - " **"
7+ tags-ignore :
8+ - " v*"
9+ pull_request :
10+
11+ jobs :
12+ verify :
13+ runs-on : ubuntu-latest
14+ steps :
15+ - name : Checkout
16+ uses : actions/checkout@v4
17+
18+ - name : Set up Go
19+ uses : actions/setup-go@v5
20+ with :
21+ go-version-file : go.mod
22+
23+ - name : Run tests
24+ run : make test
25+
26+ - name : Run go vet
27+ run : make vet
28+
29+ - name : Run race tests
30+ run : make test-race
31+
32+ - name : Run coverage
33+ run : make cover
34+
35+ - name : Build CLI
36+ run : make build
37+
38+ - name : Upload coverage profile
39+ uses : actions/upload-artifact@v4
40+ with :
41+ name : coverage-profile
42+ path : coverage.out
Original file line number Diff line number Diff line change 2121 go-version-file : go.mod
2222
2323 - name : Run tests
24- run : go test ./...
24+ run : make test
2525
2626 - name : Build release assets
2727 run : |
Original file line number Diff line number Diff line change 1- BIN := bin/cloudcanal
1+ GO ?= go
2+ BIN ?= bin/cloudcanal
3+ PKG ?= ./...
4+ TEST_PKG ?= ./test/...
5+ COVER_PROFILE ?= coverage.out
26
3- .PHONY : build test clean
7+ .PHONY : build test vet test-race cover ci clean
48
59build :
610 mkdir -p $(dir $(BIN ) )
7- go build -o $(BIN ) ./cmd/cloudcanal
11+ $( GO ) build -o $(BIN ) ./cmd/cloudcanal
812
913test :
10- go test ./...
14+ $(GO ) test $(PKG )
15+
16+ vet :
17+ $(GO ) vet $(PKG )
18+
19+ test-race :
20+ $(GO ) test -race $(TEST_PKG )
21+
22+ cover :
23+ $(GO ) test -coverpkg=$(PKG ) -coverprofile=$(COVER_PROFILE ) $(TEST_PKG )
24+ $(GO ) tool cover -func=$(COVER_PROFILE )
25+
26+ ci : test vet test-race cover build
1127
1228clean :
13- rm -rf $(dir $(BIN ) )
29+ rm -rf $(dir $(BIN ) ) $( COVER_PROFILE )
Original file line number Diff line number Diff line change 5353fi
5454
5555STEP_NO=" 2/3"
56- run_step " Run tests" " test" go test ./...
56+ run_step " Run tests" " test" make test
5757
5858STEP_NO=" 3/3"
59- mkdir -p " $BIN_DIR "
60- run_step " Build CLI" " build" go build -o " $BIN_PATH " ./cmd/cloudcanal
59+ run_step " Build CLI" " build" make build
6160
6261log_success " Binary ready at $BIN_PATH "
6362print_run_summary " Build completed"
You can’t perform that action at this time.
0 commit comments