Skip to content

Read tax, finance and uncertainty vocabulary in the reader own language #31

Read tax, finance and uncertainty vocabulary in the reader own language

Read tax, finance and uncertainty vocabulary in the reader own language #31

Workflow file for this run

name: Elixir CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
MIX_ENV: test
LOCALIZE_DEFAULT_LOCALE: en
permissions:
contents: read
jobs:
# Download the JPL DE440s ephemeris (~32 MB) once and cache it, instead of
# having every matrix entry race to fetch it. Calendrical depends on astro,
# which needs this file at compile time (to compute Persian era boundaries)
# and at runtime. NAIF's server is slow and periodically unreachable, so
# isolating the network access to this single job means an outage fails only
# this cheap job (just re-run it) rather than poisoning the whole matrix. The
# key is constant because the file never changes; bump it if the ephemeris is
# ever replaced.
ephemeris:
name: Prime JPL ephemeris cache
runs-on: ubuntu-latest
steps:
- name: Cache JPL ephemeris
id: cache-ephemeris
uses: actions/cache@v5
with:
path: ~/.cache/astro
key: astro-ephemeris-de440s
- name: Download ephemeris
if: steps.cache-ephemeris.outputs.cache-hit != 'true'
run: |
mkdir -p ~/.cache/astro
url="https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/de440s.bsp"
# NAIF advertises TLS 1.3 but its handshake is broken, so cap at 1.2 —
# the version it can actually negotiate. --connect-timeout keeps a dead
# window from burning the full TCP timeout on every attempt.
for i in 1 2 3 4 5; do
if curl --fail --location --tls-max 1.2 --connect-timeout 30 \
--output ~/.cache/astro/de440s.bsp "$url"; then
exit 0
fi
echo "Ephemeris download attempt $i failed; retrying in 20s..."
sleep 20
done
echo "Ephemeris download failed after 5 attempts" >&2
exit 1
test:
needs: ephemeris
name: "Elixir ${{ matrix.elixir }} / OTP ${{ matrix.otp }}${{ matrix.lint && ' (lint)' || '' }}"
runs-on: ubuntu-latest
services:
db:
image: postgres:17
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports: ["5432:5432"]
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
fail-fast: false
matrix:
# Tempo requires OTP 27 or later, so there are no OTP 25/26 rows here
# even though Elixir 1.17 and 1.18 themselves support them.
include:
# Elixir 1.17 — supports OTP 25–27
- elixir: "1.17-otp-27"
otp: "27"
# Elixir 1.18 — supports OTP 25–27
- elixir: "1.18-otp-27"
otp: "27"
# Elixir 1.19 — supports OTP 26–28
- 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
# Restore the ephemeris primed by the `ephemeris` job above. astro's
# runtime resolver reads it from `:filename.basedir(:user_cache, "astro")`
# (i.e. ~/.cache/astro on Linux), so compile and tests find it with no
# extra configuration. `needs: ephemeris` guarantees the cache exists, so a
# miss is a real fault — fail loudly rather than silently re-downloading.
- name: Restore JPL ephemeris
uses: actions/cache/restore@v5
with:
path: ~/.cache/astro
key: astro-ephemeris-de440s
fail-on-cache-miss: true
# Word-break dictionaries for the scripts written without spaces
# (Japanese, Chinese, Thai, Khmer, Lao, Burmese). Downloaded rather than
# vendored — they are large, and only the Japanese tests need them.
- name: Cache word-break dictionaries
uses: actions/cache@v5
with:
path: _build/test/lib/unicode_string/priv/dictionaries
key: unicode-dictionaries-${{ matrix.elixir }}-${{ matrix.otp }}
- 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
# The `test` alias primes the Localize locale cache before running, so
# every locale in `:supported_locales` is present for the suite.
- name: Run tests
run: mix test
- 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