-
Notifications
You must be signed in to change notification settings - Fork 16
62 lines (61 loc) · 1.57 KB
/
Lint_Build.yaml
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
name: Lint_Build_Test
on:
# See the documentation for more intricate event dispatch here:
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#on
push:
branches:
- "!dependabot/*"
- "*"
pull_request:
branches:
- "*"
jobs:
build:
name: Build & Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: actions/setup-go@v5
with:
go-version: "1.20"
- name: Tidy
run: |
GO_MOD_OUPUT="$(go mod tidy -v 2>&1)"
if [[ $GO_MOD_OUPUT == *"unused"* ]]; then
echo "${GO_MOD_OUPUT}"
exit 1
fi
- name: Format
run: |
go install mvdan.cc/gofumpt@v0.3.1
GOFUMPT_OUTPUT="$(gofumpt -d .)"
if [ -n "$GOFUMPT_OUTPUT" ]; then
echo "${GOFUMPT_OUTPUT}"
exit 1
fi
- name: Lint
run: |
go install github.com/mgechev/revive@latest
REVIVE_OUTPUT="$(revive -config .github/workflows/revive.toml ./...)"
if [ -n "$REVIVE_OUTPUT" ]; then
echo "${REVIVE_OUTPUT}"
exit 1
fi
- name: Build
run: go build -v -o ipfs-crawler cmd/ipfs-crawler/main.go
- name: Build Docker image and export binaries
run: ./build-in-docker.sh
unit:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup
uses: actions/setup-go@v5
with:
go-version: "1.20"
- name: Unit Tests
run: go test -v -race $(go list ./...)