7
7
pull_request :
8
8
9
9
env :
10
- GO_VERSION : 1.22
11
10
GOLANGCI_LINT_VERSION : v1.54.2
12
11
13
12
jobs :
14
13
setup :
15
14
runs-on : ubuntu-latest
16
- outputs :
17
- go-path : ${{ steps.set-go-path.outputs.go-path }}
18
15
steps :
19
16
- name : Checkout code
20
- uses : actions/checkout@v3
17
+ uses : actions/checkout@v4
21
18
22
19
- name : Set up Go
23
20
id : set-go
24
- uses : actions/setup-go@v4
21
+ uses : actions/setup-go@v5
25
22
with :
26
- go-version : ${{env.GO_VERSION}}
27
-
28
- - name : Install Mage
29
- id : set-go-path
30
- run : |
31
- go install github.com/magefile/mage@latest
32
- echo "$HOME/go/bin" >> $GITHUB_PATH # Add Go binaries to the PATH
33
- echo "::set-output name=go-path::$HOME/go/bin"
23
+ go-version-file : go.mod
34
24
35
25
build :
36
26
runs-on : ubuntu-latest
37
- needs : setup # This job will run after the setup job completes
27
+ needs : setup
38
28
steps :
39
29
- name : Checkout code
40
30
uses : actions/checkout@v3
41
31
32
+ - name : Run Mage
33
+ uses : magefile/mage-action@v3
34
+
42
35
- name : Build
43
36
run : |
44
37
mage -v build
45
38
46
39
lint :
47
40
runs-on : ubuntu-latest
48
- needs : setup # This job will run after the setup job completes
41
+ needs : setup
49
42
steps :
50
43
- name : Checkout code
51
44
uses : actions/checkout@v3
@@ -55,13 +48,16 @@ jobs:
55
48
wget -qO - https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ${{ needs.setup.outputs.go-path }} ${{env.GOLANGCI_LINT_VERSION}}
56
49
echo "$HOME/go/bin" >> $GITHUB_PATH # Add golangci-lint to the PATH
57
50
51
+ - name : Run Mage
52
+ uses : magefile/mage-action@v3
53
+
58
54
- name : Lint
59
55
run : |
60
56
mage -v lint # Run your lint command, which uses golangci-lint
61
57
62
58
test :
63
59
runs-on : ubuntu-latest
64
- needs : setup # This job will run after the setup job completes
60
+ needs : setup
65
61
steps :
66
62
- name : Checkout code
67
63
uses : actions/checkout@v3
71
67
sudo apt update
72
68
sudo apt install -y gcc
73
69
70
+ - name : Run Mage
71
+ uses : magefile/mage-action@v3
72
+
74
73
- name : Test
75
74
run : |
76
75
CGO_ENABLED=1 mage -v testRace
0 commit comments