chore (repo): reorganize monorepo structure #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Packages / Electric / Tests | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
paths: | |
- "packages/electric/**" | |
- "!packages/electric/**README.md" | |
env: | |
OTP_VERSION: "27.0" | |
ELIXIR_VERSION: "1.17.0-otp-27" | |
concurrency: | |
group: packages-electric-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
tests: | |
name: elixir tests | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: packages/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: packages/electric/deps | |
key: ${{ runner.os }}-mixdeps-${{ hashFiles('packages/electric/**/mix.lock') }} | |
restore-keys: ${{ runner.os }}-mixdeps- | |
- name: Restore compiled code | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
packages/electric/_build/*/lib | |
!packages/electric/_build/*/lib/electric | |
key: ${{ runner.os }}-mixbuild-test-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('packages/electric/**/mix.lock') }} | |
- run: mix deps.get && mix deps.compile | |
- name: Cache dependencies | |
uses: actions/cache/save@v4 | |
with: | |
path: packages/electric/deps | |
key: ${{ runner.os }}-mixdeps-${{ hashFiles('packages/electric/**/mix.lock') }} | |
- name: Save compiled code | |
uses: actions/cache/save@v4 | |
with: | |
path: | | |
packages/electric/_build/*/lib | |
!packages/electric/_build/*/lib/electric | |
key: ${{ runner.os }}-mixbuild-test-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('packages/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: packages/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: packages/electric/deps | |
key: ${{ runner.os }}-mixdeps-${{ hashFiles('packages/electric/**/mix.lock') }} | |
- run: mix deps.get | |
- run: make check-format | |
dialyzer: | |
name: dialyzer | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: packages/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: packages/electric/deps | |
key: ${{ runner.os }}-mixdeps-${{ hashFiles('packages/electric/**/mix.lock') }} | |
- name: Restore compiled code | |
uses: actions/cache/restore@v4 | |
with: | |
path: | | |
packages/electric/_build/*/lib | |
!packages/electric/_build/*/lib/electric | |
key: ${{ runner.os }}-mixbuild-dev-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('packages/electric/**/mix.lock') }} | |
- run: mix deps.get && mix deps.compile | |
- name: Save compiled code | |
uses: actions/cache/save@v4 | |
with: | |
path: | | |
packages/electric/_build/*/lib | |
!packages/electric/_build/*/lib/electric | |
key: ${{ runner.os }}-mixbuild-dev-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ hashFiles('packages/electric/**/mix.lock') }} | |
- run: mix compile --force --all-warnings --warnings-as-errors | |
- name: Cache PLT | |
uses: actions/cache/restore@v4 | |
with: | |
path: packages/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: packages/electric/_build/*/*.plt | |
key: ${{ runner.os }}-plt-${{ env.OTP_VERSION }}-${{ env.ELIXIR_VERSION }}-${{ github.ref_name }} |