analytics/.github/workflows/elixir.yml
Adam Rutkowski 5de43b758d
Run tests in async mode where applicable (#2542)
* Set pg pool size for MIX_ENV=test

* Include slow tests in CI run

* Exclude slow tests by default

* Mark tests slow/async where applicable

* Restructure captcha mocks

* Revert async where env is relied upon

* Add --max-failures=1 to CI run

* Set warnings as errors

* Disable async where various mocks are used

* Revert "Disable async where various mocks are used"

This reverts commit 2446b72a29.

* Disable async for test using vcr
2022-12-26 10:20:29 -03:00

79 lines
2.1 KiB
YAML

name: Elixir CI
on:
push:
branches: [master, stable]
pull_request:
branches: [master, stable]
jobs:
build:
name: Build and test
runs-on: buildjet-4vcpu-ubuntu-2004
strategy:
matrix:
postgres_version: [12, 13, 14]
services:
postgres:
image: postgres:${{ matrix.postgres_version }}
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
clickhouse:
image: yandex/clickhouse-server:21.11
ports:
- 8123:8123
env:
options: >-
--health-cmd nc -zw3 localhost 8124
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Read .tool-versions
uses: marocchino/tool-versions-action@v1
id: versions
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{steps.versions.outputs.elixir}}
otp-version: ${{ steps.versions.outputs.erlang}}
- name: Restore dependencies cache
uses: actions/cache@v2
with:
path: |
deps
_build
priv/plts
key: ${{ runner.os }}-mix-v2-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-v2-
- name: Install dependencies
run: mix deps.get && npm install --prefix ./tracker
- name: Check Formatting
run: mix format --check-formatted
- name: Check Compile Warnings
run: mix compile --warnings-as-errors --all-warnings
- name: Generate tracker files
run: npm run deploy --prefix ./tracker
- name: Check Credo Warnings
run: mix credo diff --from-git-merge-base origin/master
- name: Run tests
run: mix test --include slow --max-failures 1 --warnings-as-errors
- name: Check Dialyzer
run: mix dialyzer
env:
MIX_ENV: test