Skip to content

prep for v0.9.0

prep for v0.9.0 #1187

Workflow file for this run

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
#
# https://github.com/erlef/setup-beam/tree/v1.18.2
name: Elixir CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
env:
OPENAI_API_KEY: invalid
ANTHROPIC_API_KEY: invalid
GOOGLE_API_KEY: invalid
AWS_ACCESS_KEY_ID: invalid
AWS_SECRET_ACCESS_KEY: invalid
AWS_REGION: invalid
PERPLEXITY_API_KEY: invalid
MISTRAL_API_KEY: invalid
VERTEX_API_KEY: invalid
VERTEX_API_ENDPOINT: invalid
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- pair:
elixir: "1.17"
otp: "27"
- pair:
elixir: "1.19"
otp: "27"
lint: lint
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- id: beam
uses: erlef/setup-beam@fc68ffb90438ef2936bbb3251622353b3dcb2f93 # v1.24.0
with:
elixir-version: ${{ matrix.pair.elixir }}
otp-version: ${{ matrix.pair.otp }}
- name: Cache deps
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-
- name: Cache _build
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: _build
key: ${{ runner.os }}-build-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-
- run: mix deps.get
- run: mix format --check-formatted
if: ${{ matrix.lint }}
- run: mix deps.unlock --check-unused
if: ${{ matrix.lint }}
- run: mix deps.compile
- run: mix compile --warnings-as-errors
if: ${{ matrix.lint }}
# Cache key based on Erlang/Elixir version and the mix.lock hash
- name: Restore PLT cache
if: ${{ matrix.lint }}
id: plt_cache
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
key: |
plt-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
plt-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-
path: |
priv/plts
# Create PLTs if no cache was found
- name: Create PLTs
if: ${{ matrix.lint && steps.plt_cache.outputs.cache-hit != 'true' }}
run: |
mkdir -p priv/plts
mix dialyzer --plt
# By default, the GitHub Cache action only saves the cache if all steps in the job succeed,
# so we separate the cache restore and save steps in case running dialyzer fails.
- name: Save PLT cache
if: ${{ matrix.lint && steps.plt_cache.outputs.cache-hit != 'true' }}
id: plt_cache_save
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
key: |
plt-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
path: |
priv/plts
# --format github prints warnings as inline PR annotations.
# --format dialyxir keeps the raw warnings readable in the action log.
- name: Run dialyzer
if: ${{ matrix.lint }}
run: mix dialyzer --format github --format dialyxir
- name: Run tests
run: mix test