Skip to content

Instantly share code, notes, and snippets.

@nivertech
Forked from dkarter/elixir.yml
Created August 15, 2021 12:36
Show Gist options
  • Save nivertech/2e4f82ea348bbc2ea2c2bc85cc8b1c40 to your computer and use it in GitHub Desktop.
Save nivertech/2e4f82ea348bbc2ea2c2bc85cc8b1c40 to your computer and use it in GitHub Desktop.

Revisions

  1. @dkarter dkarter created this gist May 11, 2020.
    68 changes: 68 additions & 0 deletions elixir.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,68 @@
    name: Elixir CI

    on:
    push:
    branches: [ master ]
    pull_request:
    branches: [ master ]

    env:
    MIX_ENV: test

    jobs:
    test:

    runs-on: ubuntu-latest

    strategy:
    matrix:
    elixir: [1.10.2]
    otp: [22.2.8]

    steps:
    - uses: actions/checkout@v2

    - name: Setup elixir
    uses: actions/setup-elixir@v1
    with:
    elixir-version: ${{ matrix.elixir }} # Define the elixir version [required]
    otp-version: ${{ matrix.otp }} # Define the OTP version [required]

    - name: Retrieve Mix Dependencies Cache
    uses: actions/cache@v1
    id: mix-cache #id to use in retrieve action
    with:
    path: deps
    key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-mix-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}

    - name: Install Mix Dependencies
    if: steps.mix-cache.outputs.cache-hit != 'true'
    run: |
    mix local.rebar --force
    mix local.hex --force
    mix deps.get
    - name: Check Formatting
    run: mix format --check-formatted

    - name: Run Credo
    run: mix credo --strict

    - name: Run Tests
    run: mix test

    - name: Retrieve PLT Cache
    uses: actions/cache@v1
    id: plt-cache
    with:
    path: priv/plts
    key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-plts-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}

    - name: Create PLTs
    if: steps.plt-cache.outputs.cache-hit != 'true'
    run: |
    mkdir -p priv/plts
    mix dialyzer --plt
    - name: Run dialyzer
    run: mix dialyzer --no-check --halt-exit-status