Skip to content

Commit fb7b0cc

Browse files
committed
feat: enhance GitHub Actions test workflow and update version
- Add manual trigger support with workflow_dispatch - Implement Go version matrix testing (1.20, 1.21) - Add comprehensive caching for Go modules - Upgrade actions/setup-go to v5 - Add multi-OS testing matrix (Ubuntu, Windows, macOS) - Update Makefile version to match latest release (1.0.2) - Ensure consistent testing across environments
1 parent b9cb959 commit fb7b0cc

File tree

2 files changed

+30
-19
lines changed

2 files changed

+30
-19
lines changed

.github/workflows/test.yml

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,26 @@ on:
55
branches: [ main ]
66
pull_request:
77
branches: [ main ]
8+
workflow_dispatch:
9+
# Enables manual triggering
810

911
jobs:
1012
test:
1113
runs-on: ubuntu-latest
12-
14+
15+
strategy:
16+
matrix:
17+
go-version: [ '1.20', '1.21' ]
18+
1319
steps:
14-
- uses: actions/checkout@v4
15-
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
1623
- name: Set up Go
17-
uses: actions/setup-go@v4
24+
uses: actions/setup-go@v5
1825
with:
19-
go-version: '1.21'
20-
26+
go-version: ${{ matrix.go-version }}
27+
2128
- name: Cache Go modules
2229
uses: actions/cache@v3
2330
with:
@@ -27,41 +34,45 @@ jobs:
2734
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
2835
restore-keys: |
2936
${{ runner.os }}-go-
30-
37+
38+
- name: Download dependencies
39+
run: go mod download
40+
3141
- name: Run tests
3242
run: go test -v ./...
33-
43+
3444
- name: Run go vet
3545
run: go vet ./...
36-
46+
3747
- name: Run go fmt
3848
run: |
3949
if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then
4050
echo "The following files are not formatted:"
4151
gofmt -s -l .
4252
exit 1
4353
fi
44-
54+
4555
- name: Build
4656
run: go build -v .
4757

4858
test-multiple-os:
4959
runs-on: ${{ matrix.os }}
5060
strategy:
5161
matrix:
52-
os: [ubuntu-latest, windows-latest, macos-latest]
53-
go-version: ['1.21', '1.22']
54-
62+
os: [ ubuntu-latest, windows-latest, macos-latest ]
63+
go-version: [ '1.21', '1.22' ]
64+
5565
steps:
56-
- uses: actions/checkout@v4
57-
66+
- name: Checkout code
67+
uses: actions/checkout@v4
68+
5869
- name: Set up Go
59-
uses: actions/setup-go@v4
70+
uses: actions/setup-go@v5
6071
with:
6172
go-version: ${{ matrix.go-version }}
62-
73+
6374
- name: Build
6475
run: go build -v .
65-
76+
6677
- name: Test
6778
run: go test -v ./...

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
APP=kdiff
2-
VERSION=0.1.0
2+
VERSION=1.0.2
33
COMMIT=$(shell git rev-parse --short HEAD 2>/dev/null || echo "none")
44
DATE=$(shell date -u +%Y-%m-%dT%H:%M:%SZ)
55

0 commit comments

Comments
 (0)