Skip to content

Commit

Permalink
Add github workflow configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
r8 committed Jan 10, 2021
1 parent 2200608 commit 5a7012b
Showing 1 changed file with 138 additions and 0 deletions.
138 changes: 138 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,138 @@
name: CI

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

env:
MIX_ENV: test

jobs:
deps:
name: Dependencies
runs-on: ubuntu-latest
strategy:
matrix:
elixir: [1.11]
otp: [23.2]
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}

- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup
uses: actions/setup-elixir@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}

- name: Retrieve Cached Dependencies
uses: actions/cache@v2
id: mix-cache
with:
path: |
deps
_build
priv/plts
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}

- name: Install Dependencies
if: steps.mix-cache.outputs.cache-hit != 'true'
run: |
mkdir -p priv/plts
mix local.rebar --force
mix local.hex --force
mix deps.get
mix deps.compile
mix dialyzer --plt
static_code_analysis:
name: Static Code Analysis
needs: deps
runs-on: ubuntu-latest
strategy:
matrix:
elixir: [1.11]
otp: [23.2]
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}

- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup
uses: actions/setup-elixir@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}

- name: Retrieve Cached Dependencies
uses: actions/cache@v2
id: mix-cache
with:
path: |
deps
_build
priv/plts
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}

- name: Check Code Format
run: mix format --check-formatted

- name: Run Credo
run: mix credo

- name: Run Dialyzer
run: mix dialyzer --no-check --halt-exit-status

unit_tests:
name: Unit Tests
needs: deps
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
elixir: [1.11]
otp: [23.2]
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}

- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup
uses: actions/setup-elixir@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}

- name: Retrieve Cached Dependencies
uses: actions/cache@v2
id: mix-cache
with:
path: |
deps
_build
priv/plts
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles('mix.lock') }}

- name: Run test
run: mix test --trace --slowest 10

0 comments on commit 5a7012b

Please sign in to comment.