-
Notifications
You must be signed in to change notification settings - Fork 1
214 lines (197 loc) · 5.72 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
name: CI
on:
push:
paths-ignore:
- docs/**
- load_tests/**
- rel/**
- scripts/**
- Dockerfile
- "*.md"
- LICENSE
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
API_KEY: ${{ secrets.API_KEY }}
API_URL: https://api-dev.mbtace.com/
DATABASE_URL_TEST: postgresql://postgres:postgres@localhost:5432/concierge
MIX_ENV: test
RECAPTCHA_PRIVATE_KEY: 6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe
RECAPTCHA_PUBLIC_KEY: 6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
id: asdf-cache
with:
path: ~/.asdf
key: ${{ secrets.CACHE_UUID }}-asdf-${{ hashFiles('.tool-versions') }}
- uses: asdf-vm/actions/install@v1
if: steps.asdf-cache.outputs.cache-hit != 'true'
- uses: mbta/actions/reshim-asdf@v1
- name: Elixir tools
if: steps.asdf-cache.outputs.cache-hit != 'true'
run: |
mix local.rebar --force
mix local.hex --force
- uses: actions/cache@v3
id: ex-deps-cache
with:
path: |
_build
deps
key: ${{ secrets.CACHE_UUID }}-mix-${{ hashFiles('**/mix.lock') }}
- name: Elixir dependencies
if: steps.ex-deps-cache.outputs.cache-hit != 'true'
run: |
mix deps.get
mix deps.compile
- uses: actions/cache@v3
id: js-deps-cache
with:
path: apps/concierge_site/assets/node_modules
key: ${{ secrets.CACHE_UUID }}-node-${{ hashFiles('**/package-lock.json') }}
- name: JS dependencies
if: steps.js-deps-cache.outputs.cache-hit != 'true'
run: npm ci --prefix apps/concierge_site/assets
format:
name: Format
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.asdf
key: ${{ secrets.CACHE_UUID }}-asdf-${{ hashFiles('.tool-versions') }}
- uses: mbta/actions/reshim-asdf@v1
- uses: actions/cache@v3
with:
path: |
_build
deps
key: ${{ secrets.CACHE_UUID }}-mix-${{ hashFiles('**/mix.lock') }}
- run: mix format --check-formatted
warnings:
name: Warnings
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.asdf
key: ${{ secrets.CACHE_UUID }}-asdf-${{ hashFiles('.tool-versions') }}
- uses: mbta/actions/reshim-asdf@v1
- uses: actions/cache@v3
with:
path: |
_build
deps
key: ${{ secrets.CACHE_UUID }}-mix-${{ hashFiles('**/mix.lock') }}
- run: mix compile --warnings-as-errors
credo:
name: Credo
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.asdf
key: ${{ secrets.CACHE_UUID }}-asdf-${{ hashFiles('.tool-versions') }}
- uses: mbta/actions/reshim-asdf@v1
- uses: actions/cache@v3
with:
path: |
_build
deps
key: ${{ secrets.CACHE_UUID }}-mix-${{ hashFiles('**/mix.lock') }}
- run: mix credo
sobelow:
name: Sobelow
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.asdf
key: ${{ secrets.CACHE_UUID }}-asdf-${{ hashFiles('.tool-versions') }}
- uses: mbta/actions/reshim-asdf@v1
- uses: actions/cache@v3
with:
path: |
_build
deps
key: ${{ secrets.CACHE_UUID }}-mix-${{ hashFiles('**/mix.lock') }}
- run: mix sobelow
tests:
name: Tests
runs-on: ubuntu-latest
needs: setup
services:
postgres:
image: postgres:13
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: alert_concierge_test
# Wait until the server is accepting connections
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
API_KEY: ${{ secrets.API_KEY }}
API_URL: https://api-dev.mbtace.com/
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.asdf
key: ${{ secrets.CACHE_UUID }}-asdf-${{ hashFiles('.tool-versions') }}
- uses: mbta/actions/reshim-asdf@v1
- uses: actions/cache@v3
with:
path: |
_build
deps
key: ${{ secrets.CACHE_UUID }}-mix-${{ hashFiles('**/mix.lock') }}
- uses: actions/cache@v3
with:
path: apps/concierge_site/assets/node_modules
key: ${{ secrets.CACHE_UUID }}-node-${{ hashFiles('**/package-lock.json') }}
- run: mix test --cover
- name: Upload coverage artifact
uses: actions/upload-artifact@v2
with:
name: elixir-lcov
path: |
cover/
apps/*/cover/
dialyzer:
name: Dialyzer
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: ~/.asdf
key: ${{ secrets.CACHE_UUID }}-asdf-${{ hashFiles('.tool-versions') }}
- uses: mbta/actions/reshim-asdf@v1
- uses: actions/cache@v3
with:
path: |
_build
deps
key: ${{ secrets.CACHE_UUID }}-mix-${{ hashFiles('**/mix.lock') }}
- uses: mbta/actions/dialyzer@v1