mirror of
https://github.com/ash-project/ash_hq.git
synced 2024-09-20 13:23:38 +12:00
5ed98bf5a9
improvement: setup CI
71 lines
2.2 KiB
YAML
71 lines
2.2 KiB
YAML
name: Elixir CI
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags-ignore: ["v*"]
|
|
pull_request:
|
|
branches: [main]
|
|
create:
|
|
branches: main
|
|
tags: ["v*"]
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
name: OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}} / Ash ${{matrix.ash}}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
otp: ["25"]
|
|
elixir: ["1.14.0"]
|
|
ash: ["2.4.2"]
|
|
pg_version: ["13"]
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
ASH_VERSION: ${{matrix.ash}}
|
|
services:
|
|
pg:
|
|
image: postgres:${{ matrix.pg_version }}
|
|
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"]
|
|
steps:
|
|
- run: sudo apt-get install --yes erlang-dev
|
|
- uses: actions/checkout@v2
|
|
- uses: erlef/setup-elixir@v1
|
|
with:
|
|
otp-version: ${{matrix.otp}}
|
|
elixir-version: ${{matrix.elixir}}
|
|
- uses: actions/cache@v2
|
|
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
|
|
- uses: actions/cache@v2
|
|
id: cache-build
|
|
with:
|
|
path: _build
|
|
key: otp-${{matrix.otp}}-elixir-${{matrix.elixir}}-build-2-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
|
|
restore-keys: otp-${{matrix.otp}}-elixir-${{matrix.elixir}}-build-2
|
|
- run: mix deps.get
|
|
- run: mix test.create
|
|
- run: mix test.migrate
|
|
- run: mix test.migrate_tenants
|
|
- run: mix check --except dialyzer
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
- run: mix check
|
|
if: "!startsWith(github.ref, 'refs/tags/v')"
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
name: Release
|
|
needs: [build]
|
|
env:
|
|
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: superfly/flyctl-actions/setup-flyctl@master
|
|
- run: flyctl deploy --remote-only
|