Skip to content

Commit 933905e

Browse files
committed
Run static analysis, coverage and benchmarks only with the latest Go version
1 parent d1d4014 commit 933905e

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

.github/workflows/echo.yml

+17-10
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ on:
2121
- 'codecov.yml'
2222
workflow_dispatch:
2323

24+
env:
25+
# run static analysis, coverage and benchmarks only with the latest Go version
26+
LATEST_GO_VERSION: 1.19
27+
2428
jobs:
2529
test:
2630
strategy:
@@ -47,23 +51,26 @@ jobs:
4751
- name: Run Tests
4852
run: go test -race --coverprofile=coverage.coverprofile --covermode=atomic ./...
4953

50-
- name: Install dependencies for checks
54+
- name: Run golint
55+
if: matrix.go == $LATEST_GO_VERSION
5156
run: |
5257
go install golang.org/x/lint/golint@latest
53-
go install honnef.co/go/tools/cmd/staticcheck@latest
54-
go install golang.org/x/vuln/cmd/govulncheck@latest
55-
56-
- name: Run golint
57-
run: golint -set_exit_status ./...
58+
golint -set_exit_status ./...
5859
5960
- name: Run staticcheck
60-
run: staticcheck ./...
61+
if: matrix.go == $LATEST_GO_VERSION
62+
run: |
63+
go install honnef.co/go/tools/cmd/staticcheck@latest
64+
staticcheck ./...
6165
6266
- name: Run govulncheck
63-
run: govulncheck ./...
67+
if: matrix.go == $LATEST_GO_VERSION
68+
run: |
69+
go install golang.org/x/vuln/cmd/govulncheck@latest
70+
govulncheck ./...
6471
6572
- name: Upload coverage to Codecov
66-
if: success() && matrix.go == 1.19 && matrix.os == 'ubuntu-latest'
73+
if: success() && matrix.go == $LATEST_GO_VERSION && matrix.os == 'ubuntu-latest'
6774
uses: codecov/codecov-action@v3
6875
with:
6976
token:
@@ -73,7 +80,7 @@ jobs:
7380
strategy:
7481
matrix:
7582
os: [ubuntu-latest]
76-
go: [1.19]
83+
go: [$LATEST_GO_VERSION]
7784
name: Benchmark comparison ${{ matrix.os }} @ Go ${{ matrix.go }}
7885
runs-on: ${{ matrix.os }}
7986
steps:

0 commit comments

Comments
 (0)