-
Notifications
You must be signed in to change notification settings - Fork 45
95 lines (95 loc) · 2.2 KB
/
pr.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
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
87
88
89
90
91
92
93
94
95
name: PR
on:
workflow_dispatch: {}
pull_request:
branches:
- main
paths:
- "!docs/**"
- "!archive/**"
- "!custom-archive/**"
- "!tools/bin/**"
- "!**.yaml"
- "!**.md"
- "!**.txt"
- "!**.conf"
# override previous rules:
- "**.c"
- "**.h"
- "**.go"
- "**.sh"
- ".github/workflows/pr.yaml"
concurrency:
group: ${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
#
# CODE VERIFICATION
#
verify-analyze-code:
name: Verify and Analyze Code
runs-on: ubuntu-latest
steps:
#
- name: Checkout Code
uses: actions/checkout@v2
with:
submodules: true
#
- name: Install Dependencies
uses: ./.github/actions/build-dependencies
with:
install-deps-opt: pr
#
- name: Install staticchecker
run: |
GOROOT=/usr/local/go GOPATH=$HOME/go go install honnef.co/go/tools/cmd/staticcheck@latest
sudo cp $HOME/go/bin/staticcheck /usr/bin/
shell: bash
#
- name: Install goimports-reviser
run: |
GOROOT=/usr/local/go GOPATH=$HOME/go go install github.com/incu6us/goimports-reviser/v3@latest
sudo cp $HOME/go/bin/goimports-reviser /usr/bin/
shell: bash
#
- name: Lint
run: |
if test -z "$(gofmt -l .)"; then
echo "Congrats! There is nothing to fix."
else
echo "The following lines should be fixed."
gofmt -s -d .
exit 1
fi
#
- name: Check Golang Vet
run: |
make check-vet
#
- name: Check with StaticCheck
run: |
make check-staticcheck
#
# CODE TESTS
#
unit-tests:
name: Unit Tests
needs:
- verify-analyze-code
runs-on: ubuntu-latest
steps:
#
- name: Checkout Code
uses: actions/checkout@v2
with:
submodules: true
#
- name: Install Dependencies
uses: ./.github/actions/build-dependencies
with:
install-deps-opt: pr
#
- name: Run Unit Tests
run: |
make test-unit