117 lines
2.6 KiB
YAML
117 lines
2.6 KiB
YAML
name: CI
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: main
|
|
|
|
jobs:
|
|
tests:
|
|
runs-on: ubuntu-latest
|
|
name: Test (${{matrix.elixir}}/${{matrix.otp}})
|
|
|
|
strategy:
|
|
matrix:
|
|
otp: [23.x, 24.x]
|
|
elixir: [1.10.x, 1.12.x]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: erlef/setup-beam@v1
|
|
with:
|
|
otp-version: ${{matrix.otp}}
|
|
elixir-version: ${{matrix.elixir}}
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
deps
|
|
_build
|
|
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-mix-
|
|
|
|
- name: Install Dependencies
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
run: mix deps.get
|
|
|
|
- name: Run Tests
|
|
run: mix test
|
|
|
|
integration_tests:
|
|
runs-on: ubuntu-latest
|
|
name: Integration Test (${{matrix.elixir}}/${{matrix.otp}})
|
|
defaults:
|
|
run:
|
|
working-directory: "./integration_test/temple_demo"
|
|
|
|
strategy:
|
|
matrix:
|
|
otp: [23.x]
|
|
elixir: [1.9.x, 1.11.x]
|
|
|
|
services:
|
|
db:
|
|
image: postgres:12
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: temple_demo_test
|
|
ports: ['5432:5432']
|
|
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: erlef/setup-beam@v1
|
|
with:
|
|
otp-version: ${{matrix.otp}}
|
|
elixir-version: ${{matrix.elixir}}
|
|
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
deps
|
|
_build
|
|
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-mix-
|
|
|
|
- name: Install Dependencies
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
run: mix deps.get
|
|
|
|
- name: Run Tests
|
|
run: mix test || mix test --failed || mix test --failed
|
|
env:
|
|
MIX_ENV: test
|
|
|
|
- uses: actions/upload-artifact@v2
|
|
if: failure()
|
|
with:
|
|
name: screenshots
|
|
path: screenshots/
|
|
|
|
formatter:
|
|
runs-on: ubuntu-latest
|
|
name: Formatter (1.11.x.x/23.x)
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: erlef/setup-beam@v1
|
|
with:
|
|
otp-version: 23.x
|
|
elixir-version: 1.11.x
|
|
- uses: actions/cache@v2
|
|
with:
|
|
path: |
|
|
deps
|
|
_build
|
|
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-mix-
|
|
|
|
- name: Install Dependencies
|
|
if: steps.cache.outputs.cache-hit != 'true'
|
|
run: mix deps.get
|
|
|
|
- name: Run Formatter
|
|
run: mix format --check-formatted
|