@@ -3,38 +3,55 @@ name: CI
3
3
on :
4
4
push :
5
5
branches : [ master ]
6
+ tags : [ v* ]
6
7
pull_request :
7
8
branches : [ master ]
8
9
10
+ env :
11
+ GO_VERSION : ^1.20
12
+ GOLANGCI_LINT_VERSION : v1.56.2
13
+
14
+ permissions :
15
+ contents : read
16
+
9
17
jobs :
10
18
go_install :
19
+ if : ${{ !github.event.pull_request.head.repo.fork }}
11
20
runs-on : ubuntu-latest
12
21
steps :
13
- - uses : rlespinasse/github-slug-action@v4
14
- - uses : actions/setup-go@v4
22
+ - uses : rlespinasse/github-slug-action@v4.4.1
23
+ - uses : actions/setup-go@v5
15
24
with :
16
- go-version : ^1.21
17
- - run : cd /tmp && go install github.com/Antonboom/nilnil@${{ env.GITHUB_REF_NAME }} && nilnil -h
25
+ go-version : ${{ env.GO_VERSION }}
26
+ - run : cd /tmp && go install github.com/Antonboom/nilnil@${{ env.version }} && nilnil -h
27
+ env :
28
+ version : ${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA || env.GITHUB_REF_SLUG }}
18
29
19
30
lint :
31
+ permissions :
32
+ contents : read # for actions/checkout to fetch code
33
+ pull-requests : read # for golangci/golangci-lint-action to fetch pull requests
20
34
runs-on : ubuntu-latest
21
35
steps :
22
- - uses : actions/setup-go@v4
36
+ - uses : actions/setup-go@v5
23
37
with :
24
- go-version : ' 1.21 '
25
- - uses : actions/checkout@v3
38
+ go-version : ${{ env.GO_VERSION }}
39
+ - uses : actions/checkout@v4
26
40
- uses : golangci/golangci-lint-action@v3
27
41
with :
28
- version : v1.54.0
42
+ version : ${{ env.GOLANGCI_LINT_VERSION }}
29
43
args : --timeout=5m
30
44
31
- tests :
45
+ test :
46
+ permissions :
47
+ checks : write # for shogo82148/actions-goveralls to create a new check based on the results
48
+ contents : read # for actions/checkout to fetch code
32
49
runs-on : ubuntu-latest
33
50
steps :
34
- - uses : actions/setup-go@v4
51
+ - uses : actions/setup-go@v5
35
52
with :
36
- go-version : ^1.21
37
- - uses : actions/checkout@v3
53
+ go-version : ${{ env.GO_VERSION }}
54
+ - uses : actions/checkout@v4
38
55
- run : go test -coverprofile=coverage.out ./...
39
56
- uses : shogo82148/actions-goveralls@v1
40
57
with :
0 commit comments