Repository navigation
86 lines (79 loc) · 2.93 KB
/
Copy pathgo-lint.yaml
File metadata and controls
86 lines (79 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: golangci-lint
on:
push:
branches:
- main
paths:
- "go/**"
- .github/workflows/go-lint.yaml
pull_request:
paths:
- "go/**"
- .github/workflows/go-lint.yaml
workflow_dispatch:
merge_group:
types: [checks_requested]
paths:
- "go/**"
- .github/workflows/go-lint.yaml
permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read
env:
# renovate: datasource=github-releases depName=golangci/golangci-lint
GOLANGCI_LINT_VERSION: v2.1.2
jobs:
# Initial Setup Job
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
# List directories and set as output
- name: List Applications
id: list_dirs
run: |
apps=$(ls -d go/* | xargs -n1 basename)
app_array=$(printf '%s\n' $apps | jq -R . | jq -cs .)
echo "apps=${app_array}"
printf "apps=%s\n" "${app_array}" >> "$GITHUB_OUTPUT"
shell: bash
outputs:
apps: ${{ steps.list_dirs.outputs.apps }}
golangci-lint:
name: golangci-lint (${{ matrix.app }})
runs-on: ubuntu-latest
needs: setup
strategy:
# Don't let one module's failure cancel the other modules' lint jobs.
fail-fast: false
matrix:
app: ${{ fromJson(needs.setup.outputs.apps) }}
include:
- app: dexop
# renovate: datasource=github-releases depName=golangci/golangci-lint
GOLANGCI_LINT_VERSION: v2.14.0
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
fetch-depth: 1
# golangci-lint-action does not install Go, so each module's toolchain
# comes from its own go.mod rather than a version pinned in this file.
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version-file: go/${{ matrix.app }}/go.mod
cache-dependency-path: go/${{ matrix.app }}/go.sum
# install-mode: goinstall builds golangci-lint from source using the
# toolchain setup-go installed from this module's go.mod. golangci-lint
# refuses to run when the Go version it was built with is older than the
# version a module targets, and the published binaries are built with
# whatever Go was current at release time. Building from source makes
# build-Go >= target-Go hold by construction, so a dependency bump that
# raises a module's `go` directive can no longer break linting while
# GOLANGCI_LINT_VERSION waits on a Renovate PR.
- name: golangci-lint ${{ matrix.app }}
uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9
with:
version: ${{ matrix.GOLANGCI_LINT_VERSION || env.GOLANGCI_LINT_VERSION }}
install-mode: goinstall
working-directory: go/${{ matrix.app }}