build(lint): Add gocognit to golangci-lint linter list (#483) #1974
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, Lint, and Test | |
env: | |
EXPORT_RESULT: true | |
on: | |
push: | |
branches: | |
- main | |
- 'release-*' | |
pull_request_target: | |
jobs: | |
build-container: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: "${{ github.event.pull_request.head.sha }}" | |
- name: Install devbox | |
uses: jetify-com/devbox-install-action@v0.11.0 | |
with: | |
enable-cache: "true" | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/golangci-lint | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Verify that generated manifests committed to the repository are up to date | |
run: devbox run -- make verify-manifests | |
- name: Build | |
run: devbox run -- make generate fmt vet build | |
- name: Run golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: v1.59 | |
- name: Lint | |
run: devbox run -- make lint-yaml | |
- name: Template Tests | |
run: devbox run -- make template-test | |
- name: Run unit tests | |
run: devbox run -- make unit-test | |
- name: Run coverage report | |
run: devbox run -- make coverage | |
- name: Codecov | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
file: ./coverage.out # Replace with the path to your coverage report | |
fail_ci_if_error: true | |
- name: Run Trivy vulnerability scanner | |
uses: aquasecurity/trivy-action@0.16.1 | |
with: | |
scan-type: "fs" | |
ignore-unfixed: true | |
format: "table" | |
exit-code: "1" | |
vuln-type: "os,library" | |
severity: "CRITICAL,HIGH" | |
e2e: | |
strategy: | |
matrix: | |
e2e-labels: | |
- "clusterctl-upgrade" | |
- "clusterclass" | |
- "capx-feature-test" | |
- "scaling" | |
fail-fast: false | |
uses: ./.github/workflows/e2e.yaml | |
with: | |
e2e-labels: ${{ matrix.e2e-labels }} | |
make-target: test-e2e-calico | |
secrets: inherit | |
permissions: | |
contents: read | |
checks: write |