ash/.github/workflows/test-subprojects.yml
2024-05-06 11:02:48 -04:00

96 lines
4.3 KiB
YAML

name: Test Subprojects
on:
push:
tags:
- "v*"
branches: [main, "3.0"]
jobs:
test-subprojects:
runs-on: ubuntu-latest
name: Subproject ${{matrix.project.org}}/${{matrix.project.name}} - OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
strategy:
fail-fast: false
matrix:
project:
[
{ org: "ash-project", name: "ash_postgres" },
{ org: "ash-project", name: "ash_csv" },
{ org: "ash-project", name: "ash_double_entry" },
{ org: "ash-project", name: "ash_money" },
{ org: "ash-project", name: "ash_graphql" },
{ org: "ash-project", name: "ash_json_api" },
{ org: "ash-project", name: "ash_phoenix" },
{ org: "ash-project", name: "ash_admin" },
{ org: "ash-project", name: "ash_archival" },
{ org: "ash-project", name: "ash_state_machine" },
{ org: "ash-project", name: "ash_appsignal" },
{ org: "ash-project", name: "ash_oban" },
{ org: "ash-project", name: "ash_sqlite" },
{ org: "ash-project", name: "ash_paper_trail" },
{ org: "team-alembic", name: "ash_authentication" },
{ org: "team-alembic", name: "ash_authentication_phoenix" },
]
otp: ["26.0.2"]
elixir: ["1.16.0"]
services:
pg:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
ports: ["5432:5432"]
env:
ASH_CI: true
ASH_VERSION: local
steps:
- run: sudo apt-get install --yes erlang-dev
- uses: actions/checkout@v2
with:
repository: ${{matrix.project.org}}/${{matrix.project.name}}
path: ${{matrix.project.name}}
- uses: actions/checkout@v2
with:
repository: ash-project/ash
path: ash
- uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}
- uses: actions/cache@v1
id: cache-deps
with:
path: ${{matrix.project.name}}/deps
key: ${{matrix.project.name}}-otp-${{matrix.otp}}-elixir-${{matrix.elixir}}-deps-2-${{ hashFiles('config/**/*.exs') }}-${{ hashFiles(format('{0}{1}', github.workspace, '/ash/mix.lock')) }}
restore-keys: ${{matrix.project.name}}-otp-${{matrix.otp}}-elixir-${{matrix.elixir}}-deps-2-${{ hashFiles('config/**/*.exs') }}-
- uses: actions/cache@v1
id: cache-build
with:
path: ${{matrix.project.name}}/_build
key: ${{matrix.project.name}}-otp-${{matrix.otp}}-elixir-${{matrix.elixir}}-build-3-${{ hashFiles('config/**/*.exs') }}-${{ hashFiles(format('{0}{1}', github.workspace, '/ash/mix.lock')) }}
restore-keys: ${{matrix.project.name}}-otp-${{matrix.otp}}-elixir-${{matrix.elixir}}-build-3-${{ hashFiles('config/**/*.exs') }}-
- name: mix deps.get inside ./${{matrix.project.name}}
run: mix deps.get
working-directory: ./${{matrix.project.name}}
- run: mix test.create
if: ${{matrix.project.name == 'ash_postgres' || matrix.project.name == 'ash_sqlite' || matrix.project.name == 'ash_oban'}}
working-directory: ./${{matrix.project.name}}
- run: mix test.migrate
if: ${{matrix.project.name == 'ash_postgres' || matrix.project.name == 'ash_sqlite' || matrix.project.name == 'ash_oban'}}
working-directory: ./${{matrix.project.name}}
- run: mix test.migrate_tenants
if: ${{matrix.project.name == 'ash_postgres'}}
working-directory: ./${{matrix.project.name}}
- name: mix compile --force --warnings-as-errors inside ./${{matrix.project.name}}
run: mix compile --force --warnings-as-errors
env:
MIX_ENV: test
working-directory: ./${{matrix.project.name}}
- name: mix test inside ./${{matrix.project.name}}
run: mix test
working-directory: ./${{matrix.project.name}}
- name: test.generate_migrations --check
run: mix test.generate_migrations --check
working-directory: ./${{matrix.project.name}}
if: ${{matrix.project.name == 'ash_postgres' || matrix.project.name == 'ash_sqlite'}}