Skip to content

Commit

Permalink
Improve CI
Browse files Browse the repository at this point in the history
  • Loading branch information
LVala committed Mar 22, 2024
1 parent 43188c6 commit e77ec01
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 31 deletions.
107 changes: 76 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,41 +2,86 @@ name: CI

on: push

jobs:
lint:
runs-on: ubuntu-latest
name: Lint (OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}})
strategy:
matrix:
otp: ['26']
elixir: ['1.15']
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}
- run: mix deps.get
- run: mix credo
- run: mix dialyzer
- run: mix format --check-formatted
- run: mix docs 2>&1 | (! grep -q "warning:")
env:
MIX_ENV: test

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
name: Test (OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}})
name: CI on OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
strategy:
matrix:
otp: ['26']
elixir: ['1.15']
env:
MIX_ENV: test
elixir: ['1.16']
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}
- run: mix deps.get
- run: mix coveralls.json
- uses: codecov/codecov-action@v3
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}

- name: Checkout the code
uses: actions/checkout@v4

- name: Cache dependencies
uses: actions/cache@v4
with:
path: deps
key: ${{ runner.os }}-mix-deps-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-deps-
- name: Cache compiled build
uses: actions/cache@v4
with:
path: _build
key: ${{ runner.os }}-mix-build-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-build-
${{ runner.os }}-mix-
- name: Cache dialyzer artifacts
uses: actions/cache@v4
with:
path: _dialyzer
key: ${{ runner.os }}-dialyzer-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-dialyzer-
- name: Install dependencies
run: mix deps.get

- name: Compile without warnings
id: compile
run: mix compile --warnings-as-errors

- name: Check formatting
if: ${{ !cancelled() && steps.compile.outcome == 'success' }}
run: mix format --check-formatted

- name: Check with credo
if: ${{ !cancelled() && steps.compile.outcome == 'success' }}
run: mix credo

- name: Check with dialyzer
if: ${{ !cancelled() && steps.compile.outcome == 'success' }}
run: mix dialyzer

- name: Check docs
if: ${{ !cancelled() && steps.compile.outcome == 'success' }}
run: mix docs 2>&1 | (! grep -q "warning:")

- name: Run tests and check test coverage
if: ${{ !cancelled() && steps.compile.outcome == 'success' }}
id: test
run: mix coveralls.json

- name: Upload test coverage results to Codecov
if: ${{ !cancelled() && steps.test.outcome == 'success' }}
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true,
token: ${{ secrets.CODECOV_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ ex_rtcp-*.tar

# Temporary files, for example, from tests.
/tmp/

# Localy stored dialyzer artifacts
/_dialyzer/
6 changes: 6 additions & 0 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ defmodule ExRTCP.MixProject do
docs: docs(),
source_url: @source_url,

# dialyzer
dialyzer: [
plt_local_path: "_dialyzer",
plt_core_path: "_dialyzer"
],

# code coverage
test_coverage: [tool: ExCoveralls],
preferred_cli_env: [
Expand Down

0 comments on commit e77ec01

Please sign in to comment.