-
-
Notifications
You must be signed in to change notification settings - Fork 162
86 lines (80 loc) 路 2.61 KB
/
Copy pathgolangci-lint.yml
File metadata and controls
86 lines (80 loc) 路 2.61 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 Check
on:
push:
branches:
- "master"
- "main"
paths-ignore:
- "**.md"
- LICENSE
- ".github/ISSUE_TEMPLATE/*.yml"
- ".github/dependabot.yml"
pull_request:
branches:
- "*"
paths-ignore:
- "**.md"
- LICENSE
- ".github/ISSUE_TEMPLATE/*.yml"
- ".github/dependabot.yml"
jobs:
changes:
runs-on: ubuntu-latest
steps:
- name: Fetch Repository
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Generate filters
id: filter-setup
run: |
filters=$(find v3 -mindepth 1 -maxdepth 1 -type d -exec basename {} \; | sort | awk '{printf "%s: \"v3/%s/**\"\n", $1, $1}')
echo "filters<<EOF" >> $GITHUB_OUTPUT
echo "$filters" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
shell: bash
- name: Filter changes
id: filter
uses: dorny/paths-filter@v3
with:
filters: ${{ steps.filter-setup.outputs.filters }}
- name: Set packages
id: set-packages
run: |
# If this is a push to master or main, build a JSON array of all packages.
# Otherwise, use the filtered list of changed packages.
if [[ "${{ github.event_name }}" == "push" ]]; then
packages=$(find v3 -mindepth 1 -maxdepth 1 -type d -exec basename {} \; | sort | awk 'BEGIN{first=1; printf "["} {if(!first) printf ","; printf "\"%s\"", $0; first=0} END{printf "]"}')
else
packages='${{ steps.filter.outputs.changes }}'
fi
echo "packages<<EOF" >> $GITHUB_OUTPUT
echo "$packages" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
shell: bash
outputs:
packages: ${{ steps.set-packages.outputs.packages }}
lint:
needs: changes
runs-on: ubuntu-latest
strategy:
matrix:
package: ${{ fromJSON(needs.changes.outputs.packages || '[]') }}
if: ${{ needs.changes.outputs.packages != '[]' }}
steps:
- name: Fetch Repository
uses: actions/checkout@v5
- uses: actions/setup-go@v6
with:
# NOTE: Keep this in sync with the version from go.mod
go-version: "1.25.x"
cache: false
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v8
with:
args: "--tests=false --timeout=5m"
working-directory: ./v3/${{ matrix.package }}
# NOTE: Keep this in sync with the version from .golangci.yml
version: v2.6.0
# NOTE(ldez): temporary workaround
install-mode: goinstall