Skip to content

Commit 8094f76

Browse files
committed
Add CI
1 parent 86a8340 commit 8094f76

3 files changed

Lines changed: 118 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
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–28
45+
- elixir: "1.20.0-rc.4-otp-27"
46+
otp: "27"
47+
- elixir: "1.20.0-rc.4-otp-28"
48+
otp: "28"
49+
lint: true
50+
51+
steps:
52+
- name: Checkout
53+
uses: actions/checkout@v5
54+
55+
- name: Install system dependencies (tesseract, leptonica, libvips)
56+
run: |
57+
sudo apt-get update
58+
sudo apt-get install -y --no-install-recommends \
59+
pkg-config \
60+
tesseract-ocr \
61+
libtesseract-dev \
62+
libleptonica-dev \
63+
libvips-dev
64+
65+
- name: Verify tesseract version
66+
run: |
67+
tesseract --version
68+
pkg-config --modversion tesseract
69+
pkg-config --atleast-version=5.0.0 tesseract
70+
71+
- name: Set up Elixir
72+
uses: erlef/setup-beam@v1
73+
with:
74+
elixir-version: ${{ matrix.elixir }}
75+
otp-version: ${{ matrix.otp }}
76+
77+
- name: Restore dependency cache
78+
uses: actions/cache@v5
79+
with:
80+
path: |
81+
deps
82+
_build
83+
key: mix-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('mix.lock') }}
84+
restore-keys: |
85+
mix-${{ matrix.elixir }}-${{ matrix.otp }}-
86+
87+
- name: Install dependencies
88+
run: mix deps.get
89+
90+
- name: Check formatting
91+
if: matrix.lint
92+
run: mix format --check-formatted
93+
94+
- name: Compile (warnings as errors)
95+
run: mix compile --warnings-as-errors
96+
97+
- name: Run tests
98+
run: mix test
99+
100+
- name: Restore PLT cache
101+
if: matrix.lint
102+
uses: actions/cache@v5
103+
with:
104+
path: _build/dev/dialyxir_*
105+
key: plt-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('mix.lock') }}
106+
restore-keys: |
107+
plt-${{ matrix.elixir }}-${{ matrix.otp }}-
108+
109+
- name: Run dialyzer
110+
if: matrix.lint
111+
env:
112+
MIX_ENV: dev
113+
run: mix dialyzer

mix.exs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ defmodule ImageOcr.MixProject do
88
[
99
app: :image_ocr,
1010
version: @version,
11-
elixir: "~> 1.20-rc",
11+
elixir: "~> 1.17",
1212
start_permanent: Mix.env() == :prod,
1313
compilers: [:elixir_make] ++ Mix.compilers(),
1414
elixirc_paths: elixirc_paths(Mix.env()),
@@ -36,7 +36,8 @@ defmodule ImageOcr.MixProject do
3636
{:vix, "~> 0.30"},
3737
{:nimble_pool, "~> 1.1"},
3838
{:elixir_make, "~> 0.8", runtime: false},
39-
{:ex_doc, "~> 0.34", only: :dev, runtime: false}
39+
{:ex_doc, "~> 0.34", only: :dev, runtime: false},
40+
{:dialyxir, "~> 1.4", only: [:dev, :test], runtime: false}
4041
]
4142
end
4243

mix.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
%{
22
"cc_precompiler": {:hex, :cc_precompiler, "0.1.11", "8c844d0b9fb98a3edea067f94f616b3f6b29b959b6b3bf25fee94ffe34364768", [:mix], [{:elixir_make, "~> 0.7", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "3427232caf0835f94680e5bcf082408a70b48ad68a5f5c0b02a3bea9f3a075b9"},
3+
"dialyxir": {:hex, :dialyxir, "1.4.7", "dda948fcee52962e4b6c5b4b16b2d8fa7d50d8645bbae8b8685c3f9ecb7f5f4d", [:mix], [{:erlex, ">= 0.2.8", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "b34527202e6eb8cee198efec110996c25c5898f43a4094df157f8d28f27d9efe"},
34
"earmark_parser": {:hex, :earmark_parser, "1.4.44", "f20830dd6b5c77afe2b063777ddbbff09f9759396500cdbe7523efd58d7a339c", [:mix], [], "hexpm", "4778ac752b4701a5599215f7030989c989ffdc4f6df457c5f36938cc2d2a2750"},
45
"elixir_make": {:hex, :elixir_make, "0.9.0", "6484b3cd8c0cee58f09f05ecaf1a140a8c97670671a6a0e7ab4dc326c3109726", [:mix], [], "hexpm", "db23d4fd8b757462ad02f8aa73431a426fe6671c80b200d9710caf3d1dd0ffdb"},
6+
"erlex": {:hex, :erlex, "0.2.8", "cd8116f20f3c0afe376d1e8d1f0ae2452337729f68be016ea544a72f767d9c12", [:mix], [], "hexpm", "9d66ff9fedf69e49dc3fd12831e12a8a37b76f8651dd21cd45fcf5561a8a7590"},
57
"ex_doc": {:hex, :ex_doc, "0.40.1", "67542e4b6dde74811cfd580e2c0149b78010fd13001fda7cfeb2b2c2ffb1344d", [:mix], [{:earmark_parser, "~> 1.4.44", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "bcef0e2d360d93ac19f01a85d58f91752d930c0a30e2681145feea6bd3516e00"},
68
"makeup": {:hex, :makeup, "1.2.1", "e90ac1c65589ef354378def3ba19d401e739ee7ee06fb47f94c687016e3713d1", [:mix], [{:nimble_parsec, "~> 1.4", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "d36484867b0bae0fea568d10131197a4c2e47056a6fbe84922bf6ba71c8d17ce"},
79
"makeup_elixir": {:hex, :makeup_elixir, "1.0.1", "e928a4f984e795e41e3abd27bfc09f51db16ab8ba1aebdba2b3a575437efafc2", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "7284900d412a3e5cfd97fdaed4f5ed389b8f2b4cb49efc0eb3bd10e2febf9507"},

0 commit comments

Comments
 (0)