-
Notifications
You must be signed in to change notification settings - Fork 66
145 lines (134 loc) · 5.14 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
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
name: CI
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
on: [pull_request, push]
jobs:
linux:
name: Test on Ubuntu (Elixir ${{ matrix.elixir_version }}, OTP ${{ matrix.otp_version }})
runs-on: ubuntu-20.04
strategy:
matrix:
# Thoroughly check the most recent versions
elixir_version: ['1.13.4', '1.14.5', '1.15.7', '1.16.1']
otp_version: ['23.3', '24.3', '25.3', '26.2']
# Spot check older versions
#
# Goal is to have old versions (elixir and erlang) have basically one test each.
# That should be enough to affirm that they are working ok.
include:
- elixir_version: '1.7.4'
otp_version: '20.3'
- elixir_version: '1.8.2'
otp_version: '20.3'
- elixir_version: '1.9.4'
otp_version: '21.3'
- elixir_version: '1.10.4'
otp_version: '21.3'
- elixir_version: '1.11.4'
otp_version: '22.3'
- elixir_version: '1.12.3'
otp_version: '23.3'
- elixir_version: '1.13.4'
otp_version: '22.3'
# Check elixir main, sadly allow-failure is not a thing and workarounds seem hard
# feature request: https://github.com/orgs/community/discussions/15452
# potential workaround: https://github.com/mainmatter/continue-on-error-comment
- elixir_version: 'main'
otp_version: '26.2'
exclude:
- elixir_version: '1.15.7'
otp_version: '23.3'
- elixir_version: '1.16.1'
otp_version: '23.3'
- elixir_version: '1.13.4'
otp_version: '26.2'
- elixir_version: '1.14.5'
otp_version: '26.2'
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ matrix.elixir_version }}
otp-version: ${{ matrix.otp_version }}
- name: Restore deps and _build
uses: actions/cache@v3
with:
path: |
deps
_build
key: erlef-${{ runner.os }}-mix-${{ matrix.elixir_version }}-${{ matrix.otp_version }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Restore plts
uses: actions/cache@v3
with:
path: tools/plts
key: erlef-${{ runner.os }}-dialyzer-${{ matrix.elixir_version }}-${{ matrix.otp_version }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
if: contains(matrix.elixir_version, '1.16')
- run: mix deps.get
- run: MIX_ENV=test mix compile --warnings-as-errors
- run: mix credo
if: contains(matrix.elixir_version, '1.16')
- name: Check if formatted
if: contains(matrix.elixir_version, '1.16')
run: mix format --check-formatted
- name: Actual Tests
# this will let warnings slip through but I don't wanna replicate all that magic
# right now
run: MIX_ENV=test mix coveralls.github || mix test --failed
# Apparently the one with `!` can't go without the fancy expression syntax
if: ${{ !contains(matrix.elixir_version, '1.16') }}
- name: Actual Tests WITH warnings as errors
run: MIX_ENV=test mix coveralls.github --warnings-as-errors || mix test --failed
if: contains(matrix.elixir_version, '1.16')
- name: Dialyzer
run: mix dialyzer --halt-exit-status
if: contains(matrix.elixir_version, '1.16')
macos:
name: Test on MacOS
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
# no versioning on brew but getting asdf or something was a bigger headache
- name: Install Elixir
run: brew install elixir
- name: Restore deps and _build
uses: actions/cache@v3
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- run: mix local.hex --force
- run: mix deps.get
- run: mix local.rebar --force
- run: MIX_ENV=test mix compile --warnings-as-errors
- run: mix test || mix test --failed
windows:
name: Test on Windows
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Restore chocolatey
uses: actions/cache@v3
with:
path: C:\Users\runneradmin\AppData\Local\Temp\chocolatey
key: ${{ runner.os }}-chocolatey-${{ github.sha }}
restore-keys: |
${{ runner.os }}-chocolatey-
- name: Install Elixir
run: |
choco install elixir --version=1.14.2 --no-progress
set MIX_ENV=test
echo "C:\ProgramData\chocolatey\lib\Elixir\bin;C:\ProgramData\chocolatey\bin;C:\ProgramData\chocolatey\lib\Elixir\tools\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Build
run: |
echo "$PATH"
mix local.hex --force
mix deps.get
mix local.rebar --force
mix compile --warnings-as-errors
- name: Test
run: mix test || mix test --failed