Skip to content

Merge pull request #506 from k8snetworkplumbingwg/dependabot/go_modul… #12

Merge pull request #506 from k8snetworkplumbingwg/dependabot/go_modul…

Merge pull request #506 from k8snetworkplumbingwg/dependabot/go_modul… #12

name: build-test-lint
on: [push, pull_request]
jobs:
build:
name: build
strategy:
matrix:
go-version: [1.20.x]
goarch: [amd64]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Set up Go matrix
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Build
env:
GOARCH: ${{ matrix.goarch }}
GOOS: ${{ matrix.goos }}
run: make build
test:
runs-on: ubuntu-latest
needs: build
name: test
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.20.x
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Install hwdata
run: sudo apt-get install hwdata -y
- name: Go test
run: make test-race
test-coverage:
runs-on: ubuntu-latest
needs: build
name: test-coverage
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.20.x
- uses: actions/checkout@v3
- name: Install hwdata
run: sudo apt-get install hwdata -y
- name: Go test with coverage
run: make test-coverage
- name: Coveralls
uses: coverallsapp/github-action@1.1.3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: test/coverage/lcov.info
golangci:
name: Golangci-lint
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.20.x
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.52.2
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
env:
SHELLCHECK_OPTS: -e SC3037 # disabled because of false issue in entrypoint.sh ln 14-21. Not using any complicated flags. Works with alpines almquist shell.
steps:
- uses: actions/checkout@v3
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@master
with:
ignore: vendor
hadolint:
runs-on: ubuntu-latest
name: Hadolint
steps:
- uses: actions/checkout@v3
- uses: hadolint/hadolint-action@v3.1.0
name: Run Hadolint
with:
dockerfile: ./images/Dockerfile
ignore: DL3018 # DL3018: GH issue 368
go-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.20.x
# if this fails, run go mod tidy
- name: Check if module files are consistent with code
run: go mod tidy && git diff --exit-code
# if this fails, run go mod vendor
- name: Check if vendor directory is consistent with go modules
run: go mod vendor && git diff --exit-code