Skip to content

Commit 3d4dbd2

Browse files
authored
Update go.yml
1 parent 9098104 commit 3d4dbd2

File tree

1 file changed

+30
-16
lines changed

1 file changed

+30
-16
lines changed

.github/workflows/go.yml

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,42 @@
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

63
on:
74
push:
8-
branches: [ "main" ]
5+
branches:
6+
- main
97
pull_request:
10-
branches: [ "main" ]
8+
branches:
9+
- main
1110

1211
jobs:
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 ./...

0 commit comments

Comments
 (0)