-
Notifications
You must be signed in to change notification settings - Fork 23
86 lines (71 loc) · 2.16 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: ["**"]
jobs:
check-formatting:
name: Check formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
otp-version: 25.0
elixir-version: 1.14
- name: Check Elixir formatting
run: mix format --check-formatted
test-elixir:
name: Test Elixir ${{ matrix.elixir }} / OTP ${{ matrix.otp }}
env:
MIX_ENV: test
strategy:
fail-fast: false
matrix:
include:
- elixir: 1.12
otp: 23
- elixir: 1.13
otp: 24
- elixir: 1.14
otp: 25
# TODO change this to ubuntu-latest after OTP 23 is deprecated, see
# https://github.com/erlef/setup-beam#compatibility-between-operating-system-and-erlangotp
# for compatibility
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
- name: Retrieve cached Elixir dependencies
uses: actions/cache@v3
id: mix-cache
with:
path: 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: Retrieve cached Elixir build
uses: actions/cache@v3
id: build-cache
with:
path: _build
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-build-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-build-
- name: Install Elixir dependencies
if: steps.mix-cache.outputs.cache-hit != 'true'
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get
mix deps.compile
- name: Compile Elixir
run: mix compile
- name: Run tests
run: mix test