2023-02-01 05:15:09 +13:00
|
|
|
name: Ash CI
|
|
|
|
on:
|
|
|
|
workflow_call:
|
2023-02-01 15:06:07 +13:00
|
|
|
inputs:
|
|
|
|
spark-formatter:
|
|
|
|
type: boolean
|
|
|
|
default: true
|
2023-02-01 05:15:09 +13:00
|
|
|
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:15:44 +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
|
|
|
|
with:
|
|
|
|
mix-env: test
|
|
|
|
task: spark.formatter --check
|
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 05:15:09 +13:00
|
|
|
|
|
|
|
# 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
|
|
|
|
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
|
|
|
|
- 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
|
2023-02-01 05:15:09 +13:00
|
|
|
|
|
|
|
build-dev:
|
|
|
|
name: MIX_ENV=dev mix.compile
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- credo
|
2023-02-01 05:22:05 +13:00
|
|
|
# - doctor
|
2023-02-01 05:15:09 +13:00
|
|
|
- formatter
|
|
|
|
- auditor
|
|
|
|
- test
|
|
|
|
- dialyzer
|
|
|
|
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- uses: team-alembic/staple-actions/actions/mix-compile@main
|
|
|
|
with:
|
|
|
|
mix-env: dev
|
|
|
|
release:
|
|
|
|
needs: [build-dev]
|
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Release
|
|
|
|
steps:
|
|
|
|
- run: sudo apt-get install --yes erlang-dev
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: erlef/setup-beam@v1
|
|
|
|
with:
|
|
|
|
otp-version: ${{matrix.otp}}
|
|
|
|
elixir-version: ${{matrix.elixir}}
|
|
|
|
- uses: actions/cache@v1
|
|
|
|
id: cache-deps
|
|
|
|
with:
|
|
|
|
path: deps
|
|
|
|
key: otp-${{matrix.otp}}-elixir-${{matrix.elixir}}-deps-2-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
|
|
|
|
restore-keys: otp-${{matrix.otp}}-elixir-${{matrix.elixir}}-deps-2-
|
|
|
|
- run: mix deps.get
|
|
|
|
- run: mix compile
|
|
|
|
- run: mix hex.publish --yes
|
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
|
|
env:
|
|
|
|
HEX_API_KEY: ${{ secrets.HEX_API_KEY }}
|