diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index c93c8574..022e3b41 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,15 +17,19 @@ permissions: pull-requests: read jobs: - golangci: - name: golangci-lint + changes: + name: detect changes runs-on: ubuntu-24.04 + outputs: + lint: ${{ steps.filter.outputs.lint }} + gofmt: ${{ steps.filter.outputs.gofmt }} + helm: ${{ steps.filter.outputs.helm }} steps: - name: Checkout code uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - name: Filter paths - id: changes + id: filter uses: dorny/paths-filter@7b450fff21473bca461d4b92ce414b9d0420d706 # v4.0.2 with: filters: | @@ -35,13 +39,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-24.04 + steps: + - name: Checkout code + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 - name: Set up Go - if: steps.changes.outputs.lint == 'true' uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0 with: go-version-file: go.mod - 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-24.04 + steps: + - name: Checkout code + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + + - name: Set up Go + uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0 + with: + go-version-file: go.mod + + - name: Check Go formatting + run: make fmt-check + + helm: + name: helm-lint + needs: changes + if: needs.changes.outputs.helm == 'true' + runs-on: ubuntu-24.04 + steps: + - name: Checkout code + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + + - name: Set up Helm + uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310 # v5.0.1 + with: + version: v3.17.3 + + - name: Check Helm chart + run: make helm-check diff --git a/Makefile b/Makefile index 5ee48296..b72bb542 100644 --- a/Makefile +++ b/Makefile @@ -293,6 +293,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