Skip to content

Commit

Permalink
Run static analysis, coverage and benchmarks only with the latest Go …
Browse files Browse the repository at this point in the history
…version
  • Loading branch information
aldas committed Dec 13, 2022
1 parent d1d4014 commit 933905e
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions .github/workflows/echo.yml
Expand Up @@ -21,6 +21,10 @@ on:
- 'codecov.yml'
workflow_dispatch:

env:
# run static analysis, coverage and benchmarks only with the latest Go version
LATEST_GO_VERSION: 1.19

jobs:
test:
strategy:
Expand All @@ -47,23 +51,26 @@ jobs:
- name: Run Tests
run: go test -race --coverprofile=coverage.coverprofile --covermode=atomic ./...

- name: Install dependencies for checks
- name: Run golint
if: matrix.go == $LATEST_GO_VERSION
run: |
go install golang.org/x/lint/golint@latest
go install honnef.co/go/tools/cmd/staticcheck@latest
go install golang.org/x/vuln/cmd/govulncheck@latest
- name: Run golint
run: golint -set_exit_status ./...
golint -set_exit_status ./...
- name: Run staticcheck
run: staticcheck ./...
if: matrix.go == $LATEST_GO_VERSION
run: |
go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck ./...
- name: Run govulncheck
run: govulncheck ./...
if: matrix.go == $LATEST_GO_VERSION
run: |
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...
- name: Upload coverage to Codecov
if: success() && matrix.go == 1.19 && matrix.os == 'ubuntu-latest'
if: success() && matrix.go == $LATEST_GO_VERSION && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v3
with:
token:
Expand All @@ -73,7 +80,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
go: [1.19]
go: [$LATEST_GO_VERSION]
name: Benchmark comparison ${{ matrix.os }} @ Go ${{ matrix.go }}
runs-on: ${{ matrix.os }}
steps:
Expand Down

0 comments on commit 933905e

Please sign in to comment.