Updates for operator sdk v1.28 #160
Workflow file for this run
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: Validate PRs | |
on: | |
pull_request: | |
branches: [ main ] | |
jobs: | |
go: | |
name: Check go sources | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Set up Go 1.x | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.19 | |
- | |
name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- | |
name: Cache go modules | |
id: cache-mod | |
uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- | |
name: Download dependencies | |
run: go mod download | |
if: steps.cache-mod.outputs.cache-hit != 'true' | |
- | |
name: Check go mod status | |
run: | | |
go mod tidy | |
if [[ ! -z $(git status -s) ]] | |
then | |
echo "Go mod state is not clean: $(git status -s)" | |
exit 1 | |
fi | |
- | |
name: Check format | |
run: | | |
go get -u github.com/google/addlicense | |
go install github.com/google/addlicense | |
go get -u golang.org/x/tools/cmd/goimports | |
go install golang.org/x/tools/cmd/goimports | |
git reset HEAD --hard | |
make fmt | |
if [[ ! -z $(git status -s) ]] | |
then | |
echo "not well formatted sources found during make fmt: $(git --no-pager diff)" | |
exit 1 | |
fi | |
make fmt_license | |
if [[ ! -z $(git status -s) ]] | |
then | |
echo "not well formatted sources found during make fmt_license: $(git status -s)" | |
exit 1 | |
fi | |
- | |
name: Check code generation | |
run: make generate | |
- | |
name: Check CRD manifest generation | |
run: make manifests | |
- | |
name: Run unit tests | |
run: make test | |
- | |
name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v2.1.0 | |
- name: Run Gosec Security Scanner | |
run: | | |
go install github.com/securego/gosec/v2/cmd/gosec@v2.14.0 | |
make gosec | |
if [[ $? != 0 ]] | |
then | |
echo "gosec scanner failed to run " | |
exit 1 | |
fi | |
- name: Upload SARIF file | |
uses: github/codeql-action/upload-sarif@v2 | |
with: | |
# Path to SARIF file relative to the root of the repository | |
sarif_file: gosec.sarif | |
operator-build: | |
name: Check operator container image build | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- | |
name: Check if operator docker build is working | |
run: docker build -f Dockerfile . | |
operator-bundle-build: | |
name: Check operator bundle build | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Check out code into the Go module directory | |
uses: actions/checkout@v2 | |
- | |
name: Build the operator's bundle image | |
run: make bundle-build |