diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 6e1e643b3..0ea4b4969 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,15 +12,16 @@ permissions: pull-requests: read jobs: - golangci: - name: golangci-lint - runs-on: ubuntu-24.04 + changes: + name: detect changes + runs-on: ubuntu-latest + outputs: + lint: ${{ steps.filter.outputs.lint }} + gofmt: ${{ steps.filter.outputs.gofmt }} + helm: ${{ steps.filter.outputs.helm }} steps: - - name: Checkout code - uses: actions/checkout@v4 - - name: Filter paths - id: changes + id: filter uses: dorny/paths-filter@v3 with: filters: | @@ -30,13 +31,62 @@ jobs: - 'go.sum' - '.golangci.yml' - '.github/workflows/lint.yml' + gofmt: + - '**/*.go' + - 'Makefile' + - '.github/workflows/lint.yml' + helm: + - 'manifests/charts/base/**' + - 'Makefile' + - '.github/workflows/lint.yml' + + golangci: + name: golangci-lint + needs: changes + if: needs.changes.outputs.lint == 'true' + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 - name: Set up Go - if: steps.changes.outputs.lint == 'true' uses: actions/setup-go@v5 with: go-version: "1.24" - name: Run golangci-lint - if: steps.changes.outputs.lint == 'true' run: make lint + + gofmt: + name: gofmt + needs: changes + if: needs.changes.outputs.gofmt == 'true' + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: "1.24" + + - name: Check Go formatting + run: make fmt-check + + helm: + name: helm-lint + needs: changes + if: needs.changes.outputs.helm == 'true' + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Helm + uses: azure/setup-helm@v4 + with: + version: v3.17.3 + + - name: Check Helm chart + run: make helm-check diff --git a/Makefile b/Makefile index 3cf7f8cce..706e026e7 100644 --- a/Makefile +++ b/Makefile @@ -297,6 +297,11 @@ helm-template: ## Render Helm chart locally helm-lint: ## Lint Helm chart helm lint manifests/charts/base +.PHONY: helm-check +helm-check: ## Lint Helm chart and verify templates render + $(MAKE) helm-lint + $(MAKE) helm-template >/dev/null + ##@ Dependencies