|
1 | | -name: lint |
| 1 | +# "Hide" the name from the GitHub check status line, as it just clutters the display |
| 2 | +name: " " |
2 | 3 |
|
3 | 4 | on: |
4 | 5 | push: |
|
7 | 8 | - 'release/**' |
8 | 9 | pull_request: |
9 | 10 |
|
10 | | -env: |
11 | | - GO_VERSION: 1.23.x |
12 | | - |
13 | 11 | jobs: |
14 | | - go: |
15 | | - timeout-minutes: 5 |
16 | | - name: "go | ${{ matrix.goos }} | ${{ matrix.canary }}" |
17 | | - runs-on: "${{ matrix.os }}" |
18 | | - defaults: |
19 | | - run: |
20 | | - shell: bash |
| 12 | + # Source the common environment |
| 13 | + environment: |
| 14 | + name: "lint" |
| 15 | + uses: ./.github/workflows/reusable_environment.yml |
| 16 | + |
| 17 | + # Linting go |
| 18 | + lint-go: |
| 19 | + # Define the matrix we want to lint on: every supported OS, with the current go version, and additionally go canary on linux |
21 | 20 | strategy: |
22 | 21 | matrix: |
| 22 | + # The GOOS-es we run golint for, with no canary (eg: the base supported GO_VERSION) |
| 23 | + goos: [linux, freebsd, windows] |
| 24 | + # And no canary |
| 25 | + canary: [false] |
23 | 26 | include: |
24 | | - - os: ubuntu-24.04 |
25 | | - goos: linux |
26 | | - - os: ubuntu-24.04 |
27 | | - goos: freebsd |
28 | | - # FIXME: this is currently failing in a non-sensical way, so, running on linux instead... |
29 | | - # - os: windows-2022 |
30 | | - - os: ubuntu-24.04 |
31 | | - goos: windows |
32 | | - - os: ubuntu-24.04 |
33 | | - goos: linux |
34 | | - # This allows the canary script to select any upcoming golang alpha/beta/RC |
35 | | - canary: go-canary |
36 | | - env: |
37 | | - GOOS: "${{ matrix.goos }}" |
38 | | - steps: |
39 | | - - uses: actions/checkout@v4.2.2 |
40 | | - with: |
41 | | - fetch-depth: 1 |
42 | | - - name: Set GO env |
43 | | - run: | |
44 | | - # If canary is specified, get the latest available golang pre-release instead of the major version |
45 | | - if [ "$canary" != "" ]; then |
46 | | - . ./hack/build-integration-canary.sh |
47 | | - canary::golang::latest |
48 | | - fi |
49 | | - - uses: actions/setup-go@v5 |
50 | | - with: |
51 | | - go-version: ${{ env.GO_VERSION }} |
52 | | - check-latest: true |
53 | | - cache: true |
54 | | - - name: golangci-lint |
55 | | - uses: golangci/golangci-lint-action@v6 |
56 | | - with: |
57 | | - args: --verbose |
58 | | - other: |
59 | | - timeout-minutes: 5 |
60 | | - name: yaml | shell | imports order |
61 | | - runs-on: ubuntu-24.04 |
62 | | - steps: |
63 | | - - uses: actions/checkout@v4.2.2 |
64 | | - with: |
65 | | - fetch-depth: 1 |
66 | | - - uses: actions/setup-go@v5 |
67 | | - with: |
68 | | - go-version: ${{ env.GO_VERSION }} |
69 | | - check-latest: true |
70 | | - cache: true |
71 | | - - name: yaml |
72 | | - run: make lint-yaml |
73 | | - - name: shell |
74 | | - run: make lint-shell |
75 | | - - name: go imports ordering |
76 | | - run: | |
77 | | - go install -v github.com/incu6us/goimports-reviser/v3@latest |
78 | | - make lint-imports |
| 27 | + # Only run canary on linux (note: the canary script will select any upcoming golang alpha/beta/RC when the `canary` param is set to a non-empty string) |
| 28 | + - goos: linux |
| 29 | + canary: true |
| 30 | + |
| 31 | + # If we do not "collapse" the name using a bogux matrix var, it will display all matrix parameters, which we do not want |
| 32 | + name: "lint${{ matrix.c }}" |
| 33 | + uses: ./.github/workflows/reusable_lint_go.yml |
| 34 | + needs: environment |
| 35 | + with: |
| 36 | + goos: ${{ matrix.goos }} |
| 37 | + canary: ${{ matrix.canary }} |
| 38 | + os: ${{ needs.environment.outputs.HOST_UBUNTU_LTS }} |
| 39 | + goversion: ${{ needs.environment.outputs.GO_VERSION }} |
| 40 | + timeout-minutes: ${{ fromJSON(needs.environment.outputs.SHORT_TIMEOUT) }} |
| 41 | + |
| 42 | + # Linting other filetypes |
| 43 | + lint-other: |
| 44 | + name: "lint" |
| 45 | + uses: ./.github/workflows/reusable_lint_other.yml |
| 46 | + needs: environment |
| 47 | + with: |
| 48 | + os: ${{ needs.environment.outputs.HOST_UBUNTU_LTS }} |
| 49 | + timeout-minutes: ${{ fromJSON(needs.environment.outputs.SHORT_TIMEOUT) }} |
0 commit comments