hack for kubevirtci #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/[email protected] | |
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/[email protected] | |
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 |