8
8
unit :
9
9
runs-on : ubuntu-latest
10
10
name : All
11
- env :
12
- RUNGOGENERATE : false
13
11
steps :
14
12
- uses : actions/checkout@v3
15
13
with :
16
14
submodules : recursive
15
+ - id : config
16
+ uses : protocol/.github/.github/actions/read-config@master
17
17
- uses : actions/setup-go@v3
18
18
with :
19
- go-version : " 1.19.x "
19
+ go-version : 1.20.x
20
20
- name : Run repo-specific setup
21
21
uses : ./.github/actions/go-check-setup
22
22
if : hashFiles('./.github/actions/go-check-setup') != ''
23
- - name : Read config
24
- if : hashFiles('./.github/workflows/go-check-config.json') != ''
25
- run : |
26
- if jq -re .gogenerate ./.github/workflows/go-check-config.json; then
27
- echo "RUNGOGENERATE=true" >> $GITHUB_ENV
28
- fi
29
23
- name : Install staticcheck
30
- run : go install honnef.co/go/tools/cmd/staticcheck@376210a89477dedbe6fdc4484b233998650d7b3c # 2022.1.3 (v0.3.3 )
24
+ run : go install honnef.co/go/tools/cmd/staticcheck@4970552d932f48b71485287748246cf3237cebdf # 2023.1 (v0.4.0 )
31
25
- name : Check that go.mod is tidy
32
26
33
27
with :
@@ -39,32 +33,32 @@ jobs:
39
33
fi
40
34
git diff --exit-code -- go.sum go.mod
41
35
- name : gofmt
42
- if : ${{ success() || failure() }} # run this step even if the previous one failed
36
+ if : success() || failure() # run this step even if the previous one failed
43
37
run : |
44
38
out=$(gofmt -s -l .)
45
39
if [[ -n "$out" ]]; then
46
40
echo $out | awk '{print "::error file=" $0 ",line=0,col=0::File is not gofmt-ed."}'
47
41
exit 1
48
42
fi
49
43
- name : go vet
50
- if : ${{ success() || failure() }} # run this step even if the previous one failed
44
+ if : success() || failure() # run this step even if the previous one failed
51
45
52
46
with :
53
47
run : go vet ./...
54
48
- name : staticcheck
55
- if : ${{ success() || failure() }} # run this step even if the previous one failed
49
+ if : success() || failure() # run this step even if the previous one failed
56
50
57
51
with :
58
52
run : |
59
53
set -o pipefail
60
54
staticcheck ./... | sed -e 's@\(.*\)\.go@./\1.go@g'
61
55
- name : go generate
62
56
63
- if : (success() || failure()) && env.RUNGOGENERATE == ' true'
57
+ if : (success() || failure()) && fromJSON(steps.config.outputs.json).gogenerate == true
64
58
with :
65
59
run : |
66
60
git clean -fd # make sure there aren't untracked files / directories
67
- go generate ./...
61
+ go generate -x ./...
68
62
# check if go generate modified or added any files
69
63
if ! $(git add . && git diff-index HEAD --exit-code --quiet); then
70
64
echo "go generated caused changes to the repository:"
0 commit comments