Setup CI #1
Workflow file for this run
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 | |
on: | |
pull_request: [] | |
push: | |
branches: | |
- main | |
jobs: | |
compile: | |
name: Install deps and compile | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
versions: | |
- otp: 21.3 | |
elixir: 1.11 | |
- otp: 26.2 | |
elixir: 1.16 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
elixir-version: ${{ matrix.versions.elixir }} | |
otp-version: ${{ matrix.versions.otp }} | |
- uses: actions/cache@v3 | |
with: | |
path: "_build\ndeps" | |
key: mix-${{ runner.os }}-${{ matrix.versions.otp }}-${{ matrix.versions.elixir }}-${{ github.sha }} | |
restore-keys: mix-${{ runner.os }}- | |
- name: Install Elixir dependencies | |
env: | |
MIX_ENV: test | |
run: mix deps.get | |
- name: Compile | |
env: | |
MIX_ENV: test | |
run: mix compile | |
credo: | |
needs: compile | |
name: Credo | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
versions: | |
- otp: 21.3 | |
elixir: 1.11 | |
- otp: 26.2 | |
elixir: 1.16 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
elixir-version: ${{ matrix.versions.elixir }} | |
otp-version: ${{ matrix.versions.otp }} | |
- uses: actions/cache@v3 | |
with: | |
path: "_build\ndeps" | |
key: mix-${{ runner.os }}-${{ matrix.versions.otp }}-${{ matrix.versions.elixir }}-${{ github.sha }} | |
restore-keys: mix-${{ runner.os }}- | |
- name: Check code style | |
env: | |
MIX_ENV: test | |
run: mix credo --strict | |
deps_audit: | |
needs: compile | |
name: Deps audit | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
versions: | |
- otp: 21.3 | |
elixir: 1.11 | |
- otp: 26.2 | |
elixir: 1.16 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
elixir-version: ${{ matrix.versions.elixir }} | |
otp-version: ${{ matrix.versions.otp }} | |
- uses: actions/cache@v3 | |
with: | |
path: "_build\ndeps" | |
key: mix-${{ runner.os }}-${{ matrix.versions.otp }}-${{ matrix.versions.elixir }}-${{ github.sha }} | |
restore-keys: mix-${{ runner.os }}- | |
- name: Check for vulnerable Mix dependencies | |
env: | |
MIX_ENV: test | |
run: mix deps.audit | |
dialyzer: | |
needs: compile | |
name: Dialyzer | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
versions: | |
- otp: 21.3 | |
elixir: 1.11 | |
- otp: 26.2 | |
elixir: 1.16 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
elixir-version: ${{ matrix.versions.elixir }} | |
otp-version: ${{ matrix.versions.otp }} | |
- uses: actions/cache@v3 | |
with: | |
path: "_build\ndeps" | |
key: mix-${{ runner.os }}-${{ matrix.versions.otp }}-${{ matrix.versions.elixir }}-${{ github.sha }} | |
restore-keys: mix-${{ runner.os }}- | |
- name: Restore PLT cache | |
uses: actions/cache@v3 | |
with: | |
path: priv/plts | |
key: plt-${{ runner.os }}-${{ matrix.versions.otp }}-${{ matrix.versions.elixir }}-${{ github.sha }} | |
restore-keys: plt-${{ runner.os }}- | |
- name: Create PLTs | |
env: | |
MIX_ENV: test | |
run: mix dialyzer --plt | |
- name: Run dialyzer | |
env: | |
MIX_ENV: test | |
run: mix dialyzer --format short 2>&1 | |
format: | |
needs: compile | |
name: Format | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
versions: | |
- otp: 21.3 | |
elixir: 1.11 | |
- otp: 26.2 | |
elixir: 1.16 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
elixir-version: ${{ matrix.versions.elixir }} | |
otp-version: ${{ matrix.versions.otp }} | |
- uses: actions/cache@v3 | |
with: | |
path: "_build\ndeps" | |
key: mix-${{ runner.os }}-${{ matrix.versions.otp }}-${{ matrix.versions.elixir }}-${{ github.sha }} | |
restore-keys: mix-${{ runner.os }}- | |
- name: Check Elixir formatting | |
env: | |
MIX_ENV: test | |
run: mix format --check-formatted | |
hex_audit: | |
needs: compile | |
name: Hex audit | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
versions: | |
- otp: 21.3 | |
elixir: 1.11 | |
- otp: 26.2 | |
elixir: 1.16 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
elixir-version: ${{ matrix.versions.elixir }} | |
otp-version: ${{ matrix.versions.otp }} | |
- uses: actions/cache@v3 | |
with: | |
path: "_build\ndeps" | |
key: mix-${{ runner.os }}-${{ matrix.versions.otp }}-${{ matrix.versions.elixir }}-${{ github.sha }} | |
restore-keys: mix-${{ runner.os }}- | |
- name: Check for retired Hex packages | |
env: | |
MIX_ENV: test | |
run: mix hex.audit | |
prettier: | |
name: Check formatting using Prettier | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Restore npm cache | |
uses: actions/cache@v3 | |
id: npm-cache | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-npm | |
- name: Install Prettier | |
if: steps.npm-cache.outputs.cache-hit != 'true' | |
run: npm i -g prettier | |
- name: Run Prettier | |
run: npx prettier -c . | |
test: | |
needs: compile | |
name: Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
versions: | |
- otp: 21.3 | |
elixir: 1.11 | |
- otp: 26.2 | |
elixir: 1.16 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
elixir-version: ${{ matrix.versions.elixir }} | |
otp-version: ${{ matrix.versions.otp }} | |
- uses: actions/cache@v3 | |
with: | |
path: "_build\ndeps" | |
key: mix-${{ runner.os }}-${{ matrix.versions.otp }}-${{ matrix.versions.elixir }}-${{ github.sha }} | |
restore-keys: mix-${{ runner.os }}- | |
- name: Run tests | |
env: | |
MIX_ENV: test | |
MUX_CREDENTIALS_EMAIL: ${{ secrets.MUX_CREDENTIALS_EMAIL }} | |
MUX_CREDENTIALS_PASSWORD: ${{ secrets.MUX_CREDENTIALS_PASSWORD }} | |
run: mix test --cover --warnings-as-errors | |
unused_deps: | |
needs: compile | |
name: Check unused deps | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
versions: | |
- otp: 21.3 | |
elixir: 1.11 | |
- otp: 26.2 | |
elixir: 1.16 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
elixir-version: ${{ matrix.versions.elixir }} | |
otp-version: ${{ matrix.versions.otp }} | |
- uses: actions/cache@v3 | |
with: | |
path: "_build\ndeps" | |
key: mix-${{ runner.os }}-${{ matrix.versions.otp }}-${{ matrix.versions.elixir }}-${{ github.sha }} | |
restore-keys: mix-${{ runner.os }}- | |
- name: Check for unused Mix dependencies | |
env: | |
MIX_ENV: test | |
run: mix deps.unlock --check-unused |