Skip to content

Fix with-usage cast for string-keyed maps and raise test coverage #14

Fix with-usage cast for string-keyed maps and raise test coverage

Fix with-usage cast for string-keyed maps and raise test coverage #14

Workflow file for this run

name: Elixir CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
MIX_ENV: test
PGHOST: localhost
PGUSER: postgres
PGPASSWORD: postgres
permissions:
contents: read
jobs:
test:
name: "Elixir ${{ matrix.elixir }} / OTP ${{ matrix.otp }}${{ matrix.lint && ' (lint)' || '' }}"
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17
env:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
fail-fast: false
matrix:
include:
# Elixir 1.17 — supports OTP 25–27
- elixir: "1.17-otp-26"
otp: "26"
- elixir: "1.17-otp-27"
otp: "27"
# Elixir 1.18 — supports OTP 25–27
- elixir: "1.18-otp-26"
otp: "26"
- elixir: "1.18-otp-27"
otp: "27"
# Elixir 1.19 — supports OTP 26–28
- elixir: "1.19-otp-26"
otp: "26"
- elixir: "1.19-otp-27"
otp: "27"
- elixir: "1.19-otp-28"
otp: "28"
# Elixir 1.20 — supports OTP 27–29
- elixir: "1.20.2-otp-27"
otp: "27"
- elixir: "1.20.2-otp-28"
otp: "28"
- elixir: "1.20.2-otp-29"
otp: "29"
lint: true
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- name: Restore dependency cache
uses: actions/cache@v5
with:
path: |
deps
_build
key: mix-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('mix.lock') }}
restore-keys: |
mix-${{ matrix.elixir }}-${{ matrix.otp }}-
- name: Install dependencies
run: mix deps.get
- name: Check formatting
if: matrix.lint
run: mix format --check-formatted
- name: Run credo
if: matrix.lint
run: mix credo --strict
- name: Compile (warnings as errors)
run: mix compile --warnings-as-errors
- name: Run tests
if: ${{ !matrix.lint }}
run: mix test
- name: Run tests with coverage
if: matrix.lint
run: mix test --cover
- name: Build docs (warnings as errors)
if: matrix.lint
env:
MIX_ENV: release
run: mix docs --warnings-as-errors
- name: Restore PLT cache
if: matrix.lint
uses: actions/cache@v5
with:
path: _build/dev/dialyxir_*
key: plt-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('mix.lock') }}
restore-keys: |
plt-${{ matrix.elixir }}-${{ matrix.otp }}-
- name: Run dialyzer
if: matrix.lint
env:
MIX_ENV: dev
run: mix dialyzer
# The SQLite ICU extension needs a C toolchain and libicu, so it is
# built in its own job rather than gating the pure-Elixir matrix.
sqlite-icu:
name: "SQLite ICU extension"
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17
env:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
LOCALIZE_SQL_SQLITE_ICU: "true"
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install ICU
run: sudo apt-get update && sudo apt-get install -y libicu-dev pkg-config
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: "1.20.2-otp-29"
otp-version: "29"
- name: Restore dependency cache
uses: actions/cache@v5
with:
path: |
deps
_build
key: sqlite-icu-mix-1.20.2-otp-29-${{ hashFiles('mix.lock') }}
restore-keys: |
sqlite-icu-mix-1.20.2-otp-29-
- name: Install dependencies
run: mix deps.get
- name: Compile (warnings as errors)
run: mix compile --warnings-as-errors
- name: Verify the extension was built
run: test -f priv/localize_icu.so
# test_helper raises when LOCALIZE_SQL_SQLITE_ICU is set but the
# extension cannot be found, so this cannot pass with the SQLite
# suites silently excluded.
- name: Run tests including the SQLite suites
run: mix test
# The Makefile has a separate Darwin branch (dylib, -dynamiclib,
# keg-only Homebrew ICU) that the Linux job never exercises, and most
# users building the extension are on macOS. Build only — service
# containers are Linux-only, so there is no PostgreSQL here to run the
# parity suite against.
sqlite-icu-macos:
name: "SQLite ICU extension (macOS build)"
runs-on: macos-latest
env:
LOCALIZE_SQL_SQLITE_ICU: "true"
steps:
- name: Checkout
uses: actions/checkout@v5
# pkg-config is already on the macOS runner image; installing it
# here risks colliding with Homebrew's pkgconf rename.
- name: Install ICU
run: brew install icu4c
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: "1.20.2-otp-29"
otp-version: "29"
- name: Install dependencies
run: mix deps.get
- name: Build the extension
run: mix compile
- name: Verify the extension was built and exports its entry point
run: |
test -f priv/localize_icu.dylib
nm -gU priv/localize_icu.dylib | grep -q _sqlite3_localizeicu_init