-
Notifications
You must be signed in to change notification settings - Fork 155
45 lines (45 loc) · 1.25 KB
/
checks.yml
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
name: Checks
# Run on push to main and any pull request.
on:
push:
branches:
- main
pull_request:
permissions:
checks: write # Allow write access to checks to allow annotation of code in the PR.
contents: read
pull-requests: read
env:
CGO_ENABLED: 0
GO_VERSION: stable
GOLANGCI_LINT_VERSION: v1.58.1
SHELLCHECK_SCRIPTS: ./*.sh
jobs:
go-lint-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Run GolangCI-Lint
uses: golangci/golangci-lint-action@v6
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
go-mod-checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Check if go.mod is tidy
run: |
go mod tidy
git diff --exit-code go.mod go.sum ||
(echo "::error::go.mod and go.sum need to be tidy" && exit 1)
- name: Check if vendor directory is up to date
run: |
go mod vendor
git diff --exit-code vendor ||
(echo "::error::vendor directory needs to be updated" && exit 1)