Skip to content

Commit e3fbda6

Browse files
committed
Initial release
0 parents  commit e3fbda6

26 files changed

Lines changed: 5773 additions & 0 deletions

.formatter.exs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Used by "mix format"
2+
[
3+
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
4+
]

.github/workflows/ci.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
include:
15+
- os: ubuntu-latest
16+
elixir: "1.16.x"
17+
otp: "26.x"
18+
- os: ubuntu-latest
19+
elixir: "1.17.x"
20+
otp: "27.x"
21+
- os: macos-latest
22+
elixir: "1.17.x"
23+
otp: "27.x"
24+
runs-on: ${{ matrix.os }}
25+
env:
26+
MIX_ENV: test
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Set up Erlang/Elixir (Linux)
31+
if: runner.os == 'Linux'
32+
uses: erlef/setup-beam@v1
33+
with:
34+
otp-version: ${{ matrix.otp }}
35+
elixir-version: ${{ matrix.elixir }}
36+
37+
- name: Set up Erlang/Elixir (macOS)
38+
if: runner.os == 'macOS'
39+
run: |
40+
brew install elixir
41+
42+
- uses: actions/cache@v4
43+
with:
44+
path: |
45+
deps
46+
_build
47+
key: ${{ runner.os }}-mix-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}
48+
restore-keys: |
49+
${{ runner.os }}-mix-${{ matrix.otp }}-${{ matrix.elixir }}-
50+
51+
- run: mix deps.get
52+
- run: mix compile --warnings-as-errors
53+
- run: mix test --include concurrency

.github/workflows/precompile.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: precompile
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
9+
jobs:
10+
linux:
11+
runs-on: ubuntu-latest
12+
env:
13+
MIX_ENV: prod
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
include:
18+
- elixir: "1.17.x"
19+
otp: "26.x"
20+
- elixir: "1.17.x"
21+
otp: "27.x"
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- uses: erlef/setup-beam@v1
26+
with:
27+
otp-version: ${{ matrix.otp }}
28+
elixir-version: ${{ matrix.elixir }}
29+
30+
- name: Cache musl cross-compilers
31+
id: cache-musl
32+
uses: actions/cache@v4
33+
with:
34+
path: |
35+
x86_64-linux-musl-cross
36+
aarch64-linux-musl-cross
37+
key: musl-${{ runner.os }}-build
38+
39+
- if: steps.cache-musl.outputs.cache-hit != 'true'
40+
name: Install musl cross-compilers
41+
run: |
42+
curl -fsSL https://more.musl.cc/11.2.1/x86_64-linux-musl/x86_64-linux-musl-cross.tgz | tar -xz
43+
curl -fsSL https://more.musl.cc/11.2.1/x86_64-linux-musl/aarch64-linux-musl-cross.tgz | tar -xz
44+
45+
- name: Install GNU cross-compilers
46+
run: |
47+
sudo apt-get update
48+
sudo apt-get install -y gcc make curl tar \
49+
gcc-aarch64-linux-gnu \
50+
gcc-arm-linux-gnueabihf
51+
echo "$PWD/x86_64-linux-musl-cross/bin" >> $GITHUB_PATH
52+
echo "$PWD/aarch64-linux-musl-cross/bin" >> $GITHUB_PATH
53+
54+
- run: mix deps.get
55+
56+
- name: Pre-compile NIF artefacts
57+
run: |
58+
export ELIXIR_MAKE_CACHE_DIR=$PWD/cache
59+
mkdir -p "$ELIXIR_MAKE_CACHE_DIR"
60+
mix elixir_make.precompile
61+
62+
- uses: softprops/action-gh-release@v2
63+
if: startsWith(github.ref, 'refs/tags/')
64+
with:
65+
files: cache/*.tar.gz
66+
67+
macos:
68+
runs-on: macos-latest
69+
env:
70+
MIX_ENV: prod
71+
strategy:
72+
fail-fast: false
73+
matrix:
74+
include:
75+
- elixir: "1.17.x"
76+
otp: "26.x"
77+
- elixir: "1.17.x"
78+
otp: "27.x"
79+
steps:
80+
- uses: actions/checkout@v4
81+
82+
- uses: erlef/setup-beam@v1
83+
with:
84+
otp-version: ${{ matrix.otp }}
85+
elixir-version: ${{ matrix.elixir }}
86+
87+
- run: mix deps.get
88+
89+
- name: Pre-compile NIF artefacts (universal — x86_64 + arm64)
90+
run: |
91+
export ELIXIR_MAKE_CACHE_DIR=$PWD/cache
92+
mkdir -p "$ELIXIR_MAKE_CACHE_DIR"
93+
mix elixir_make.precompile
94+
95+
- uses: softprops/action-gh-release@v2
96+
if: startsWith(github.ref, 'refs/tags/')
97+
with:
98+
files: cache/*.tar.gz

.gitignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# The directory Mix will write compiled artifacts to.
2+
/_build/
3+
4+
# If you run "mix test --cover", coverage assets end up here.
5+
/cover/
6+
7+
# The directory Mix downloads your dependencies sources to.
8+
/deps/
9+
10+
# Where third-party dependencies like ExDoc output generated docs.
11+
/doc/
12+
13+
# Temporary files, for example, from tests.
14+
/tmp/
15+
16+
# If the VM crashes, it generates a dump, let's ignore it too.
17+
erl_crash.dump
18+
19+
# Also ignore archive artifacts (built via "mix archive.build").
20+
*.ez
21+
22+
# Ignore package tarball (built via "mix hex.build").
23+
image_qrcode-*.tar
24+
25+
# NIF build artefacts.
26+
c_src/**/*.o
27+
priv/*.so
28+
priv/*.dll
29+
priv/*.dylib
30+
31+
# elixir_make precompile cache (used during `mix elixir_make.precompile`).
32+
/cache/
33+
34+
# Generated by `mix elixir_make.precompile`. Required at hex publish time
35+
# (listed in package.files) but never committed.
36+
checksum.exs
37+

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Changelog
2+
3+
## Image.QRCode 0.1.0
4+
5+
This is the changelog for Image.QRCode version 0.1.0 released on April 28th, 2026.
6+
7+
### Initial release
8+
9+
* `Image.QRCode.encode/2` — encodes a string to a `Vix.Vips.Image.t/0` QR code
10+
with configurable error-correction level, version range, mask, scale and
11+
quiet-zone width.
12+
13+
* `Image.QRCode.decode/1` — decodes any QR codes in a `Vix.Vips.Image.t/0`,
14+
with implicit conversion of arbitrary colourspaces and band formats to
15+
single-band 8-bit grayscale.
16+
17+
* NIF binding implemented over the vendored
18+
[nayuki/QR-Code-generator](https://github.com/nayuki/QR-Code-generator)
19+
(encoder, MIT) and [dlbeer/quirc](https://github.com/dlbeer/quirc)
20+
(decoder, ISC) C libraries. Both encoder and decoder run on dirty CPU
21+
schedulers and are safe under concurrent invocation.
22+
23+
* Precompiled NIF artefacts published for Linux (gnu/musl × x86_64/aarch64/
24+
armv7), macOS (x86_64/arm64) and Windows (x86_64) via `cc_precompiler`.

0 commit comments

Comments
 (0)