-
Notifications
You must be signed in to change notification settings - Fork 2
255 lines (224 loc) · 6.68 KB
/
ci.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
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
name: Contracts CI
on:
push:
branches: [main]
pull_request:
env:
ELIXIR_VERSION: 1.14.3
OTP_VERSION: 25
ELIXIR_VERSION_OBS: 1.13.4
OTP_VERSION_OBS: 22
jobs:
elixir-deps:
name: Elixir dependencies (Elixir ${{ matrix.elixir }}, OTP ${{ matrix.otp }})
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- elixir: 1.14.3
otp: 25
- elixir: 1.13.4
otp: 22
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
env:
ImageOS: ubuntu20
- name: Retrieve Cached Dependencies
uses: actions/cache@v4
id: mix-cache
with:
path: |
elixir/deps
elixir/_build/test
elixir/priv/plts
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('elixir/mix.lock') }}
- name: Install Dependencies
if: steps.mix-cache.outputs.cache-hit != 'true'
working-directory: elixir
run: |
mkdir -p priv/plts
mix local.rebar --force
mix local.hex --force
mix deps.get
mix deps.compile --warnings-as-errors
mix dialyzer --plt
static-code-analysis-elixir:
name: Static Code Analysis elixir
needs: [elixir-deps]
runs-on: ubuntu-20.04
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ env.ELIXIR_VERSION }}
otp-version: ${{ env.OTP_VERSION }}
env:
ImageOS: ubuntu20
- name: Retrieve Elixir Cached Dependencies
uses: actions/cache@v4
id: mix-cache
with:
path: |
elixir/deps
elixir/_build/test
elixir/priv/plts
key: ${{ runner.os }}-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('elixir/mix.lock') }}
- name: Run Credo
working-directory: elixir
run: mix credo
- name: Check for unused dependencies
working-directory: elixir
run: mix deps.unlock --check-unused
- name: Check elixir Code Format
working-directory: elixir
run: ls -la && mix format --check-formatted
- name: Run Dialyzer
working-directory: elixir
run: mix dialyzer
check-elixir-contracts:
name: Check elixir contracts
needs: [elixir-deps]
runs-on: ubuntu-20.04
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v4
- name: Setup
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ env.ELIXIR_VERSION }}
otp-version: ${{ env.OTP_VERSION }}
env:
ImageOS: ubuntu20
- name: Retrieve Cached Dependencies
uses: actions/cache@v4
id: mix-cache
with:
path: |
elixir/deps
elixir/_build/test
elixir/priv/plts
key: ${{ runner.os }}-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('elixir/mix.lock') }}
- uses: arduino/setup-protoc@v1
with:
version: "3.20.1"
- name: Install protoc elixir plugin
run: mix escript.install --force hex protobuf
- name: Add escript bin folder to path
run: echo "$HOME/.mix/escripts" >> $GITHUB_PATH
- name: generate contracts
run: make elixir-generate
- name: Check for uncommitted schema changes
run: |
git add -N elixir/
git diff
git diff --quiet
- name: Git status
run: git status
check-go-contracts:
name: Check go contracts
runs-on: ubuntu-20.04
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.18
- uses: arduino/setup-protoc@v1
with:
version: "3.20.1"
- name: Install protoc gen go
run: go install google.golang.org/protobuf/cmd/[email protected]
- name: generate contracts
run: make go-generate
- name: Check for uncommitted schema changes
run: |
git add -N go/
git diff
git diff --quiet
- name: Git status
run: git status
test-golang:
name: Go test
needs: [check-go-contracts]
runs-on: ubuntu-20.04
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: 1.18
- name: Run golang tests
working-directory: go
run: go mod download && go test ./...
test-elixir:
name: Elixir test (Elixir ${{ matrix.elixir }}, OTP ${{ matrix.otp }})
needs: [elixir-deps, check-elixir-contracts]
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- elixir: 1.14.3
otp: 25
- elixir: 1.13.4
otp: 22
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- name: Retrieve Cached Dependencies
uses: actions/cache@v4
id: mix-cache
with:
path: |
elixir/deps
elixir/_build/test
elixir/priv/plts
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('elixir/mix.lock') }}
- name: Compile
working-directory: elixir
run: mix compile --warnings-as-errors
- name: Run elixir test
working-directory: elixir
run: mix test --warnings-as-errors --color --trace --slowest 10