Elixir CI #1168
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: Elixir CI | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
push: | |
branches: [ main ] | |
tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
env: | |
ELIXIR_VERSION: '1.16.x' | |
OTP_VERSION: '24.x' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
elixir-version: ['1.12.x', '1.13.x', '1.14.x', '1.15.x', '1.16.x'] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
elixir-version: ${{ matrix.elixir-version }} | |
otp-version: ${{ env.OTP_VERSION }} | |
- name: Restore cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
deps | |
priv/plts | |
key: ${{ runner.os }}-mix-${{ env.OTP_VERSION }}-${{ matrix.elixir-version }}-${{ hashFiles('**/mix.lock') }} | |
restore-keys: ${{ runner.os }}-mix-${{ env.OTP_VERSION }}-${{ matrix.elixir-version }} | |
- name: Install dependencies | |
run: | | |
mix local.rebar --force | |
mix local.hex --force | |
mix deps.get | |
- name: Compile | |
run: mix compile --warnings-as-errors | |
- name: Check formatting | |
if: matrix.elixir-version == env.ELIXIR_VERSION | |
run: mix format --check-formatted | |
- name: Run credo | |
run: mix credo | |
- name: Run dialyzer | |
run: mix dialyzer | |
- name: Execute tests | |
run: | | |
mix test --only integration --warnings-as-errors --max-cases 1 --cover --export-coverage integration-coverage | |
mix coveralls --exclude integration --warnings-as-errors --import-cover cover | |
- name: Upload coverage report | |
run: bash <(curl -s https://codecov.io/bash) | |
publish: | |
needs: test | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags') | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
elixir-version: ${{ env.ELIXIR_VERSION }} | |
otp-version: ${{ env.OTP_VERSION }} | |
- name: Restore cache | |
uses: actions/cache@v2 | |
with: | |
path: deps | |
key: ${{ runner.os }}-mix-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('**/mix.lock') }} | |
restore-keys: ${{ runner.os }}-mix-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }} | |
- name: Install dependencies | |
run: | | |
mix local.rebar --force | |
mix local.hex --force | |
mix deps.get | |
- name: 🚀Publish | |
run: mix hex.publish --yes | |
env: | |
HEX_API_KEY: ${{ secrets.HEX_API_KEY }} |