Skip to content

ci(action): update erlef/setup-beam action to v1.18.2 #72

ci(action): update erlef/setup-beam action to v1.18.2

ci(action): update erlef/setup-beam action to v1.18.2 #72

Workflow file for this run

name: Test
on:
push:
# ignore branches where the release workflow runs as it already calls this one
branches-ignore:
- main
- dev
pull_request:
workflow_call:
permissions:
contents: read
jobs:
# ignore the push event trigger if a PR is open for the current branch
prevent_duplicate_checks:
runs-on: ubuntu-latest
steps:
- uses: insurgent-lab/is-in-pr-action@129df59687402c4a9c81a9a9e88d7448cdbba541 # v0.2.0
id: isInPR
outputs:
should-run: ${{ !(steps.isInPR.outputs.result == 'true' && github.event_name == 'push') }}
test_matrix:
name: Test (Elixir ${{matrix.elixir}} | OTP ${{matrix.otp}})
runs-on: ${{ matrix.os }}
timeout-minutes: 10
needs: prevent_duplicate_checks
if: ${{ needs.prevent_duplicate_checks.outputs.should-run == 'true' }}
strategy:
fail-fast: false
matrix:
include:
- elixir: 1.12.x
otp: 22
os: ubuntu-20.04
- elixir: 1.13.x
otp: 23
os: ubuntu-20.04
- elixir: 1.14.x
otp: 24
os: ubuntu-22.04
- elixir: 1.15.x
otp: 25
os: ubuntu-22.04
- elixir: 1.16.x
otp: 26
os: ubuntu-latest
env:
MIX_ENV: test
steps:
- name: Checkout code
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
- name: Set up BEAM
id: setup-beam
uses: erlef/setup-beam@0a541161e47ec43ccbd9510053c5f336ca76c2a2 # v1.17.6
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}
- name: Restore dependencies cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
env:
cache-key: deps
with:
key: ${{ env.cache-key }}-${{ runner.os }}-${{ steps.setup-beam.outputs.otp-version }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}-git-${{ github.sha }}
restore-keys: |
${{ env.cache-key }}-${{ runner.os }}-${{ steps.setup-beam.outputs.otp-version }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
${{ env.cache-key }}-${{ runner.os }}-${{ steps.setup-beam.outputs.otp-version }}-${{ steps.setup-beam.outputs.elixir-version }}
path: |
deps
_build
- name: Install dependencies
run: |
mix local.hex --force
mix do deps.get, deps.compile
- name: Check formatting
run: mix format --check-formatted
- name: Compile code (without warning)
run: mix compile --warnings-as-errors
- name: Run tests
run: mix test
# Dialyzer
- name: Restore PLTs cache
id: restore_plts_cache
uses: actions/cache/restore@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
env:
cache-key: plts
with:
key: ${{ env.cache-key }}-${{ runner.os }}-${{ steps.setup-beam.outputs.otp-version }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}-git-${{ github.sha }}
restore-keys: |
${{ env.cache-key }}-${{ runner.os }}-${{ steps.setup-beam.outputs.otp-version }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
${{ env.cache-key }}-${{ runner.os }}-${{ steps.setup-beam.outputs.otp-version }}-${{ steps.setup-beam.outputs.elixir-version }}
path: priv/plts
- name: Create PLTs
if: steps.restore_plts_cache.outputs.cache-hit != 'true'
run: |
mkdir -p priv/plts/core.plt
mix dialyzer --plt
- name: Save PLTs cache
uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
env:
cache-key: plts
if: steps.restore_plts_cache.outputs.cache-hit != 'true'
with:
key: ${{ env.cache-key }}-${{ runner.os }}-${{ steps.setup-beam.outputs.otp-version }}-${{ steps.setup-beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}-git-${{ github.sha }}
path: priv/plts
- name: Run dialyzer
run: mix dialyzer --format github
# separate job to set as required status check in branch protection
required_check:
runs-on: ubuntu-latest
needs:
- prevent_duplicate_checks
- test_matrix
if: ${{ !cancelled() && needs.prevent_duplicate_checks.outputs.should-run == 'true' }}
steps:
- name: All required jobs and matrix versions passed
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: Some required jobs or matrix versions failed
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1