-
Notifications
You must be signed in to change notification settings - Fork 2
180 lines (162 loc) · 5.48 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
name: CI
on:
pull_request:
push:
branches:
- main
env:
CACHE_PREFIX: v1
CACHE_PREFIX_DIALYZER: v1-dialyzer
jobs:
mix_test:
name: mix test (Erlang/OTP ${{matrix.otp}} | Elixir ${{matrix.elixir}} | Alpine ${{ matrix.alpine }})
runs-on: ubuntu-latest
container: hexpm/elixir:${{ matrix.elixir }}-erlang-${{ matrix.otp }}-alpine-${{ matrix.alpine }}
env:
VERSION_ALPINE: ${{ matrix.alpine }}
VERSION_ELIXIR: ${{ matrix.elixir }}
VERSION_OTP: ${{ matrix.otp }}
MIX_ENV: test
strategy:
fail-fast: false
matrix:
include:
- alpine: 3.11.6
elixir: 1.9.0
otp: 21.3.8.16
- alpine: 3.11.6
elixir: 1.9.4
otp: 21.3.8.16
- alpine: 3.11.6
elixir: 1.9.4
otp: 21.3.8.16
- alpine: 3.11.6
elixir: 1.10.3
otp: 21.3.8.16
- alpine: 3.11.6
elixir: 1.11.2
otp: 22.3.4.3
- alpine: 3.11.6
elixir: 1.11.2
otp: 23.0.2
- alpine: 3.18.2
elixir: 1.12.3
otp: 24.3.4.13
- alpine: 3.18.2
elixir: 1.13.4
otp: 24.3.4.13
- alpine: 3.18.2
elixir: 1.13.4
otp: 25.3.2.3
- alpine: 3.18.2
elixir: 1.14.5
otp: 24.3.4.13
- alpine: 3.18.2
elixir: 1.14.5
otp: 25.3.2.3
- alpine: 3.18.2
elixir: 1.15.0
otp: 24.3.4.13
- alpine: 3.18.2
elixir: 1.15.0
otp: 25.3.2.3
- alpine: 3.18.2
elixir: 1.15.0
otp: 26.0.2
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-and-compile
with:
cache-version: ${{ env.CACHE_PREFIX }}
cache-os-version: alpine:${{ env.VERSION_ALPINE }}
cache-beam-versions: elixir:${{ env.VERSION_ELIXIR }}-otp:${{ env.VERSION_ELIXIR }}
generate-summary: true
- run: mix test
coverage:
name: Collect Test Coverage
runs-on: ubuntu-latest
container: hexpm/elixir:1.15.0-erlang-26.0.2-alpine-3.18.2
env:
VERSION_ALPINE: 3.18.2
VERSION_ELIXIR: 1.15.0
VERSION_OTP: 26.0.2
MIX_ENV: test
steps:
- name: Install git (required for mix coveralls.github)
run: apk add --no-cache git
# mix coveralls.github uses git to fetch the pr head so we ensure the whole history is available
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./.github/actions/setup-and-compile
with:
cache-version: ${{ env.CACHE_PREFIX }}
cache-os-version: alpine:${{ env.VERSION_ALPINE }}
cache-beam-versions: elixir:${{ env.VERSION_ELIXIR }}-otp:${{ env.VERSION_ELIXIR }}
generate-summary: true
- run: mix coveralls.github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
check_style:
name: Check Style
runs-on: ubuntu-latest
container: hexpm/elixir:1.15.0-erlang-26.0.2-alpine-3.18.2
env:
VERSION_ALPINE: 3.18.2
VERSION_ELIXIR: 1.15.0
VERSION_OTP: 26.0.2
MIX_ENV: dev
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-and-compile
with:
cache-version: ${{ env.CACHE_PREFIX }}
cache-os-version: alpine:${{ env.VERSION_ALPINE }}
cache-beam-versions: elixir:${{ env.VERSION_ELIXIR }}-otp:${{ env.VERSION_ELIXIR }}
generate-summary: true
- run: mix format --check-formatted
- run: mix credo
check_types:
name: Check Types
runs-on: ubuntu-latest
container: hexpm/elixir:1.15.0-erlang-26.0.2-alpine-3.18.2
env:
VERSION_ALPINE: 3.18.2
VERSION_ELIXIR: 1.15.0
VERSION_OTP: 26.0.2
MIX_ENV: dev
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-and-compile
with:
cache-version: ${{ env.CACHE_PREFIX }}
cache-os-version: alpine:${{ env.VERSION_ALPINE }}
cache-beam-versions: elixir:${{ env.VERSION_ELIXIR }}-otp:${{ env.VERSION_ELIXIR }}
generate-summary: true
- id: cache
uses: ./.github/actions/compute-cache-key
with:
version: ${{ env.CACHE_PREFIX_DIALYZER }}
os-version: alpine:${{ env.VERSION_ALPINE }}
beam-versions: elixir:${{ env.VERSION_ELIXIR }}-otp:${{ env.VERSION_OTP }}
generate-summary: true
- name: Cache - Dialyzer PLTs
id: plt_cache
uses: actions/cache@v4
with:
# This is not working - we're keeping it so that it starts working when https://github.com/actions/cache/issues/1315 is resolved
save-always: true
path: .dialyzer/
key: ${{ steps.cache.outputs.key }}-plt-mix.lock:${{ hashFiles('mix.lock') }}-${{ hashFiles('lib/**') }}
restore-keys: |
${{ steps.cache.outputs.key }}-plt-mix.lock:${{ hashFiles('mix.lock') }}-
${{ steps.cache.outputs.key }}-plt-
- run: mix dialyzer --format github
# TODO: Remove this as soon as https://github.com/actions/cache/issues/1315 is resolved (and save-always works)
- if: steps.plt_cache.outputs.cache-hit != 'true'
name: Save PLT cache
id: plt_cache_save
uses: actions/cache/save@v4
with:
path: .dialyzer/
key: ${{ steps.cache.outputs.key }}-plt-mix.lock:${{ hashFiles('mix.lock') }}-${{ hashFiles('lib/**') }}