Skip to content

Commit

Permalink
fix CI syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
aldas committed Dec 13, 2022
1 parent 3f76804 commit eafcf93
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 40 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/checks.yml
@@ -0,0 +1,48 @@
name: Run checks

on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:

permissions:
contents: read # to fetch code (actions/checkout)

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

jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v3
with:
go-version: ${{ env.LATEST_GO_VERSION }}
check-latest: true

- name: Run golint
run: |
go install golang.org/x/lint/golint@latest
golint -set_exit_status ./...
- name: Run staticcheck
run: |
go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck ./...
- name: Run govulncheck
run: |
go version
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...
44 changes: 4 additions & 40 deletions .github/workflows/echo.yml
Expand Up @@ -4,29 +4,16 @@ on:
push:
branches:
- master
paths:
- '**.go'
- 'go.*'
- '_fixture/**'
- '.github/**'
- 'codecov.yml'
pull_request:
branches:
- master
paths:
- '**.go'
- 'go.*'
- '_fixture/**'
- '.github/**'
- 'codecov.yml'
workflow_dispatch:

permissions:
contents: read # to fetch code (actions/checkout)

# NB: `env:` is not usable/visible in all yaml/workflow blocks
env:
# run static analysis, coverage and benchmarks only with the latest Go version
# run coverage and benchmarks only with the latest Go version
LATEST_GO_VERSION: 1.19

jobs:
Expand All @@ -44,8 +31,6 @@ jobs:
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
ref: ${{ github.ref }}

- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v3
Expand All @@ -55,38 +40,17 @@ jobs:
- name: Run Tests
run: go test -race --coverprofile=coverage.coverprofile --covermode=atomic ./...

- name: Run golint
if: matrix.go == env.LATEST_GO_VERSION
run: |
echo "env.LATEST_GO_VERSION=${{ env.LATEST_GO_VERSION }} matrix.go=${{ matrix.go }}"
go install golang.org/x/lint/golint@latest
golint -set_exit_status ./...
- name: Run staticcheck
if: matrix.go == env.LATEST_GO_VERSION
run: |
go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck ./...
- name: Run govulncheck
if: matrix.go == env.LATEST_GO_VERSION
run: |
go install golang.org/x/vuln/cmd/govulncheck@latest
govulncheck ./...
- name: Upload coverage to Codecov
if: success() && matrix.go == env.LATEST_GO_VERSION && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v3
with:
token:
fail_ci_if_error: false

benchmark:
needs: test
strategy:
matrix:
os: [ubuntu-latest]
name: Benchmark comparison ${{ matrix.os }}
runs-on: ${{ matrix.os }}
name: Benchmark comparison
runs-on: ubuntu-latest
steps:
- name: Checkout Code (Previous)
uses: actions/checkout@v3
Expand Down

0 comments on commit eafcf93

Please sign in to comment.