-
-
Notifications
You must be signed in to change notification settings - Fork 31
99 lines (94 loc) · 2.97 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
name: CI
on:
pull_request:
branches:
- 'main'
push:
branches:
- 'main'
jobs:
test-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- name: Read file
id: set-matrix
run: |
matrixStringifiedObject="$(jq -c . .github/elixir-test-matrix.json)"
echo "matrix=$matrixStringifiedObject" >> $GITHUB_OUTPUT
lint:
needs: [test-matrix]
name: Lint on Elixir ${{ matrix.elixir_version }} (OTP ${{ matrix.otp_version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
version-type: strict
otp-version: ${{ matrix.otp_version }}
elixir-version: ${{ matrix.elixir_version }}
- name: Cache
uses: actions/cache@v3
with:
path: |
~/deps
~/_build
key: ${{ runner.os }}-lint-${{ matrix.otp_version }}-${{ matrix.elixir_version }}-${{ hashFiles('**/mix.lock') }}
- name: Fetch deps
if: steps.deps-cache.outputs.cache-hit != 'true'
run: mix deps.get
- name: Compile project
run: mix compile --warnings-as-errors
- name: Check formatting
if: matrix.check_formatted
run: mix format --check-formatted
- name: Create plts folder
run: mkdir plts
- name: PLTs cache
uses: actions/cache@v3
id: plt-cache
with:
path: |
~/plts
key: ${{ runner.os }}-${{ runner.arch }}-plts-${{ matrix.otp-version }}-${{ matrix.elixir-version }}-${{ hashFiles('**/mix.lock') }}
- name: Create PLTs
if: steps.plt-cache.outputs.cache-hit != 'true'
run: mix dialyzer --plt
- name: Dialyze
run: mix dialyzer --no-check
test:
needs: [test-matrix]
name: Test on Elixir ${{ matrix.elixir_version }} (OTP ${{ matrix.otp_version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
version-type: strict
otp-version: ${{ matrix.otp_version }}
elixir-version: ${{ matrix.elixir_version }}
- name: Cache
uses: actions/cache@v3
with:
path: |
~/deps
~/_build
key: ${{ runner.os }}-test-${{ matrix.otp_version }}-${{ matrix.elixir_version }}-${{ hashFiles('**/mix.lock') }}
- name: Fetch deps
if: steps.deps-cache.outputs.cache-hit != 'true'
run: mix deps.get
- name: Compile project
run: mix compile --warnings-as-errors
- name: Check formatting
run: mix format --check-formatted
if: matrix.check_formatted
- name: Test
run: mix test