Modernize GitHub Actions configuration (#540)

- Switch to erlef/setup-elixir
- Switch to actions/checkout@v2
- Only test the older and newest support Elixir/OTP pair
This commit is contained in:
Jon Parise 2021-03-19 16:08:38 -07:00 committed by GitHub
parent c86c802489
commit 4088867687
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -10,63 +10,74 @@ on:
- master
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
env:
MIX_ENV: test
steps:
- uses: actions/checkout@v1
- uses: actions/setup-elixir@v1
with:
otp-version: 22.2
elixir-version: '1.11'
- name: Install dependencies
run: mix deps.get
- name: Check dependencies
run: mix deps.unlock --check-unused
- name: Check format
run: mix format --check-formatted
test:
name: OTP ${{ matrix.otp }} / Elixir ${{ matrix.elixir }}
format:
name: Format (Elixir ${{ matrix.pair.elixir }} / OTP ${{ matrix.pair.otp }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
otp: [22.2]
elixir: [1.7, 1.8, 1.9, '1.10', '1.11']
include:
- pair:
elixir: 1.11
otp: 23
env:
MIX_ENV: test
steps:
- uses: actions/checkout@v1
- uses: actions/setup-elixir@v1
- uses: actions/checkout@v2
- uses: erlef/setup-elixir@v1
with:
otp-version: ${{ matrix.otp }}
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.pair.otp }}
elixir-version: ${{ matrix.pair.elixir }}
- name: Install dependencies
run: mix deps.get
- name: Check format
run: mix format --check-formatted
test:
name: Test (Elixir ${{ matrix.pair.elixir }} / OTP ${{ matrix.pair.otp }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- pair:
elixir: 1.7
otp: 22
- pair:
elixir: 1.11
otp: 23
coverage: true
env:
MIX_ENV: test
steps:
- uses: actions/checkout@v2
- uses: erlef/setup-elixir@v1
with:
otp-version: ${{ matrix.pair.otp }}
elixir-version: ${{ matrix.pair.elixir }}
- name: Set up dependency cache
uses: actions/cache@v1
with:
path: deps/
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-deps-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-deps-
key: ${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-deps-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-deps-
- name: Set up build cache
uses: actions/cache@v1
with:
path: _build/test/
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-build-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-build-
key: ${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-build-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.pair.otp }}-${{ matrix.pair.elixir }}-build-
- name: Install dependencies
run: |
mix deps.get
- name: Compile
run: |
mix deps.compile
mix compile --warnings-as-errors
mix compile --force --warnings-as-errors
- name: Run tests
if: matrix.elixir != '1.11'
if: ${{ !matrix.coverage }}
run: mix test
- name: Run tests (with coverage)
if: matrix.elixir == '1.11'
if: ${{ matrix.coverage }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: mix coveralls.github