Skip to content

Commit 6d9e9c4

Browse files
committed
Generate matrix for golangci-lint dynamically from make target
On-behalf-of: SAP <marvin.beckers@sap.com> Signed-off-by: Marvin Beckers <marvin@kubermatic.com>
1 parent 6dd5793 commit 6d9e9c4

File tree

1 file changed

+29
-11
lines changed

1 file changed

+29
-11
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,40 @@ permissions:
1414
checks: write
1515

1616
jobs:
17+
list-modules:
18+
name: list-modules
19+
20+
runs-on: ubuntu-latest
21+
22+
outputs:
23+
modules: ${{ steps.modules.outputs.modules }}
24+
25+
steps:
26+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # tag=v5.0.0
27+
- name: Calculate go version
28+
id: vars
29+
run: echo "go_version=$(make go-version)" >> $GITHUB_OUTPUT
30+
- name: Set up Go
31+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # tag=v5.5.0
32+
with:
33+
go-version: ${{ steps.vars.outputs.go_version }}
34+
- name: make list-modules
35+
id: modules
36+
run: echo "modules=$(make list-modules)" >> $GITHUB_OUTPUT
37+
1738
golangci-lint-matrix:
39+
name: golangci-lint [${{ matrix.working-directory }}]
40+
1841
runs-on: ubuntu-latest
42+
43+
needs:
44+
- list-modules
45+
1946
strategy:
2047
fail-fast: false
2148
matrix:
22-
working-directory:
23-
- ""
24-
- examples/kind
25-
- providers/kind
26-
- examples/cluster-api
27-
- providers/cluster-api
28-
- examples/cluster-inventory-api
29-
- providers/cluster-inventory-api
30-
- examples/file
31-
- providers/file
32-
name: golangci-lint [${{ matrix.working-directory }}]
49+
working-directory: ${{ fromJSON(needs.list-modules.outputs.modules) }}
50+
3351
steps:
3452
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # tag=v5.0.0
3553
- name: Calculate go version

0 commit comments

Comments
 (0)