-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (117 loc) · 3.2 KB
/
ci.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
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: "CI"
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
jobs:
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@2.0.0
with:
ignore_paths: "./vendor/**"
prettier:
name: Prettier
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Prettify code
uses: creyD/prettier_action@v4.3
with:
dry: true
prettier_options: --log-level debug --check .
hadolint:
name: hadolint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: hadolint/hadolint-action@v3.1.0
with:
dockerfile: "Dockerfile.template"
typocheck:
name: Spell Check with Typos
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v4
- name: Check for typos
uses: crate-ci/typos@master
with:
config: ./.typos.toml
go-vet:
name: go-vet
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: setup-go
uses: ./.github/actions/setup-go
- name: Run go vet
run: go vet ./...
go-staticcheck:
name: go-staticcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: setup-go
uses: ./.github/actions/setup-go
- name: Setup staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@latest
- name: Run staticcheck
run: staticcheck ./...
golines:
name: golines
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: setup-go
uses: ./.github/actions/setup-go
- name: Setup golines
run: go install github.com/segmentio/golines@latest
- name: Run golines
run: |
files=$(golines --ignored-dirs=vendor . --list-files)
if [ -n "${files}" ]; then
echo "The following files need reformatting:"
echo "${files}"
exit 1
fi
gosec:
name: gosec
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: setup-go
uses: ./.github/actions/setup-go
- name: Setup Gosec Security Scanner
run: go install github.com/securego/gosec/v2/cmd/gosec@latest
- name: Run Gosec Security Scanner
run: make gosec
test-go-build-run:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
name: Go build
steps:
- uses: actions/checkout@v4
- id: setup-go
uses: ./.github/actions/setup-go
- name: Setup docker (missing on MacOS)
if: runner.os == 'macos'
run: |
brew install --HEAD colima
brew install docker
colima start --arch x86_64
- name: Test Go build
run: go build -o bin/anchor cmd/main.go
- name: Test Go run
if: runner.os == 'ubuntu-latest' || runner.os == 'macos-latest'
run: go run cmd/main.go -y
- name: Run Tests
if: runner.os == 'ubuntu-latest' || runner.os == 'macos-latest'
run: make test