Skip to content

Commit 20e01be

Browse files
authored
Create go.yml
1 parent be9e2d5 commit 20e01be

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

.github/workflows/go.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Go CLI
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Go
18+
uses: actions/setup-go@v5
19+
with:
20+
go-version: '1.22' # adjust to your Go version
21+
22+
- name: Cache Go modules
23+
uses: actions/cache@v4
24+
with:
25+
path: |
26+
~/go/pkg/mod
27+
~/.cache/go-build
28+
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
29+
restore-keys: |
30+
${{ runner.os }}-go-
31+
32+
- name: Install dependencies
33+
run: go mod tidy
34+
35+
- name: Run build
36+
run: go build ./...
37+
38+
- name: Run tests
39+
run: go test ./... -v

0 commit comments

Comments
 (0)