[Actions] Update DB matrix #333
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
# Notes: | |
# * secrets.CACHE_VERSION: Is a defined secret with a UUIDv4 as version, | |
# the reason for this is because there is currently no other way of resetting the cache. | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
MYSQL_USER: mysql | |
MYSQL_PASSWORD: mysql | |
MYSQL_DATABASE: ecto_mysql_extras_test | |
MYSQL_HOST: localhost | |
MYSQL_ROOT_PASSWORD: mysql_root_password | |
jobs: | |
setup: | |
name: Setup / OTP ${{ matrix.pair.otp }} / Elixir ${{ matrix.pair.elixir }} | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- pair: | |
elixir: "1.13" | |
otp: 24 | |
- pair: | |
elixir: "1.14" | |
otp: 25 | |
- pair: | |
elixir: "1.15" | |
otp: 26 | |
- pair: | |
elixir: "1.16" | |
otp: 26 | |
- pair: | |
elixir: "1.17" | |
otp: 27 | |
steps: | |
- name: Checkout commit | |
uses: actions/checkout@v4 | |
- uses: erlef/setup-beam@v1 | |
with: | |
otp-version: ${{matrix.pair.otp}} | |
elixir-version: ${{matrix.pair.elixir}} | |
- name: Retrieve dependencies cache | |
uses: actions/cache@v4 | |
id: mix-cache | |
with: | |
path: | | |
deps | |
_build | |
key: ${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-${{ secrets.CACHE_VERSION }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
- name: Install dependencies | |
if: steps.mix-cache.outputs.cache-hit != 'true' | |
run: | | |
mix deps.get | |
mix deps.unlock --check-unused | |
mix deps.compile | |
- name: Create PLTs | |
if: steps.mix-cache.outputs.cache-hit != 'true' | |
run: mix dialyzer --plt | |
lint: | |
name: Lint / OTP ${{ matrix.otp }} / Elixir ${{ matrix.elixir }} | |
needs: setup | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
otp: ["27"] | |
elixir: ["1.17"] | |
steps: | |
- name: Checkout commit | |
uses: actions/checkout@v4 | |
- name: Setup Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: ${{ matrix.otp }} | |
elixir-version: ${{ matrix.elixir }} | |
- name: Retrieve dependencies cache | |
uses: actions/cache@v4 | |
id: mix-cache | |
with: | |
path: | | |
deps | |
_build | |
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ secrets.CACHE_VERSION }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
- name: Check format | |
run: mix format --check-formatted | |
credo: | |
name: Credo / OTP ${{ matrix.otp }} / Elixir ${{ matrix.elixir }} | |
needs: setup | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
otp: ["27"] | |
elixir: ["1.17"] | |
steps: | |
- name: Checkout commit | |
uses: actions/checkout@v4 | |
- name: Setup Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: ${{ matrix.otp }} | |
elixir-version: ${{ matrix.elixir }} | |
- name: Retrieve dependencies cache | |
uses: actions/cache@v4 | |
id: mix-cache | |
with: | |
path: | | |
deps | |
_build | |
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ secrets.CACHE_VERSION }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
- name: Credo | |
run: mix credo | |
dialyzer: | |
name: Dialyzer / OS ${{ matrix.os }} / OTP ${{ matrix.otp }} / Elixir ${{ matrix.elixir }} | |
needs: setup | |
runs-on: ubuntu-20.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
otp: ["27"] | |
elixir: ["1.17"] | |
steps: | |
- name: Checkout commit | |
uses: actions/checkout@v4 | |
- name: Setup Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: ${{ matrix.otp }} | |
elixir-version: ${{ matrix.elixir }} | |
- name: Retrieve dependencies cache | |
uses: actions/cache@v4 | |
id: mix-cache | |
with: | |
path: | | |
deps | |
_build | |
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ secrets.CACHE_VERSION }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
- name: Dialyzer | |
run: mix dialyzer --no-check --format github | |
test: | |
name: Test ${{ matrix.db }} / OTP ${{ matrix.version.otp }} / Elixir ${{ matrix.version.elixir }} | |
runs-on: ubuntu-20.04 | |
needs: dialyzer | |
strategy: | |
fail-fast: false | |
matrix: | |
db: | |
[ | |
"mysql:8.0", | |
"mysql:8.4", | |
"mariadb:10.5", | |
"mariadb:10.6", | |
"mariadb:10.11", | |
"mariadb:11.4" | |
] | |
version: | |
[ | |
{ otp: "24", elixir: "1.13" }, | |
{ otp: "25", elixir: "1.14" }, | |
{ otp: "26", elixir: "1.15" }, | |
{ otp: "26", elixir: "1.16" }, | |
{ otp: "27", elixir: "1.17" } | |
] | |
env: | |
MIX_ENV: test | |
services: | |
database: | |
image: ${{ matrix.db }} | |
env: | |
MYSQL_USER: ${{ env.MYSQL_USER }} | |
MYSQL_PASSWORD: ${{ env.MYSQL_PASSWORD }} | |
MYSQL_DATABASE: ${{ env.MYSQL_DATABASE }} | |
MYSQL_ROOT_PASSWORD: ${{ env.MYSQL_ROOT_PASSWORD }} | |
MYSQL_ROOT_HOST: "%" | |
options: >- | |
--health-cmd="mysqladmin ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 3306:3306 | |
steps: | |
- name: Checkout commit | |
uses: actions/checkout@v4 | |
- name: Initialize database | |
run: | | |
mysql -uroot -p${{ env.MYSQL_ROOT_PASSWORD }} -h127.0.0.1 < docker/init/init.sql | |
- name: Setup Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: ${{ matrix.version.otp }} | |
elixir-version: ${{ matrix.version.elixir }} | |
- name: Retrieve dependencies cache | |
uses: actions/cache@v4 | |
id: mix-cache | |
with: | |
path: | | |
deps | |
_build | |
key: ${{ runner.os }}-${{ matrix.version.otp }}-${{ matrix.version.elixir }}-${{ secrets.CACHE_VERSION }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
- name: Run tests | |
run: mix test | |
test_mariadb_11: | |
name: Test ${{ matrix.db }} / OTP ${{ matrix.version.otp }} / Elixir ${{ matrix.version.elixir }} | |
runs-on: ubuntu-20.04 | |
needs: dialyzer | |
strategy: | |
fail-fast: false | |
matrix: | |
db: | |
[ | |
"mariadb:11.0", | |
"mariadb:11.1", | |
] | |
version: | |
[ | |
{ otp: "24", elixir: "1.13" }, | |
{ otp: "25", elixir: "1.14" }, | |
{ otp: "26", elixir: "1.15" }, | |
{ otp: "26", elixir: "1.16" }, | |
{ otp: "27", elixir: "1.17" }, | |
] | |
env: | |
MIX_ENV: test | |
services: | |
database: | |
image: ${{ matrix.db }} | |
env: | |
MYSQL_USER: ${{ env.MYSQL_USER }} | |
MYSQL_PASSWORD: ${{ env.MYSQL_PASSWORD }} | |
MYSQL_DATABASE: ${{ env.MYSQL_DATABASE }} | |
MYSQL_ROOT_PASSWORD: ${{ env.MYSQL_ROOT_PASSWORD }} | |
MYSQL_ROOT_HOST: "%" | |
options: >- | |
--health-cmd="healthcheck.sh --connect --innodb_initialized" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 3306:3306 | |
steps: | |
- name: Checkout commit | |
uses: actions/checkout@v4 | |
- name: Initialize database | |
run: | | |
mysql -uroot -p${{ env.MYSQL_ROOT_PASSWORD }} -h127.0.0.1 < docker/init/init.sql | |
- name: Setup Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: ${{ matrix.version.otp }} | |
elixir-version: ${{ matrix.version.elixir }} | |
- name: Retrieve dependencies cache | |
uses: actions/cache@v4 | |
id: mix-cache | |
with: | |
path: | | |
deps | |
_build | |
key: ${{ runner.os }}-${{ matrix.version.otp }}-${{ matrix.version.elixir }}-${{ secrets.CACHE_VERSION }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
- name: Run tests | |
run: mix test | |
test_coverage: | |
name: Test Coverage / OTP ${{ matrix.otp }} / Elixir ${{ matrix.elixir }} | |
runs-on: ubuntu-20.04 | |
if: ${{ github.actor != 'dependabot[bot]' }} | |
needs: [test, test_mariadb_11] | |
strategy: | |
fail-fast: false | |
matrix: | |
otp: ["27"] | |
elixir: ["1.17"] | |
env: | |
MIX_ENV: test | |
services: | |
mysql: | |
image: mysql:8.1 | |
env: | |
MYSQL_USER: ${{ env.MYSQL_USER }} | |
MYSQL_PASSWORD: ${{ env.MYSQL_PASSWORD }} | |
MYSQL_DATABASE: ${{ env.MYSQL_DATABASE }} | |
MYSQL_ROOT_PASSWORD: ${{ env.MYSQL_ROOT_PASSWORD }} | |
MYSQL_ROOT_HOST: "%" | |
options: >- | |
--health-cmd="mysqladmin ping" | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 3306:3306 | |
steps: | |
- name: Checkout commit | |
uses: actions/checkout@v4 | |
- name: Initialize database | |
run: | | |
mysql -uroot -p${{ env.MYSQL_ROOT_PASSWORD }} -h127.0.0.1 < docker/init/init.sql | |
- name: Setup Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
otp-version: ${{ matrix.otp }} | |
elixir-version: ${{ matrix.elixir }} | |
- name: Retrieve dependencies cache | |
uses: actions/cache@v4 | |
id: mix-cache | |
with: | |
path: | | |
deps | |
_build | |
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ secrets.CACHE_VERSION }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
- name: Run coverage | |
run: mix coveralls.json | |
- uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} |