Make jason direct dependency since we use it #39
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: Tests | |
on: | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
branches: | |
- 'main' | |
jobs: | |
test: | |
name: Test | |
runs-on: ${{matrix.os}} | |
strategy: | |
matrix: | |
os: ['ubuntu-latest'] | |
elixir: ['1.14.x'] | |
otp: ['25.x'] | |
steps: | |
# Setup. | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
# Elixir. | |
- name: Set up Elixir | |
id: beam | |
uses: erlef/setup-beam@v1 | |
with: | |
elixir-version: ${{matrix.elixir}} | |
otp-version: ${{matrix.otp}} | |
# Build cache. | |
- name: Build cache | |
uses: actions/cache@v3 | |
with: | |
path: _build | |
key: build-${{matrix.os}}-${{matrix.otp}}-${{matrix.elixir}}-${{ hashFiles('lib/**/*.ex') }} | |
restore-keys: build-${{matrix.os}}-${{matrix.otp}}-${{matrix.elixir}}- | |
# Get and compile elixir deps. | |
- name: Elixir Deps cache | |
uses: actions/cache@v3 | |
with: | |
path: deps | |
key: mix-${{ matrix.os }}-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('**/mix.lock') }} | |
restore-keys: mix-${{ matrix.os }}-${{ matrix.elixir }}-${{ matrix.otp }}- | |
- run: mix deps.get | |
- run: mix deps.compile | |
# Compile :dev and :test. | |
- run: MIX_ENV=dev mix compile --warnings-as-errors | |
- run: MIX_ENV=test mix compile --warnings-as-errors | |
# Check for unused dependencies. | |
- run: mix deps.unlock --check-unused | |
# Check code quality and style. | |
- run: mix format --check-formatted | |
- run: mix credo | |
# Run the tests. | |
- run: mix test --warnings-as-errors | |
# Static analysis (Dialyzer). | |
- name: Restore PLT cache | |
uses: actions/cache@v3 | |
id: plt_cache | |
with: | |
path: priv/plts | |
key: plt-${{ matrix.os }}-${{ matrix.elixir }}-${{ matrix.otp }} | |
restore-keys: plt-${{ matrix.os }}-${{ matrix.elixir }}-${{ matrix.otp }} | |
# Create PLTs if no cache was found | |
- name: Create PLTs | |
if: steps.plt_cache.outputs.cache-hit != 'true' | |
run: mix dialyzer --plt | |
- name: Run dialyzer | |
run: mix dialyzer --format github |