|
name: CI |
|
on: |
|
push: |
|
branches: |
|
- main |
|
paths-ignore: |
|
- 'guides/**' |
|
pull_request: |
|
paths-ignore: |
|
- 'guides/**' |
|
env: |
|
MIX_ENV: test |
|
|
|
jobs: |
|
code_quality_and_tests: |
|
runs-on: ubuntu-latest |
|
strategy: |
|
fail-fast: false |
|
matrix: |
|
include: |
|
- elixir: "1.15.x" |
|
erlang: "24.x" |
|
- elixir: "1.16.x" |
|
erlang: "24.x" |
|
- elixir: "1.17.x" |
|
erlang: "27.x" |
|
- elixir: "1.18.x" |
|
erlang: "27.x" |
|
- elixir: "1.19.x" |
|
erlang: "28.x" |
|
- elixir: "latest" |
|
erlang: "28.x" |
|
services: |
|
db: |
|
image: postgres:15 |
|
ports: ["5432:5432"] |
|
env: |
|
POSTGRES_PASSWORD: postgres |
|
options: >- |
|
--health-cmd pg_isready |
|
--health-interval 10s |
|
--health-timeout 5s |
|
--health-retries 5 |
|
mariadb: |
|
image: mariadb:11 |
|
ports: ["3306:3306"] |
|
env: |
|
MARIADB_ROOT_PASSWORD: root |
|
options: >- |
|
--health-cmd "healthcheck.sh --connect --innodb_initialized" |
|
--health-interval 10s |
|
--health-timeout 5s |
|
--health-retries 5 |
|
name: Elixir v${{ matrix.elixir }}, Erlang v${{ matrix.erlang }} |
|
steps: |
|
- uses: actions/checkout@v4 |
|
|
|
- name: Generate test configuration |
|
run: cp config/test.example.exs config/test.exs |
|
|
|
- uses: erlef/setup-beam@v1 |
|
with: |
|
otp-version: ${{ matrix.erlang }} |
|
elixir-version: ${{ matrix.elixir }} |
|
|
|
- name: Retrieve Dependencies Cache |
|
uses: actions/cache@v4 |
|
id: mix-cache |
|
with: |
|
path: | |
|
deps |
|
_build |
|
key: ${{ runner.os }}-${{ matrix.erlang }}-${{ matrix.elixir }}-mix-${{ hashFiles('**/mix.lock') }} |
|
|
|
- name: Install Mix Dependencies |
|
run: mix deps.get |
|
|
|
- name: Check unused dependencies |
|
run: mix deps.unlock --check-unused |
|
|
|
- name: Compile dependencies |
|
run: mix deps.compile |
|
|
|
- name: Check format |
|
run: mix format --check-formatted |
|
|
|
- name: Check application compile warnings |
|
run: mix compile --force --warnings-as-errors |
|
|
|
- name: Run Tests - SQLite3 |
|
run: mix test --warnings-as-errors |
|
env: |
|
DB: sqlite |
|
|
|
- name: Run Tests - PostgreSQL |
|
run: mix test --warnings-as-errors |
|
env: |
|
DB: postgres |
|
|
|
- name: Run Tests - MySQL/MariaDB |
|
run: mix test --warnings-as-errors |
|
env: |
|
DB: mysql |