-
-
Notifications
You must be signed in to change notification settings - Fork 154
102 lines (85 loc) · 3.07 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
name: CI
on: push
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
elixir:
name: Elixir ${{ matrix.elixir }} (OTP ${{ matrix.otp }})
runs-on: ubuntu-latest
env:
MIX_ENV: test
services:
db:
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
image: postgres:14-alpine
ports: ['5432:5432']
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
matrix:
include:
- elixir: '1.15.4'
otp: '26'
steps:
- uses: actions/checkout@v3
- name: Setup Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
version-type: strict
- name: Restore Mix Dependencies Cache
uses: actions/cache@v3
id: mix-deps
with:
path: deps
key: mix-deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
mix-deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ env.cache-name }}-
mix-deps-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-
- name: Restore Mix Build Cache
uses: actions/cache@v3
id: mix-build
with:
path: _build
key: mix-build-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
mix-build-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ env.cache-name }}-
mix-build-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-
- name: Restore PLT cache
uses: actions/cache@v3
id: plt-cache
with:
path: priv/plts
key: plt-${{ runner.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('**/mix.lock') }}
restore-keys: plt-${{ runner.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('**/mix.lock') }}
- name: Install Mix Dependencies
if: steps.mix-deps.outputs.cache-hit != 'true'
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get
- name: Compile Project
run: |
MIX_ENV=test mix compile --warnings-as-errors
MIX_ENV=dev mix compile --warnings-as-errors
- name: Check Unused Dependencies
run: mix deps.unlock --check-unused
- name: Check Code Formatting
run: mix format --check-formatted
- name: Run Tests
run: mix test --trace --slowest 10
- name: Run Credo
run: mix credo --strict
- name: Create PLT
if: steps.plt-cache.outputs.cache-hit != 'true'
run: MIX_ENV=dev mix dialyzer --plt
- name: Run Dialyzer
run: MIX_ENV=dev mix dialyzer --no-check --halt-exit-status --format github