Skip to content

Commit 1586498

Browse files
committed
Add CI
1 parent 6981354 commit 1586498

1 file changed

Lines changed: 90 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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+
# `vix` ships precompiled NIF and a precompiled libvips, so the
12+
# CI does not need to build libvips from source.
13+
VIX_COMPILATION_MODE: PRECOMPILED_NIF_AND_LIBVIPS
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
test:
20+
runs-on: ubuntu-latest
21+
name: Test on OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
22+
strategy:
23+
fail-fast: false
24+
# Track the same OTP / Elixir matrix as the `:image` library
25+
# since `:image` is our primary dependency. `:image` requires
26+
# OTP 26 or later.
27+
matrix:
28+
include:
29+
- otp: "26.2.5.6"
30+
elixir: "1.17.2-otp-26"
31+
- otp: "27.2"
32+
elixir: "1.17.2-otp-27"
33+
- otp: "27.2"
34+
elixir: "1.18.1-otp-27"
35+
- otp: "28.3.1"
36+
elixir: "1.19.4-otp-28"
37+
- otp: "28.3.1"
38+
elixir: "1.20.0-rc.4-otp-28"
39+
lint: true
40+
41+
steps:
42+
- name: Set up Elixir
43+
uses: erlef/setup-beam@v1
44+
with:
45+
otp-version: ${{matrix.otp}}
46+
elixir-version: ${{matrix.elixir}}
47+
48+
- name: Checkout code
49+
uses: actions/checkout@v6
50+
51+
- name: Cache deps
52+
id: cache-deps
53+
uses: actions/cache@v5
54+
env:
55+
cache-name: cache-elixir-deps
56+
with:
57+
path: deps
58+
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
59+
restore-keys: |
60+
${{ runner.os }}-mix-${{ env.cache-name }}-
61+
62+
- name: Cache compiled build
63+
id: cache-build
64+
uses: actions/cache@v5
65+
env:
66+
cache-name: cache-compiled-build
67+
with:
68+
path: _build
69+
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
70+
restore-keys: |
71+
${{ runner.os }}-mix-${{ env.cache-name }}-
72+
${{ runner.os }}-mix-
73+
74+
- name: Install dependencies
75+
run: mix deps.get
76+
77+
- name: Compile without warnings
78+
run: mix compile --warnings-as-errors
79+
if: ${{ matrix.lint }}
80+
81+
- name: Check formatting
82+
run: mix format --check-formatted
83+
if: ${{ matrix.lint }}
84+
85+
- name: Run tests
86+
run: mix test
87+
88+
- name: Build hex package (verify release readiness)
89+
run: MIX_ENV=prod mix hex.build
90+
if: ${{ matrix.lint }}

0 commit comments

Comments
 (0)