Skip to content

Merge pull request #1757 from rnc/UI-DEVELOP #4909

Merge pull request #1757 from rnc/UI-DEVELOP

Merge pull request #1757 from rnc/UI-DEVELOP #4909

Workflow file for this run

name: GoLang CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5
with:
go-version-file: './go.mod'
- name: golangci-lint
uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 # v6
with:
args: "--timeout=10m --build-tags='normal periodic minikube'"
go:
name: Check sources
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- name: Check out code
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
- name: Install Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5
with:
go-version-file: './go.mod'
- name: Check go mod status
run: |
go mod tidy
if [[ ! -z $(git status -s) ]]
then
echo "Go mod state is not clean:"
git --no-pager diff
exit 1
fi
- name: Check format
run: |
make fmt
if [[ ! -z $(git status -s) ]]
then
echo "not all golang files properly gofmt'ed:"
git --no-pager diff
exit 1
fi
- name: Check generated
run: |
make generate
if [[ ! -z $(git status -s) ]]
then
echo "generated sources are not up to date:"
git --no-pager diff
exit 1
fi
unit:
name: Golang Unit tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
- name: Install Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5
with:
go-version-file: './go.mod'
- name: Build
run: make build
- name: Test
run: make test
- name: Codecov
uses: codecov/codecov-action@125fc84a9a348dbcf27191600683ec096ec9021c # v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
security_scan:
name: Security scan
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5
with:
go-version-file: './go.mod'
# https://github.com/securego/gosec/blob/12be14859bc7d4b956b71bef0b443694aa519d8a/README.md#integrating-with-code-scanning
- name: Run Gosec Security Scanner
uses: securego/gosec@master
with:
# we let the report trigger content trigger a failure using the GitHub Security features.
args: '-tags normal,periodic -no-fail -fmt sarif -out results.sarif ./...'
- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@9fdb3e49720b44c48891d036bb502feb25684276 # v3
with:
# Path to SARIF file relative to the root of the repository
sarif_file: results.sarif