-
-
Notifications
You must be signed in to change notification settings - Fork 188
105 lines (87 loc) · 2.82 KB
/
main.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
name: Continuous Integration
on:
push:
branches:
- master
- release/**
pull_request:
env:
MIX_ENV: test
jobs:
test:
name: Test (Elixir ${{ matrix.elixir }}, OTP ${{ matrix.otp }})
runs-on: ubuntu-20.04
strategy:
matrix:
# https://hexdocs.pm/elixir/compatibility-and-deprecations.html#compatibility-between-elixir-and-erlang-otp
include:
# Newest supported Elixir/Erlang pair.
- elixir: '1.15'
otp: '26.0'
lint: true
dialyzer: true
# One version before the last supported one.
- elixir: '1.14.5'
otp: '25.2'
# Oldest supported Elixir/Erlang pair.
- elixir: '1.11.4'
otp: '21.3'
steps:
- name: Check out this repository
uses: actions/checkout@v3
- name: Setup Elixir and Erlang
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
# We need to manually restore and then save, so that we can save the "_build" directory
# *without* the Elixir compiled code in it.
- name: Restore Mix dependencies cache
uses: actions/cache/restore@v3
id: mix-deps-cache
with:
path: |
_build
deps
key: |
${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
restore-keys: |
${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-
- name: Install and compile Mix dependencies
if: steps.mix-deps-cache.outputs.cache-hit != 'true'
run: mix do deps.get, deps.compile
- name: Save Mix dependencies cache
uses: actions/cache/save@v3
if: steps.mix-deps-cache.outputs.cache-hit != 'true'
with:
path: |
_build
deps
key: |
${{ steps.mix-deps-cache.outputs.cache-primary-key }}
- name: Check formatting
if: matrix.lint
run: mix format --check-formatted
- name: Check compiler warnings
if: matrix.lint
run: mix compile --warnings-as-errors
- name: Run tests
run: mix test
- name: Retrieve PLT Cache
uses: actions/cache@v3
if: matrix.dialyzer
id: plt-cache
with:
path: priv/plts
key: |
${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plts-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
restore-keys: |
${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plts-
- name: Create PLTs
if: steps.plt-cache.outputs.cache-hit != 'true' && matrix.dialyzer
run: |
mkdir -p priv/plts
mix dialyzer --plt
- name: Run dialyzer
if: matrix.dialyzer
run: mix dialyzer --no-check --halt-exit-status