Repository navigation
75 lines (65 loc) · 2.68 KB
/
Copy pathlint.yml
File metadata and controls
75 lines (65 loc) · 2.68 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
# Lint: gofmt/goimports and golangci-lint, split into their own jobs so a
# formatting failure and a lint failure show up as distinct checks.
#
# Structure follows ais-schule/community-exchange's .github/workflows/lint.yml
# (workflow_call, one job per check, concurrency-cancelled). Not a `uses:`
# call to that file directly: its jobs assume a plain `go build`, but
# splitkauf's ports/web package needs `make generate` first (the gitignored
# ports/web/dist/index.html embed stub — see Makefile), so both jobs here run
# through the equivalent make targets instead of raw gofmt/golangci-lint
# invocations. govulncheck is deliberately not mirrored as a third job: it
# already runs as part of `make security` in quality.yml's gates job, and
# splitkauf has no push-time security hook that would need it split out.
name: Lint
on:
workflow_call:
inputs:
caller:
description: >-
Name of the calling workflow (e.g. "ci", "quality"). Included in
the concurrency group below so two callers running on the same ref
at once don't cancel each other's lint run.
type: string
required: true
concurrency:
group: lint-${{ inputs.caller }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
fmt:
name: fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache-dependency-path: "**/go.sum"
# Same pin as the golangci-lint job below and .pre-commit-config.yaml's
# `rev:` (kept in sync by hack/lint/check-golangci-pin.sh).
- name: Install the pinned golangci-lint
run: |
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.13.1
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
- name: "Check formatting (golangci-lint fmt: gofmt + goimports)"
run: make fmt-check
golangci-lint:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
cache-dependency-path: "**/go.sum"
- name: Install the pinned golangci-lint
run: |
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.13.1
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
- name: Run golangci-lint
run: make lint