fix(deps): update go packages #76
This file contains hidden or 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: | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| jobs: | |
| go: | |
| name: Check sources | |
| runs-on: ubuntu-latest | |
| env: | |
| OPERATOR_SDK_VERSION: v1.39.1 | |
| steps: | |
| - name: Check out code into the Go module directory | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Cache Operator SDK ${{ env.OPERATOR_SDK_VERSION }} | |
| uses: actions/cache@v4 | |
| id: cache-operator-sdk | |
| with: | |
| path: ~/cache | |
| key: operator-sdk-${{ env.OPERATOR_SDK_VERSION }} | |
| - name: Download Operator SDK ${{ env.OPERATOR_SDK_VERSION }} | |
| if: steps.cache-operator-sdk.outputs.cache-hit != 'true' | |
| run: | | |
| mkdir -p ~/cache | |
| wget https://github.com/operator-framework/operator-sdk/releases/download/${OPERATOR_SDK_VERSION}/operator-sdk_linux_amd64 -O ~/cache/operator-sdk-${OPERATOR_SDK_VERSION} > /dev/null | |
| chmod +x ~/cache/operator-sdk-${OPERATOR_SDK_VERSION} | |
| - name: Install Operator SDK ${{ env.OPERATOR_SDK_VERSION }} | |
| run: | | |
| mkdir -p ~/bin | |
| cp ~/cache/operator-sdk-${OPERATOR_SDK_VERSION} ~/bin/operator-sdk | |
| echo "$HOME/bin" >> $GITHUB_PATH | |
| - name: Regenerate executables with current environment packages | |
| run: | | |
| rm -f bin/kustomize bin/controller-gen | |
| make kustomize controller-gen | |
| - name: Cache go modules | |
| id: cache-mod | |
| uses: actions/cache@v4 | |
| 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 ':(exclude)bin/kustomize' ':(exclude)bin/controller-gen' -s) ]] | |
| then | |
| echo "Go mod state is not clean:" | |
| git --no-pager diff ':(exclude)bin/kustomize' ':(exclude)bin/controller-gen' | |
| exit 1 | |
| fi | |
| - name: Check format | |
| run: | | |
| make fmt | |
| if [[ ! -z $(git status ':(exclude)bin/kustomize' ':(exclude)bin/controller-gen' -s) ]] | |
| then | |
| echo "Some files are not properly formatted." | |
| echo "Please run 'make fmt' and amend your commit." | |
| git --no-pager diff ':(exclude)bin/kustomize' ':(exclude)bin/controller-gen' | |
| exit 1 | |
| fi | |
| - name: Check manifests | |
| run: | | |
| make generate manifests | |
| if [[ ! -z $(git status ':(exclude)bin/kustomize' ':(exclude)bin/controller-gen' -s) ]] | |
| then | |
| echo "Generated sources are not up to date:" | |
| git --no-pager diff ':(exclude)bin/kustomize' ':(exclude)bin/controller-gen' | |
| exit 1 | |
| fi | |
| - name: Check RBAC wildcards | |
| run: | | |
| if grep -n "*" config/rbac/*.yaml ; then | |
| echo "RBAC files contain wildcards (*)" | |
| exit 1 | |
| fi | |
| - name: Run Go Tests | |
| run: make test | |
| - name: Ensure make build succeeds | |
| run: make build | |
| kube-linter: | |
| name: Lint Kubernetes manifests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| - name: Scan yaml files with kube-linter | |
| uses: stackrox/kube-linter-action@v1.0.4 | |
| with: | |
| version: v0.7.6 | |
| directory: config | |
| config: .kube-linter.yaml |