ash/.github/workflows/ash-ci.yml

194 lines
5 KiB
YAML
Raw Normal View History

name: Ash CI
on:
workflow_call:
2023-02-17 11:34:17 +13:00
secrets:
HEX_API_KEY:
required: false
2023-02-01 15:06:07 +13:00
inputs:
spark-formatter:
type: boolean
default: true
2023-02-04 19:55:50 +13:00
sobelow:
type: boolean
default: true
2023-02-01 16:49:08 +13:00
postgres:
type: boolean
default: false
hex-api-key:
type: string
jobs:
deps:
name: mix deps.get
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: team-alembic/staple-actions/actions/mix-deps-get@main
auditor:
name: mix hex.audit
runs-on: ubuntu-latest
needs: deps
steps:
- uses: actions/checkout@v3
- uses: team-alembic/staple-actions/actions/mix-hex-audit@main
build-test:
name: MIX_ENV=test mix.compile
runs-on: ubuntu-latest
needs: deps
steps:
- uses: actions/checkout@v3
- uses: team-alembic/staple-actions/actions/install-elixir@main
- uses: team-alembic/staple-actions/actions/mix-compile@main
with:
mix-env: test
formatter:
name: mix format --check-formatted
runs-on: ubuntu-latest
needs: build-test
steps:
- uses: actions/checkout@v3
- uses: team-alembic/staple-actions/actions/mix-format@main
with:
mix-env: test
2023-02-01 16:19:28 +13:00
spark-formatter:
name: mix spark.formatter --check
runs-on: ubuntu-latest
needs: build-test
steps:
- uses: actions/checkout@v3
- uses: team-alembic/staple-actions/actions/mix-task@main
if: ${{inputs.spark-formatter}}
with:
mix-env: test
task: spark.formatter --check
2023-02-04 19:55:50 +13:00
sobelow:
name: mix sobelow
runs-on: ubuntu-latest
needs: build-test
steps:
- uses: actions/checkout@v3
- uses: team-alembic/staple-actions/actions/mix-task@main
if: ${{inputs.sobelow}}
2023-02-04 19:55:50 +13:00
with:
mix-env: test
task: sobelow
2023-02-01 05:21:04 +13:00
credo:
name: mix credo --strict
runs-on: ubuntu-latest
needs: build-test
steps:
- uses: actions/checkout@v3
- uses: team-alembic/staple-actions/actions/mix-credo@main
2023-02-01 15:11:04 +13:00
if: ${{inputs.spark-formatter}}
2023-02-01 05:21:04 +13:00
with:
mix-env: test
2023-02-01 18:54:11 +13:00
unused-deps:
name: mix deps.unlock --check-unused
runs-on: ubuntu-latest
needs: build-test
steps:
- uses: actions/checkout@v3
- uses: team-alembic/staple-actions/actions/mix-task@main
with:
mix-env: test
task: deps.unlock --check-unused
# Need to clean lots of things up before we can add this
# doctor:
# name: mix doctor --full --raise
# runs-on: ubuntu-latest
# needs: build-test
# steps:
# - uses: actions/checkout@v3
# - uses: team-alembic/staple-actions/actions/mix-doctor@main
# with:
# mix-env: test
2023-02-06 18:44:28 +13:00
test:
name: mix test
runs-on: ubuntu-latest
needs: build-test
services:
postgres:
image: postgres
env:
POSTGRES_HOST_AUTH_METHOD: trust
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
2023-02-01 16:46:40 +13:00
- uses: team-alembic/staple-actions/actions/mix-task@main
with:
mix-env: test
task: ash_postgres.generate_migrations --check
if: ${{inputs.postgres}}
2023-02-01 16:46:40 +13:00
- uses: team-alembic/staple-actions/actions/mix-task@main
with:
mix-env: test
task: ash_postgres.create
if: ${{inputs.postgres}}
2023-02-01 16:46:40 +13:00
- uses: team-alembic/staple-actions/actions/mix-task@main
with:
mix-env: test
task: ash_postgres.migrate
if: ${{inputs.postgres}}
2023-02-01 16:46:40 +13:00
- uses: team-alembic/staple-actions/actions/mix-task@main
with:
mix-env: test
task: ash_postgres.migrate --tenants
if: ${{inputs.postgres}}
- uses: team-alembic/staple-actions/actions/mix-test@main
with:
mix-env: test
env:
PGUSER: postgres
PGPASS: postgres
PGHOST: postgres
dialyzer:
name: mix dialyzer
runs-on: ubuntu-latest
needs: build-test
steps:
- uses: actions/checkout@v3
- uses: team-alembic/staple-actions/actions/mix-dialyzer@main
with:
2023-02-01 13:00:22 +13:00
mix-env: dev
build-dev:
name: MIX_ENV=dev mix.compile
runs-on: ubuntu-latest
2023-02-01 18:51:10 +13:00
needs: deps
steps:
- uses: actions/checkout@v3
- uses: team-alembic/staple-actions/actions/mix-compile@main
with:
mix-env: dev
release:
needs:
- credo
2023-02-01 18:54:11 +13:00
- unused-deps
2023-02-01 05:22:05 +13:00
# - doctor
2023-02-01 16:19:28 +13:00
- spark-formatter
2023-02-04 19:55:50 +13:00
- sobelow
- formatter
- auditor
- test
- dialyzer
2023-02-01 18:49:44 +13:00
- build-dev
- deps
2023-02-17 11:47:26 +13:00
if: ${{startsWith(github.ref, 'refs/tags/v') && secrets.HEX_API_KEY}}
runs-on: ubuntu-latest
name: Release
steps:
2023-02-10 09:52:29 +13:00
- uses: actions/checkout@v3
2023-02-10 16:34:41 +13:00
- uses: team-alembic/staple-actions/actions/mix-hex-publish@main
with:
mix-env: dev
2023-02-17 11:33:08 +13:00
hex-api-key: ${{secrets.HEX_API_KEY}}