Repository navigation
Lint #26622
Workflow file for this run
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
| # ------------------------------------------------------------ | |
| # Copyright 2023 The Radius Authors. | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. | |
| # You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, software | |
| # distributed under the License is distributed on an "AS IS" BASIS, | |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
| # See the License for the specific language governing permissions and | |
| # limitations under the License. | |
| # ------------------------------------------------------------ | |
| # yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json | |
| --- | |
| name: Lint | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| branches: | |
| - main | |
| - release/* | |
| # Revalidate the combined changes when a PR is queued in the merge queue. | |
| # Scoped to main only so the release branch flow is never affected. | |
| merge_group: | |
| branches: | |
| - main | |
| concurrency: | |
| # Cancel the previously triggered build for only PR build. | |
| group: lint-${{ github.event.pull_request.number || github.sha }} | |
| cancel-in-progress: true | |
| permissions: {} | |
| jobs: | |
| changes: | |
| name: Changes | |
| uses: ./.github/workflows/__changes.yml | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| # A single "Lint" job runs every linter and reports one aggregated status | |
| # check. The independent, read-only linters run concurrently as parallel steps | |
| # (see the `parallel:` group below), so a failure in any one of them still lets | |
| # the others run and surface their findings in the same job. | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-24.04 | |
| needs: changes | |
| if: needs.changes.outputs.only_changed != 'true' | |
| timeout-minutes: 30 | |
| env: | |
| GOPROXY: https://proxy.golang.org | |
| HELM_CHARTS_DIR: deploy/Chart | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Go | |
| uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 | |
| with: | |
| go-version-file: go.mod | |
| cache-dependency-path: go.sum | |
| cache: true | |
| - name: Download Go modules | |
| uses: ./.github/actions/go-mod-download | |
| - name: Setup NodeJS | |
| uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 | |
| with: | |
| node-version-file: .node-version | |
| - name: Install yq | |
| # Required by make generate to parse defaults.yaml. | |
| run: make install-yq | |
| - name: Install helm | |
| # Version pinned in build/tools.yaml (HELM_VERSION). | |
| run: make install-helm | |
| - name: Install golangci-lint | |
| # Pinned version + checksums live in build/tools.yaml (GOLANGCI_LINT_VERSION). | |
| run: make install-golangci-lint | |
| - name: Install shellcheck | |
| # Pinned version + checksums live in build/tools.yaml (SHELLCHECK_VERSION). | |
| run: make install-shellcheck | |
| # Run the independent, read-only linters concurrently. Each parallel step is | |
| # self-contained; the TypeSpec, Prettier, and deploy progress uploader | |
| # checks share a pnpm/corepack toolchain, so they are grouped into one step | |
| # to avoid racing on that shared install. The group has an implicit wait | |
| # that aggregates results: every linter runs and any failure fails this job | |
| # (a single status check). | |
| - parallel: | |
| - name: Go lint | |
| run: make lint-go | |
| - name: Helm lint and unit tests | |
| run: | | |
| helm lint "${HELM_CHARTS_DIR}" | |
| make test-helm | |
| - name: pnpm-based checks | |
| run: | | |
| make tsp-format-check | |
| make format-check || { echo "Format check failed. Run 'make format-write' to fix the formatting issues."; exit 1; } | |
| - name: Shell lint | |
| run: make lint-shell | |
| # The generated-code check mutates the working tree, so it runs | |
| # sequentially after the parallel linters rather than inside the group. | |
| - name: Run make generate | |
| run: make generate | |
| - name: Check if generated code is up to date | |
| continue-on-error: true | |
| id: gitdiff | |
| run: | | |
| git diff --exit-code | |
| - name: Check failures | |
| if: steps.gitdiff.outcome != 'success' | |
| run: | | |
| echo "Generated code is not up to date, run 'make generate' to update generated code." | |
| exit 1 |