File tree Expand file tree Collapse file tree 1 file changed +30
-16
lines changed
Expand file tree Collapse file tree 1 file changed +30
-16
lines changed Original file line number Diff line number Diff line change 1- # This workflow will build a golang project
2- # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
3-
4- name : Go
1+ name : Go Build and Test
52
63on :
74 push :
8- branches : [ "main" ]
5+ branches :
6+ - main
97 pull_request :
10- branches : [ "main" ]
8+ branches :
9+ - main
1110
1211jobs :
13-
1412 build :
1513 runs-on : ubuntu-latest
14+
1615 steps :
17- - uses : actions/checkout@v4
16+ # Checkout the code from the repository
17+ - name : Checkout code
18+ uses : actions/checkout@v2
19+
20+ # Set up Go with the latest version (replace with your desired Go version)
21+ - name : Set up Go
22+ uses : actions/setup-go@v2
23+ with :
24+ go-version : ' 1.21' # Replace with the latest stable version
25+
26+ # Clear Go module cache
27+ - name : Clear Go module cache
28+ run : go clean -modcache
1829
19- - name : Set up Go
20- uses : actions/setup-go@v4
21- with :
22- go-version : ' 1.20'
30+ # Tidy and download modules
31+ - name : Tidy and download modules
32+ run : |
33+ go mod tidy
34+ go mod download
2335
24- - name : Build
25- run : go build -v ./...
36+ # Build the project
37+ - name : Build
38+ run : go build -v ./...
2639
27- - name : Test
28- run : go test -v ./...
40+ # Run tests (optional)
41+ - name : Run Tests
42+ run : go test -v ./...
You can’t perform that action at this time.
0 commit comments