-
Notifications
You must be signed in to change notification settings - Fork 4
166 lines (144 loc) · 4.54 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
name: CI
on: push
env:
MIX_ENV: test
OTP_VERSION_SPEC: "24.2.1"
ELIXIR_VERSION_SPEC: "1.14"
jobs:
compile:
name: Compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: erlef/setup-beam@v1
id: setup
with:
otp-version: ${{ env.OTP_VERSION_SPEC }}
elixir-version: ${{ env.ELIXIR_VERSION_SPEC }}
- uses: actions/cache@v2
id: cache-mix
with:
path: deps
key: ${{ runner.os }}-mix-v5-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-v5-
- uses: actions/cache@v2
id: cache-build
with:
path: _build
key: ${{ runner.os }}-build-v4-${{ hashFiles('lib/**/*.ex') }}${{ hashFiles('test/**/*.ex') }}${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-build-v3-
- name: Install dependencies
if: steps.cache-mix.outputs.cache-hit != 'true'
run: mix deps.get
- name: Compile
if: steps.cache-build.outputs.cache-hit != 'true'
run: mix compile --warnings-as-errors
format:
name: "Check Formatted"
needs: compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: erlef/setup-beam@v1
id: setup
with:
otp-version: ${{ env.OTP_VERSION_SPEC }}
elixir-version: ${{ env.ELIXIR_VERSION_SPEC }}
- uses: actions/cache@v2
with:
path: deps
key: ${{ runner.os }}-mix-v5-${{ hashFiles('mix.lock') }}
- name: Check formatted
run: mix format --check-formatted
test:
name: Tests
needs: compile
runs-on: ubuntu-latest
services:
postgres:
image: postgres:12-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- uses: erlef/setup-beam@v1
id: setup
with:
otp-version: ${{ env.OTP_VERSION_SPEC }}
elixir-version: ${{ env.ELIXIR_VERSION_SPEC }}
- uses: actions/cache@v2
with:
path: deps
key: ${{ runner.os }}-mix-v5-${{ hashFiles('mix.lock') }}
- uses: actions/cache@v2
with:
path: _build
key: ${{ runner.os }}-build-v4-${{ hashFiles('lib/**/*.ex') }}${{ hashFiles('test/**/*.ex') }}${{ hashFiles('mix.lock') }}
- name: Run tests
run: mix coveralls.json
env:
DATABASE_URL: ecto://postgres:postgres@localhost/ecto_diff_test
- uses: codecov/codecov-action@v2
with:
token: ${{secrets.CODECOV_TOKEN}}
fail_ci_if_error: true
credo:
name: Credo
needs: compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: erlef/setup-beam@v1
id: setup
with:
otp-version: ${{ env.OTP_VERSION_SPEC }}
elixir-version: ${{ env.ELIXIR_VERSION_SPEC }}
- uses: actions/cache@v2
with:
path: deps
key: ${{ runner.os }}-mix-v5-${{ hashFiles('mix.lock') }}
- uses: actions/cache@v2
with:
path: _build
key: ${{ runner.os }}-build-v4-${{ hashFiles('lib/**/*.ex') }}${{ hashFiles('test/**/*.ex') }}${{ hashFiles('mix.lock') }}
- name: Run credo
run: mix credo --strict
dialyzer:
name: Dialyzer
runs-on: ubuntu-latest
env:
MIX_ENV: dev
steps:
- uses: actions/checkout@v2
- uses: erlef/setup-beam@v1
id: setup
with:
otp-version: ${{ env.OTP_VERSION_SPEC }}
elixir-version: ${{ env.ELIXIR_VERSION_SPEC }}
- uses: actions/cache@v2
id: cache-build-dev
with:
path: _build
key: ${{ runner.os }}-build-dev-v4-${{ hashFiles('lib/**/*.ex') }}${{ hashFiles('test/**/*.ex') }}${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-build-dev-v4-
- uses: actions/cache@v2
with:
path: plts
key: ${{ runner.os }}-plts-v4-${{ hashFiles('lib/**/*.ex') }}${{ hashFiles('test/**/*.ex') }}${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-plts-v4-
- name: Install dependencies
run: mix deps.get
- name: Compile
if: steps.cache-build-dev.outputs.cache-hit != 'true'
run: mix compile
- name: Run dialyzer
run: mix dialyzer