Skip to content

Update README.md (#1431) #1

Update README.md (#1431)

Update README.md (#1431) #1

name: Components / Electric / Tests
on:
push:
branches:
- main
pull_request:
paths:
- "components/electric/**"
- "!components/electric/**README.md"
env:
OTP_VERSION: "27.0"
ELIXIR_VERSION: "1.17.0-otp-27"
concurrency:
group: components-electric-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
name: elixir tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: components/electric
env:
MIX_ENV: test
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- name: Restore dependencies
uses: actions/cache/restore@v4
with:
path: components/electric/deps
key: ${{ runner.os }}-mixdeps-${{ hashFiles('components/electric/**/mix.lock') }}
restore-keys: ${{ runner.os }}-mixdeps-
- name: Restore compiled code
uses: actions/cache/restore@v4
with:
path: |
components/electric/_build/*/lib
!components/electric/_build/*/lib/electric
key: ${{ runner.os }}-mixbuild-test-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('components/electric/**/mix.lock') }}
- run: mix deps.get && mix deps.compile
- name: Cache dependencies
uses: actions/cache/save@v4
with:
path: components/electric/deps
key: ${{ runner.os }}-mixdeps-${{ hashFiles('components/electric/**/mix.lock') }}
- name: Save compiled code
uses: actions/cache/save@v4
with:
path: |
components/electric/_build/*/lib
!components/electric/_build/*/lib/electric
key: ${{ runner.os }}-mixbuild-test-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('components/electric/**/mix.lock') }}
- run: mix compile --force --all-warnings --warnings-as-errors
- name: Prepare auxiliary services
run: make start_dev_env
- run: mix test
formatting:
name: formatting
runs-on: ubuntu-latest
defaults:
run:
working-directory: components/electric
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- name: Cache dependencies
id: cache-deps
uses: actions/cache@v4
with:
path: components/electric/deps
key: ${{ runner.os }}-mixdeps-${{ hashFiles('components/electric/**/mix.lock') }}
- run: mix deps.get
- run: make check-format
dialyzer:
name: dialyzer
runs-on: ubuntu-latest
defaults:
run:
working-directory: components/electric
env:
MIX_ENV: dev
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ env.OTP_VERSION }}
elixir-version: ${{ env.ELIXIR_VERSION }}
- name: Cache dependencies
id: cache-deps
uses: actions/cache@v4
with:
path: components/electric/deps
key: ${{ runner.os }}-mixdeps-${{ hashFiles('components/electric/**/mix.lock') }}
- name: Restore compiled code
uses: actions/cache/restore@v4
with:
path: |
components/electric/_build/*/lib
!components/electric/_build/*/lib/electric
key: ${{ runner.os }}-mixbuild-dev-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('components/electric/**/mix.lock') }}
- run: mix deps.get && mix deps.compile
- name: Save compiled code
uses: actions/cache/save@v4
with:
path: |
components/electric/_build/*/lib
!components/electric/_build/*/lib/electric
key: ${{ runner.os }}-mixbuild-dev-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('components/electric/**/mix.lock') }}
- run: mix compile --force --all-warnings --warnings-as-errors
- name: Cache PLT
uses: actions/cache/restore@v4
with:
path: components/electric/_build/*/*.plt
key: ${{ runner.os }}-plt-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ github.ref_name }}
restore-keys: ${{ runner.os }}-plt-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-
- run: mix dialyzer
id: dialyzer
- name: Cache PLT
if: ${{ always() && steps.dialyzer.outcome != 'cancelled' }}
uses: actions/cache/save@v4
with:
path: components/electric/_build/*/*.plt
key: ${{ runner.os }}-plt-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ github.ref_name }}