blob: bc83bbe098deaec88d8913e33c99ace22390f21f (
plain)
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
|
name: CI
on:
pull_request:
push:
jobs:
verify:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Install tooling
run: |
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"
go install github.com/magefile/mage@v1.15.0
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.64.8
- name: Gate vet
run: mage vet
- name: Gate lint
env:
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
PUSH_BEFORE_SHA: ${{ github.event.before }}
run: |
BASE_SHA="${PR_BASE_SHA:-$PUSH_BEFORE_SHA}"
if [ -z "$BASE_SHA" ] || [ "$BASE_SHA" = "0000000000000000000000000000000000000000" ]; then
if git rev-parse HEAD^ >/dev/null 2>&1; then
BASE_SHA="$(git rev-parse HEAD^)"
else
BASE_SHA="$(git rev-list --max-parents=0 HEAD)"
fi
fi
echo "Lint baseline: $BASE_SHA"
golangci-lint run --new-from-rev="$BASE_SHA"
- name: Gate tests
run: mage test
|