From 0ab9291c35c61a4c4ea1b6a97e78d079aac3f14d Mon Sep 17 00:00:00 2001 From: Olivier 'reivilibre Date: Wed, 1 Jul 2026 11:16:29 +0100 Subject: [PATCH] Add `golangci-lint` to CI. (#19888) Fixes: #19857 --------- Signed-off-by: Olivier 'reivilibre --- .github/workflows/tests.yml | 27 +++++++++++++++++++++++++++ changelog.d/19888.misc | 1 + 2 files changed, 28 insertions(+) create mode 100644 changelog.d/19888.misc diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index aa6250612b..45fa2b8cad 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -35,6 +35,7 @@ jobs: integration: ${{ !startsWith(github.ref, 'refs/pull/') || steps.filter.outputs.integration }} linting: ${{ !startsWith(github.ref, 'refs/pull/') || steps.filter.outputs.linting }} linting_readme: ${{ !startsWith(github.ref, 'refs/pull/') || steps.filter.outputs.linting_readme }} + golangci: ${{ !startsWith(github.ref, 'refs/pull/') || steps.filter.outputs.golangci }} steps: - uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 id: filter @@ -89,6 +90,13 @@ jobs: - 'poetry.lock' - '.github/workflows/tests.yml' + golangci: + - 'complement/**/*.go' + - 'complement/.golangci.yml' + - 'complement/go.mod' + - 'complement/go.sum' + - '.github/workflows/tests.yml' + linting_readme: - 'README.rst' @@ -312,6 +320,23 @@ jobs: - run: cargo fmt --check + lint-golangci: + runs-on: ubuntu-latest + needs: changes + if: ${{ needs.changes.outputs.golangci == 'true' }} + + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + + - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 + with: + cache-dependency-path: complement/go.sum + go-version-file: complement/go.mod + + - name: Run golangci-lint + working-directory: ./complement + run: go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.6.1 run ./... --max-issues-per-linter=0 + # This is to detect issues with the rst file, which can otherwise cause issues # when uploading packages to PyPi. lint-readme: @@ -341,6 +366,7 @@ jobs: - lint-clippy-nightly - lint-rust - lint-rustfmt + - lint-golangci - lint-readme runs-on: ubuntu-latest steps: @@ -359,6 +385,7 @@ jobs: lint-clippy-nightly lint-rust lint-rustfmt + lint-golangci lint-readme calculate-test-jobs: diff --git a/changelog.d/19888.misc b/changelog.d/19888.misc new file mode 100644 index 0000000000..0506b21d42 --- /dev/null +++ b/changelog.d/19888.misc @@ -0,0 +1 @@ +Add `golangci-lint` to CI. \ No newline at end of file