Skip to content

Commit 932f7f1

Browse files
committed
Refactor GitHub Actions into two workflows, ci to run tests on push, release to build on tags
1 parent 2b5b225 commit 932f7f1

2 files changed

Lines changed: 39 additions & 10 deletions

File tree

.github/workflows/ci.yml

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

.github/workflows/release.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
name: Build and Release
1+
name: Release
22

33
on:
44
push:
5-
branches: [ main, develop ]
65
tags:
76
- 'v*'
8-
pull_request:
9-
branches: [ main ]
107

118
jobs:
129
test:
@@ -23,9 +20,7 @@ jobs:
2320
- name: Cache Go modules
2421
uses: actions/cache@v4
2522
with:
26-
path: |
27-
~/.cache/go-build
28-
~/go/pkg/mod
23+
path: ~/go/pkg/mod
2924
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
3025
restore-keys: |
3126
${{ runner.os }}-go-
@@ -55,9 +50,7 @@ jobs:
5550
- name: Cache Go modules
5651
uses: actions/cache@v4
5752
with:
58-
path: |
59-
~/.cache/go-build
60-
~/go/pkg/mod
53+
path: ~/go/pkg/mod
6154
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
6255
restore-keys: |
6356
${{ runner.os }}-go-

0 commit comments

Comments
 (0)