Apply latest Github Actions best practices for Elixir projects
This commit is contained in:
parent
ca2b70e9ba
commit
80282b2a45
1 changed files with 41 additions and 47 deletions
88
.github/workflows/ci.yml
vendored
88
.github/workflows/ci.yml
vendored
|
@ -1,73 +1,67 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
format:
|
||||
name: Check Formatting
|
||||
runs-on: ubuntu-16.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Elixir
|
||||
uses: erlef/setup-elixir@v1
|
||||
with:
|
||||
otp-version: 22.2
|
||||
elixir-version: 1.10.4
|
||||
|
||||
- name: Install dependencies
|
||||
run: mix deps.get
|
||||
|
||||
- name: Run "mix format"
|
||||
run: mix format --check-formatted
|
||||
|
||||
test:
|
||||
name: Build and test
|
||||
runs-on: ubuntu-16.04
|
||||
env:
|
||||
MIX_ENV: test
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
pair:
|
||||
- erlang: 23.1
|
||||
elixir: 1.11.1
|
||||
- erlang: 22.2
|
||||
elixir: 1.11.1
|
||||
- erlang: 21.3
|
||||
elixir: 1.11.1
|
||||
- erlang: 22.2
|
||||
elixir: 1.10.4
|
||||
- erlang: 20.3.1
|
||||
elixir: 1.9.4
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
include:
|
||||
- pair:
|
||||
elixir: 1.9.4
|
||||
otp: 20.3.1
|
||||
- pair:
|
||||
elixir: 1.11.1
|
||||
otp: 21.3
|
||||
- pair:
|
||||
elixir: 1.10.4
|
||||
otp: 22.2
|
||||
- pair:
|
||||
elixir: 1.11.3
|
||||
otp: 22.2
|
||||
- pair:
|
||||
elixir: 1.11.3
|
||||
otp: 23.2.5
|
||||
lint: lint
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Set up Elixir
|
||||
uses: erlef/setup-elixir@v1
|
||||
- uses: erlef/setup-elixir@v1
|
||||
with:
|
||||
otp-version: ${{matrix.pair.erlang}}
|
||||
otp-version: ${{matrix.pair.otp}}
|
||||
elixir-version: ${{matrix.pair.elixir}}
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
mix local.hex --force
|
||||
mix local.rebar --force
|
||||
mix deps.get
|
||||
- name: Install Dependencies
|
||||
run: mix deps.get --only test
|
||||
|
||||
- name: Run tests
|
||||
run: MIX_ENV=test mix coveralls.github
|
||||
- run: mix format --check-formatted
|
||||
if: ${{ matrix.lint }}
|
||||
|
||||
- run: mix deps.get && mix deps.unlock --check-unused
|
||||
if: ${{ matrix.lint }}
|
||||
|
||||
- run: mix deps.compile
|
||||
|
||||
- run: mix compile --warnings-as-errors
|
||||
if: ${{ matrix.lint }}
|
||||
|
||||
- run: mix test coveralls.github
|
||||
|
||||
- name: Retrieve PLT Cache
|
||||
uses: actions/cache@v1
|
||||
id: plt-cache
|
||||
with:
|
||||
path: priv/plts
|
||||
key: ${{ runner.os }}-${{ matrix.pair.erlang }}-${{ matrix.pair.elixir }}-plts-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
|
||||
key: ${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-plts-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
|
||||
|
||||
- name: Create PLTs
|
||||
if: steps.plt-cache.outputs.cache-hit != 'true'
|
||||
|
@ -76,4 +70,4 @@ jobs:
|
|||
mix dialyzer --plt
|
||||
|
||||
- name: Run dialyzer
|
||||
run: mix dialyzer --no-check
|
||||
run: mix dialyzer --no-check --halt-exit-status
|
||||
|
|
Loading…
Reference in a new issue