Skip to content

Feat/testingv3

Feat/testingv3 #132

Workflow file for this run

name: CI
on: pull_request
env:
MIX_ENV: test
jobs:
deps:
name: Dependencies
runs-on: ubuntu-latest
env:
MIX_ENV: test
strategy:
matrix:
elixir: [1.16]
otp: [26.0]
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup
uses: erlef/setup-elixir@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- name: Retrieve Cached Dependencies
uses: actions/cache@v2
id: mix-cache
with:
path: |
deps
_build
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Install Dependencies
if: steps.mix-cache.outputs.cache-hit != 'true'
run: |
mix local.rebar --force
mix local.hex --force
mix deps.get
mix deps.compile
gen_plt_cache:
name: PLT_cache
runs-on: ubuntu-latest
env:
MIX_ENV: test
strategy:
matrix:
elixir: [1.16]
otp: [26.0]
needs:
- deps
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup
uses: erlef/setup-elixir@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- name: Retrieve Cached Dependencies
uses: actions/cache@v2
id: plt-cache
with:
path: |
deps
_build
priv/plts
key: plt-v4-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Install Dependencies
if: steps.plt-cache.outputs.cache-hit != 'true'
run: |
mix deps.get
mix deps.compile
mix dialyzer --plt
lint:
runs-on: ubuntu-latest
env:
MIX_ENV: test
strategy:
matrix:
elixir: [1.16]
otp: [26.0]
needs:
- deps
steps:
- uses: actions/checkout@v2
- uses: erlef/setup-elixir@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- name: Retrieve Cached Dependencies
uses: actions/cache@v2
id: mix-cache
with:
path: |
deps
_build
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Fetch dependencies
if: steps.mix-cache.outputs.cache-hit != 'true'
run: mix deps.get
- name: ==> 🔎 Lint
run: mix credo
dialyzer:
runs-on: ubuntu-latest
env:
MIX_ENV: test
strategy:
matrix:
elixir: [1.16]
otp: [26.0]
needs:
- gen_plt_cache
steps:
- uses: actions/checkout@v2
- uses: erlef/setup-elixir@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- uses: actions/cache@v2
env:
cache-name: mix-plt-cache
with:
path: |
deps
_build
priv/plts
key: plt-v4-${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Fetch dependencies
if: steps.mix-plt-cache.outputs.cache-hit != 'true'
run: mix deps.get
- name: ==> 🔎 Static dialyze
run: mix dialyzer
tests:
name: Test
needs: deps
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
env:
MIX_ENV: test
TEST_DATABASE_URL: postgres://postgres:postgres@localhost:5432/go_escuela_lms_test
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strategy:
matrix:
elixir: [1.16]
otp: [26.0]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup
uses: erlef/setup-elixir@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- name: Retrieve Cached Dependencies
uses: actions/cache@v2
id: mix-cache
with:
path: |
deps
_build
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: create databases
run: mix ecto.create
- name: prepare database
run: mix ecto.migrate
- name: Tests & Coverage
uses: josecfreittas/elixir-coverage-feedback-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
coverage_threshold: 80
services:
pg:
image: postgres:16
ports: ["5432:5432"]
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
check_format:
runs-on: ubuntu-latest
env:
MIX_ENV: test
strategy:
matrix:
elixir: [1.16]
otp: [26.0]
needs:
- deps
steps:
- uses: actions/checkout@v2
- uses: erlef/setup-elixir@v1
with:
elixir-version: ${{ matrix.elixir }}
otp-version: ${{ matrix.otp }}
- name: Retrieve Cached Dependencies
uses: actions/cache@v2
id: mix-cache
with:
path: |
deps
_build
key: ${{ runner.os }}-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
- name: Fetch dependencies
if: steps.mix-cache.outputs.cache-hit != 'true'
run: mix deps.get
- name: ==> 🔎 Format check
run: mix format --check-formatted