name: Ash CI on: workflow_call: inputs: spark-formatter: type: boolean default: true postgres: type: boolean default: false 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 spark-formatter: name: mix spark.formatter --check if: ${{inputs.spark-formatter}} 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 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 if: ${{inputs.spark-formatter}} with: mix-env: test # 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-with-postgres: if: ${{inputs.postgres}} 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-task@main with: mix-env: test task: ash_postgres.generate_migrations --check - uses: team-alembic/staple-actions/actions/mix-task@main with: mix-env: test task: ash_postgres.create - uses: team-alembic/staple-actions/actions/mix-task@main with: mix-env: test task: ash_postgres.migrate - uses: team-alembic/staple-actions/actions/mix-task@main with: mix-env: test task: ash_postgres.migrate --tenants - uses: team-alembic/staple-actions/actions/mix-test@main with: mix-env: test env: PGUSER: postgres PGPASS: postgres PGHOST: postgres test: if: ${{!inputs.postgres}} name: mix test runs-on: ubuntu-latest needs: build-test steps: - uses: actions/checkout@v3 - uses: team-alembic/staple-actions/actions/mix-test@main with: mix-env: test 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: mix-env: dev build-dev: name: MIX_ENV=dev mix.compile runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: team-alembic/staple-actions/actions/mix-compile@main with: mix-env: dev release: needs: - credo # - doctor - spark-formatter - formatter - auditor - test - test-with-postgres - dialyzer - 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 }}