Skip to content

Commit 7f6da17

Browse files
committed
Add GitHub Actions CI with toolchain-scoped caches
1 parent 6e163fe commit 7f6da17

1 file changed

Lines changed: 110 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: Elixir CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
MIX_ENV: test
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
test:
17+
name: "Elixir ${{ matrix.elixir }} / OTP ${{ matrix.otp }}${{ matrix.lint && ' (lint)' || '' }}"
18+
runs-on: ubuntu-latest
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
# Elixir 1.17 — supports OTP 25–27
25+
- elixir: "1.17-otp-26"
26+
otp: "26"
27+
- elixir: "1.17-otp-27"
28+
otp: "27"
29+
30+
# Elixir 1.18 — supports OTP 25–27
31+
- elixir: "1.18-otp-26"
32+
otp: "26"
33+
- elixir: "1.18-otp-27"
34+
otp: "27"
35+
36+
# Elixir 1.19 — supports OTP 26–28
37+
- elixir: "1.19-otp-26"
38+
otp: "26"
39+
- elixir: "1.19-otp-27"
40+
otp: "27"
41+
- elixir: "1.19-otp-28"
42+
otp: "28"
43+
44+
# Elixir 1.20 — supports OTP 27–29
45+
- elixir: "1.20.2-otp-27"
46+
otp: "27"
47+
- elixir: "1.20.2-otp-28"
48+
otp: "28"
49+
- elixir: "1.20.2-otp-29"
50+
otp: "29"
51+
lint: true
52+
53+
steps:
54+
- name: Checkout
55+
uses: actions/checkout@v5
56+
57+
- name: Set up Elixir
58+
uses: erlef/setup-beam@v1
59+
with:
60+
elixir-version: ${{ matrix.elixir }}
61+
otp-version: ${{ matrix.otp }}
62+
63+
- name: Restore dependency cache
64+
uses: actions/cache@v5
65+
with:
66+
path: |
67+
deps
68+
_build
69+
key: mix-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('mix.lock') }}
70+
restore-keys: |
71+
mix-${{ matrix.elixir }}-${{ matrix.otp }}-
72+
73+
- name: Install dependencies
74+
run: mix deps.get
75+
76+
- name: Check formatting
77+
if: matrix.lint
78+
run: mix format --check-formatted
79+
80+
- name: Compile (warnings as errors)
81+
run: mix compile --warnings-as-errors
82+
83+
- name: Run tests
84+
if: ${{ !matrix.lint }}
85+
run: mix test
86+
87+
- name: Run tests with coverage
88+
if: matrix.lint
89+
run: mix test --cover
90+
91+
- name: Build docs (warnings as errors)
92+
if: matrix.lint
93+
env:
94+
MIX_ENV: release
95+
run: mix docs --warnings-as-errors
96+
97+
- name: Restore PLT cache
98+
if: matrix.lint
99+
uses: actions/cache@v5
100+
with:
101+
path: _build/dev/dialyxir_*
102+
key: plt-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('mix.lock') }}
103+
restore-keys: |
104+
plt-${{ matrix.elixir }}-${{ matrix.otp }}-
105+
106+
- name: Run dialyzer
107+
if: matrix.lint
108+
env:
109+
MIX_ENV: dev
110+
run: mix dialyzer

0 commit comments

Comments
 (0)