Skip to content

fix: update latest Node LTS version to 20.12.2 #40

fix: update latest Node LTS version to 20.12.2

fix: update latest Node LTS version to 20.12.2 #40

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@3e01b38aa0d2a0e51bbc84540300303ec850e80d # v0.1.5
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@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Set up BEAM
id: setup-beam
uses: erlef/setup-beam@61e01a43a562a89bfc54c7f9a378ff67b03e4a21 # v1.16.0
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}
- name: Restore dependencies cache
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.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@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.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@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.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