-
-
Notifications
You must be signed in to change notification settings - Fork 10
142 lines (136 loc) · 4.26 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
name: CI
env:
ELIXIR_VERSION: "1.17"
OTP_VERSION: "27"
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
test-coverage:
runs-on: ubuntu-latest
name: Test Coverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
id: beam
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- name: Restore dependencies and build cache
uses: actions/cache@v4
with:
path: |
_build
deps
key: ${{ runner.os }}-otp-${{ steps.beam.outputs.otp-version }}-elixir-${{ steps.beam.outputs.elixir-version }}-mix-${{ hashFiles('mix.lock') }}
restore-keys: ${{ runner.os }}-otp-${{ steps.beam.outputs.otp-version }}-elixir-${{ steps.beam.outputs.elixir-version }}-
- name: Install Dependencies
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get
- name: Run Tests
run: mix coveralls.github --warnings-as-errors
tests:
runs-on: ubuntu-latest
name: OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strategy:
matrix:
include:
- { elixir: 1.16, otp: 24 }
- { elixir: 1.16, otp: 25 }
- { elixir: 1.16, otp: 26 }
- { elixir: 1.17, otp: 25 }
- { elixir: 1.17, otp: 26 }
- { elixir: 1.17, otp: 27 }
steps:
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
id: beam
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
- name: Restore dependencies and build cache
uses: actions/cache@v4
with:
path: |
_build
deps
key: ${{ runner.os }}-otp-${{ steps.beam.outputs.otp-version }}-elixir-${{ steps.beam.outputs.elixir-version }}-mix-${{ hashFiles('mix.lock') }}
restore-keys: ${{ runner.os }}-otp-${{ steps.beam.outputs.otp-version }}-elixir-${{ steps.beam.outputs.elixir-version }}-
- name: Install Dependencies
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get
- name: Run Tests
run: mix test
matrix-results:
if: ${{ always() }}
runs-on: ubuntu-latest
name: Tests
needs:
- tests
steps:
- run: |
result="${{ needs.tests.result }}"
if [[ $result == "success" ]]; then
exit 0
else
exit 1
fi
code-quality:
runs-on: ubuntu-latest
name: Code Quality
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
id: beam
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- name: Restore dependencies and build cache
uses: actions/cache@v4
with:
path: |
_build
deps
key: ${{ runner.os }}-otp-${{ steps.beam.outputs.otp-version }}-elixir-${{ steps.beam.outputs.elixir-version }}-mix-${{ hashFiles('mix.lock') }}
restore-keys: ${{ runner.os }}-otp-${{ steps.beam.outputs.otp-version }}-elixir-${{ steps.beam.outputs.elixir-version }}-
- name: Restore PLT cache
uses: actions/cache@v4
id: plt_cache
with:
key: |
${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-plt-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-plt-
path: |
.plts
- name: Install Dependencies
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get
- name: Compile
run: mix compile --warnings-as-errors
- name: Run Formatter
run: mix format --check-formatted
- name: Run Linter
run: mix credo
- name: Run Hex Audit
run: mix hex.audit
- name: Generate docs
run: mix docs
- name: Run Dialyzer
run: mix dialyzer