Skip to content

Add authentication

Add authentication #12

Workflow file for this run

name: PR
on:
pull_request:
branches:
- main
types:
- opened
- reopened
- synchronize
jobs:
compile:
name: Install deps and compile
runs-on: ubuntu-latest
env:
elixir-version: 1.16.2
otp-version: 25.3.2.10
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ env.elixir-version }}
otp-version: ${{ env.otp-version }}
- uses: actions/cache@v3
with:
path: "_build\ndeps"
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix
- name: Install Elixir dependencies
env:
MIX_ENV: test
run: mix deps.get
- name: Compile
env:
MIX_ENV: test
run: mix compile
credo:
needs: compile
name: Credo
runs-on: ubuntu-latest
env:
elixir-version: 1.16.2
otp-version: 25.3.2.10
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ env.elixir-version }}
otp-version: ${{ env.otp-version }}
- uses: actions/cache@v3
with:
path: "_build\ndeps"
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix
- name: Check code style
env:
MIX_ENV: test
run: mix credo --strict
deps_audit:
needs: compile
name: Deps audit
runs-on: ubuntu-latest
env:
elixir-version: 1.16.2
otp-version: 25.3.2.10
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ env.elixir-version }}
otp-version: ${{ env.otp-version }}
- uses: actions/cache@v3
with:
path: "_build\ndeps"
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix
- name: Check for vulnerable Mix dependencies
env:
MIX_ENV: test
run: mix deps.audit
dialyzer:
needs: compile
name: Dialyzer
runs-on: ubuntu-latest
env:
elixir-version: 1.16.2
otp-version: 25.3.2.10
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ env.elixir-version }}
otp-version: ${{ env.otp-version }}
- uses: actions/cache@v3
with:
path: "_build\ndeps"
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix
- name: Restore PLT cache
uses: actions/cache@v3
id: plt_cache
with:
key: ${{ runner.os }}-${{ env.elixir-version }}-${{ env.otp-version }}-plt
restore-keys: ${{ runner.os }}-${{ env.elixir-version }}-${{ env.otp-version }}-plt
path: priv/plts
- name: Create PLTs
if: steps.plt_cache.outputs.cache-hit != 'true'
env:
MIX_ENV: test
run: mix dialyzer --plt
- name: Run dialyzer
env:
MIX_ENV: test
run: mix dialyzer --format short 2>&1
format:
needs: compile
name: Format
runs-on: ubuntu-latest
env:
elixir-version: 1.16.2
otp-version: 25.3.2.10
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ env.elixir-version }}
otp-version: ${{ env.otp-version }}
- uses: actions/cache@v3
with:
path: "_build\ndeps"
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix
- name: Check Elixir formatting
env:
MIX_ENV: test
run: mix format --check-formatted
hex_audit:
needs: compile
name: Hex audit
runs-on: ubuntu-latest
env:
elixir-version: 1.16.2
otp-version: 25.3.2.10
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ env.elixir-version }}
otp-version: ${{ env.otp-version }}
- uses: actions/cache@v3
with:
path: "_build\ndeps"
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix
- name: Check for retired Hex packages
env:
MIX_ENV: test
run: mix hex.audit
migrations:
services:
db:
image: postgres:13
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: postgres
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
needs: compile
name: Migrations
runs-on: ubuntu-latest
env:
elixir-version: 1.16.2
otp-version: 25.3.2.10
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ env.elixir-version }}
otp-version: ${{ env.otp-version }}
- uses: actions/cache@v3
with:
path: "_build\ndeps"
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix
- name: Check if migrations are reversible
env:
MIX_ENV: test
run: mix ci.migrations
prettier:
name: Check formatting using Prettier
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Restore npm cache
uses: actions/cache@v3
id: npm-cache
with:
path: ~/.npm
key: ${{ runner.os }}-node
restore-keys: ${{ runner.os }}-node
- name: Install Prettier
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm i -g prettier
- name: Run Prettier
run: npx prettier -c .
sobelow:
needs: compile
name: Security check
runs-on: ubuntu-latest
env:
elixir-version: 1.16.2
otp-version: 25.3.2.10
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ env.elixir-version }}
otp-version: ${{ env.otp-version }}
- uses: actions/cache@v3
with:
path: "_build\ndeps"
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix
- name: Check for security issues using sobelow
env:
MIX_ENV: test
run: mix sobelow --config .sobelow-conf
test:
services:
db:
image: postgres:13
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: postgres
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
needs: compile
name: Test
runs-on: ubuntu-latest
env:
elixir-version: 1.16.2
otp-version: 25.3.2.10
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ env.elixir-version }}
otp-version: ${{ env.otp-version }}
- uses: actions/cache@v3
with:
path: "_build\ndeps"
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix
- name: Run tests
env:
MIX_ENV: test
run: mix test --cover --warnings-as-errors
unused_deps:
needs: compile
name: Check unused deps
runs-on: ubuntu-latest
env:
elixir-version: 1.16.2
otp-version: 25.3.2.10
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ env.elixir-version }}
otp-version: ${{ env.otp-version }}
- uses: actions/cache@v3
with:
path: "_build\ndeps"
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix
- name: Check for unused Mix dependencies
env:
MIX_ENV: test
run: mix deps.unlock --check-unused