Skip to content

update segment

update segment #608

Workflow file for this run

name: Test
on:
- push
env:
MIX_ENV: test
OTP_VERSION: 26.2.5
ELIXIR_VERSION: 1.17.1
jobs:
test:
runs-on: ubuntu-latest
services:
db:
image: postgres:15
ports: ["5432:5432"]
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Set up Elixir
id: beam
uses: erlef/setup-beam@v1
with:
elixir-version: ${{env.ELIXIR_VERSION}}
otp-version: ${{env.OTP_VERSION}}
- name: Checkout code
uses: actions/checkout@v4
- name: Restore dependencies cache
id: cache-deps
uses: actions/cache@v4
env:
cache-name: cache-elixir-deps
with:
path: deps
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ env.cache-name }}-
- name: Restore build cache
id: cache-build
uses: actions/cache@v4
env:
cache-name: cache-compiled-build
with:
path: _build
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ env.cache-name }}-
${{ runner.os }}-mix-
# Cache key based on Erlang/Elixir version and the mix.lock hash
- name: Restore PLT cache
uses: actions/cache/restore@v4
id: plt_cache
with:
key: |
plt-${{ runner.os }}-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
plt-${{ runner.os }}-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}
path: |
priv/plts
- name: Install dependencies
run: mix deps.get
shell: bash
- name: Compile app
run: mix compile --all-warnings --warnings-as-errors
# Create PLTs if no cache was found
- name: Create PLTs
if: steps.plt_cache.outputs.cache-hit != 'true'
run: mix dialyzer --plt
# By default, the GitHub Cache action will only save the cache if all steps in the job succeed,
# so we separate the cache restore and save steps in case running dialyzer fails.
- name: Save PLT cache
id: plt_cache_save
uses: actions/cache/save@v4
if: steps.plt_cache.outputs.cache-hit != 'true'
with:
key: |
plt-${{ runner.os }}-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('**/mix.lock') }}
path: |
priv/plts
- name: Check formatter
run: mix format --check-formatted
- name: Lint
run: mix credo --strict
- name: Scan security vulnerabilities
run: mix sobelow -i Config.HTTPS --skip --exit
- name: Check unused dependencies
run: mix deps.unlock --check-unused
- name: Audit dependencies
run: mix deps.audit
- name: Scan retired dependencies
run: mix hex.audit
- name: Run dialyzer
run: mix dialyzer --format github
- name: Run tests
run: mix test