Skip to content

Skip PLT caching and creation if not running dialyzer #40

Skip PLT caching and creation if not running dialyzer

Skip PLT caching and creation if not running dialyzer #40

Workflow file for this run

name: CI
on:
pull_request:
push:
jobs:
test:
name: Test (Elixir ${{ matrix.elixir }}, OTP ${{ matrix.erlang }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- erlang: "26.2"
elixir: "1.17"
runner: ubuntu-latest
lint: true
coverage: true
report: true
dialyzer: true
- erlang: "24.3"
elixir: "1.12"
runner: ubuntu-latest
- erlang: "23.3.1"
elixir: "1.11.4"
runner: ubuntu-20.04
- erlang: "21.3"
elixir: "1.10"
runner: ubuntu-20.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MIX_ENV: test
ECHO_HOST: localhost
FUZZINGSERVER_HOST: localhost
steps:
- uses: actions/checkout@v4
- name: Install OTP and Elixir
uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.erlang}}
elixir-version: ${{matrix.elixir}}
- name: Cache dependencies
id: cache-deps
uses: actions/cache@v4
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-otp${{ matrix.erlang }}-elixir${{ matrix.elixir }}-${{ hashFiles('**/mix.lock') }}
- name: Install and compile dependencies
if: steps.cache-deps.outputs.cache-hit != 'true'
run: |
mix deps.get --only test
mix deps.compile
- name: Start docker
run: docker-compose up --detach echo fuzzingserver
- name: Check for unused dependencies
run: mix deps.get && mix deps.unlock --check-unused
if: ${{ matrix.lint && steps.cache-deps.outputs.cache-hit != 'true' }}
- name: Compile with --warnings-as-errors
run: mix compile --warnings-as-errors
if: ${{ matrix.lint }}
- name: Restore cached PLTs
uses: actions/cache@v4
id: plt_cache
if: ${{ matrix.dialyzer }}
with:
key: |
${{ runner.os }}-${{ matrix.elixir }}-${{ matrix.erlang }}-plt
restore-keys: |
${{ runner.os }}-${{ matrix.elixir }}-${{ matrix.erlang }}-plt
path: |
priv/plts
# Create PLTs if no cached PLTs were found
- name: Create PLTs
if: ${{ matrix.dialyzer }} && steps.plt_cache.outputs.cache-hit != 'true'
run: MIX_ENV=test mix dialyzer --plt
- name: Run dialyzer
run: MIX_ENV=test mix dialyzer
if: ${{ matrix.dialyzer }}
- name: Run tests with coverage
run: mix coveralls.github
if: ${{ matrix.coverage }}
- name: Run tests
run: mix test --trace
if: ${{ !matrix.coverage }}
- name: Check mix format
run: mix format --check-formatted
if: ${{ matrix.lint }}
- name: Add seedling favicon to autobahn report
if: github.ref == 'refs/heads/main' && matrix.report
run: ./autobahn/favicon.sh ./autobahn/reports/index.html
- name: Checkout gh-pages branch to ./gh-pages
if: github.ref == 'refs/heads/main' && matrix.report
uses: actions/checkout@v4
with:
ref: gh-pages
path: ./gh-pages
- name: Move autobahn report results
if: github.ref == 'refs/heads/main' && matrix.report
run: mv ./autobahn/reports/* ./gh-pages/
- name: Commit autobahn report to gh-pages branch
if: github.ref == 'refs/heads/main' && matrix.report
run: |
cd ./gh-pages
git config --local user.email "$(git log --format='%ae' HEAD^!)"
git config --local user.name "$(git log --format='%an' HEAD^!)"
git add *.{html,json}
git commit -m "publish Autobahn|Testsuite report" || true
git push