chore(deps): bump golangci/golangci-lint-action from 9.1.0 to 9.2.0 #1080
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: ci | |
| on: # yamllint disable-line rule:truthy | |
| push: | |
| branches: | |
| - main | |
| pull_request: # yamllint disable-line rule:empty-values | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull-request.number || github.ref }} | |
| cancel-in-progress: true | |
| defaults: | |
| run: | |
| shell: bash | |
| permissions: | |
| contents: read | |
| checks: write # Used to annotate code in the PR | |
| jobs: | |
| changes: | |
| name: categorize changes | |
| runs-on: ubuntu-latest | |
| outputs: | |
| non-docs: ${{ steps.detect.outputs.non-docs }} | |
| yaml: ${{ steps.detect.outputs.yaml }} | |
| steps: | |
| - name: Get base depth | |
| id: base-depth | |
| run: echo "base-depth=$(expr ${{ github.event.pull_request.commits }} + 1)" >> $GITHUB_OUTPUT | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| fetch-depth: ${{ steps.base-depth.outputs.base-depth }} | |
| - name: detect | |
| id: detect | |
| run: | | |
| git fetch origin ${{ github.base_ref }} | |
| CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }} | tr ' ' '\n') | |
| echo -e "Changed files:\n${CHANGED_FILES}" | |
| # If no files are changed at all, then `grep -v` will match even though no change outputs | |
| # should be true. Skipping output on an empty set of changes eliminates the false positive | |
| if [[ -n "${CHANGED_FILES}" ]]; then | |
| NON_DOCS=$(echo "${CHANGED_FILES}" | grep -Eqv '\.md$' && echo 'true' || echo 'false') | |
| YAML=$(echo "${CHANGED_FILES}" | grep -Eq '\.ya?ml$' && echo 'true' || echo 'false') | |
| echo "non-docs=${NON_DOCS}" | tee -a $GITHUB_OUTPUT | |
| echo "yaml=${YAML}" | tee -a $GITHUB_OUTPUT | |
| fi | |
| build: | |
| name: build | |
| needs: [changes] | |
| runs-on: ubuntu-latest | |
| if: ${{ needs.changes.outputs.non-docs == 'true' }} | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 | |
| with: | |
| go-version-file: "go.mod" | |
| - name: build | |
| run: | | |
| go build -v ./... | |
| linting: | |
| needs: [changes] | |
| name: lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 | |
| with: | |
| go-version-file: "go.mod" | |
| - name: gofmt | |
| if: ${{ needs.changes.outputs.non-docs == 'true' }} | |
| run: | | |
| gofmt_out=$(gofmt -d $(find * -name '*.go' ! -path 'vendor/*' ! -path 'third_party/*')) | |
| if [[ -n "$gofmt_out" ]]; then | |
| failed=1 | |
| fi | |
| echo "$gofmt_out" | |
| - name: golangci-lint | |
| if: ${{ needs.changes.outputs.non-docs == 'true' }} | |
| uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0 | |
| with: | |
| version: v2.1.0 | |
| only-new-issues: true | |
| args: --timeout=10m | |
| - name: yamllint | |
| if: ${{ needs.changes.outputs.yaml == 'true' }} | |
| run: | | |
| apt update && apt install -y yamllint | |
| yamllint -c .yamllint $(find . -path ./vendor -prune -o -type f -regex ".*y[a]ml" -print | tr '\n' ' ') | |
| - name: check-license | |
| if: ${{ needs.changes.outputs.non-docs == 'true' }} | |
| run: | | |
| go install github.com/google/[email protected] | |
| go-licenses check ./... | |
| tests: | |
| needs: [build] | |
| name: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 | |
| with: | |
| go-version-file: "go.mod" | |
| - name: build | |
| run: | | |
| make test-unit-verbose-and-race | |
| generated: | |
| needs: [build] | |
| name: Check generated code | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 | |
| with: | |
| go-version-file: "go.mod" | |
| - name: generated | |
| run: | | |
| ./hack/verify-codegen.sh | |
| multi-arch-build: | |
| needs: [build] | |
| name: Multi-arch build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 | |
| with: | |
| go-version-file: "go.mod" | |
| - uses: ko-build/setup-ko@d006021bd0c28d1ce33a07e7943d48b079944c8d # v0.9 | |
| - name: ko-resolve | |
| run: | | |
| cat <<EOF > .ko.yaml | |
| defaultBaseImage: cgr.dev/chainguard/static | |
| baseImageOverrides: | |
| github.com/tektoncd/operator/cmd/openshift/operator: registry.access.redhat.com/ubi9/ubi-minimal | |
| github.com/tektoncd/operator/cmd/openshift/webhook: registry.access.redhat.com/ubi9/ubi-minimal | |
| github.com/tektoncd/operator/cmd/openshift/proxy-webhook: registry.access.redhat.com/ubi9/ubi-minimal | |
| EOF | |
| KO_DOCKER_REPO=example.com make TARGET=kubernetes resolve | |
| KO_DOCKER_REPO=example.com make TARGET=openshift resolve | |
| e2e-tests: | |
| needs: [build] | |
| uses: ./.github/workflows/e2e-matrix.yml |