Skip to content

Commit dfdac6d

Browse files
authored
Merge pull request #13 from davydog187/add-github-actions
ci: add GitHub Actions workflow
2 parents 5b28894 + c592d90 commit dfdac6d

1 file changed

Lines changed: 99 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
name: Test (Elixir ${{ matrix.elixir }} / OTP ${{ matrix.otp }})
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
include:
18+
- elixir: "1.18"
19+
otp: "27"
20+
- elixir: "1.19"
21+
otp: "28"
22+
23+
steps:
24+
- uses: actions/checkout@v6
25+
26+
- uses: erlef/setup-beam@v1
27+
with:
28+
elixir-version: ${{ matrix.elixir }}
29+
otp-version: ${{ matrix.otp }}
30+
31+
- name: Restore dependencies cache
32+
uses: actions/cache@v5
33+
with:
34+
path: deps
35+
key: ${{ runner.os }}-mix-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('**/mix.lock') }}
36+
restore-keys: ${{ runner.os }}-mix-${{ matrix.elixir }}-${{ matrix.otp }}-
37+
38+
- name: Restore build cache
39+
uses: actions/cache@v5
40+
with:
41+
path: _build
42+
key: ${{ runner.os }}-build-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('**/mix.lock') }}
43+
restore-keys: ${{ runner.os }}-build-${{ matrix.elixir }}-${{ matrix.otp }}-
44+
45+
- name: Install dependencies
46+
run: mix deps.get
47+
48+
- name: Check lockfile is up to date
49+
run: mix deps.get --check-unlocked
50+
51+
- name: Check for unused dependencies
52+
run: mix deps.unlock --check-unused
53+
54+
- name: Check formatting
55+
run: mix format --check-formatted
56+
57+
- name: Compile (warnings as errors)
58+
run: mix compile --warnings-as-errors
59+
60+
- name: Check for compile-time dependency cycles
61+
run: mix xref graph --format cycles --label compile-connected --fail-above 0
62+
63+
- name: Run tests
64+
run: mix test
65+
66+
dialyzer:
67+
name: Dialyzer
68+
runs-on: ubuntu-latest
69+
70+
steps:
71+
- uses: actions/checkout@v6
72+
73+
- uses: erlef/setup-beam@v1
74+
with:
75+
elixir-version: "1.18"
76+
otp-version: "27"
77+
78+
- name: Restore dependencies cache
79+
uses: actions/cache@v5
80+
with:
81+
path: deps
82+
key: ${{ runner.os }}-mix-dialyzer-${{ hashFiles('**/mix.lock') }}
83+
restore-keys: ${{ runner.os }}-mix-dialyzer-
84+
85+
- name: Restore build and PLT cache
86+
uses: actions/cache@v5
87+
with:
88+
path: _build
89+
key: ${{ runner.os }}-build-dialyzer-${{ hashFiles('**/mix.lock') }}
90+
restore-keys: ${{ runner.os }}-build-dialyzer-
91+
92+
- name: Install dependencies
93+
run: mix deps.get
94+
95+
- name: Create PLTs
96+
run: mix dialyzer --plt
97+
98+
- name: Run Dialyzer
99+
run: mix dialyzer --format github

0 commit comments

Comments
 (0)