Skip to content

Invoices liveviews

Invoices liveviews #13

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.12
steps:
- name: Checkout
uses: actions/checkout@v4
- 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 }}-${{ env.elixir-version }}-${{ env.otp-version }}-mix-${{ github.sha }}
restore-keys: ${{ runner.os }}-${{ env.elixir-version }}-${{ env.otp-version }}-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.12
steps:
- name: Checkout
uses: actions/checkout@v4
- 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 }}-${{ env.elixir-version }}-${{ env.otp-version }}-mix-${{ github.sha }}
restore-keys: ${{ runner.os }}-${{ env.elixir-version }}-${{ env.otp-version }}-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.12
steps:
- name: Checkout
uses: actions/checkout@v4
- 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 }}-${{ env.elixir-version }}-${{ env.otp-version }}-mix-${{ github.sha }}
restore-keys: ${{ runner.os }}-${{ env.elixir-version }}-${{ env.otp-version }}-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.12
steps:
- name: Checkout
uses: actions/checkout@v4
- 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 }}-${{ env.elixir-version }}-${{ env.otp-version }}-mix-${{ github.sha }}
restore-keys: ${{ runner.os }}-${{ env.elixir-version }}-${{ env.otp-version }}-mix-
- name: Restore PLT cache
uses: actions/cache@v3
with:
path: priv/plts
key: ${{ runner.os }}-${{ env.elixir-version }}-${{ env.otp-version }}-plt-${{ github.sha }}
restore-keys: ${{ runner.os }}-${{ env.elixir-version }}-${{ env.otp-version }}-plt-
- name: Create PLTs
env:
MIX_ENV: test
run: mix dialyzer --plt
- name: Run dialyzer
env:
MIX_ENV: test
run: mix dialyzer
format:
needs: compile
name: Format
runs-on: ubuntu-latest
env:
elixir-version: 1.16.2
otp-version: 25.3.2.12
steps:
- name: Checkout
uses: actions/checkout@v4
- 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 }}-${{ env.elixir-version }}-${{ env.otp-version }}-mix-${{ github.sha }}
restore-keys: ${{ runner.os }}-${{ env.elixir-version }}-${{ env.otp-version }}-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.12
steps:
- name: Checkout
uses: actions/checkout@v4
- 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 }}-${{ env.elixir-version }}-${{ env.otp-version }}-mix-${{ github.sha }}
restore-keys: ${{ runner.os }}-${{ env.elixir-version }}-${{ env.otp-version }}-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: ${{ secrets.POSTGRES_PASSWORD }}
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.12
steps:
- name: Checkout
uses: actions/checkout@v4
- 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 }}-${{ env.elixir-version }}-${{ env.otp-version }}-mix-${{ github.sha }}
restore-keys: ${{ runner.os }}-${{ env.elixir-version }}-${{ env.otp-version }}-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@v4
- name: Restore npm cache
uses: actions/cache@v3
id: npm-cache
with:
path: ~/.npm
key: ${{ runner.os }}-prettier
- 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.12
steps:
- name: Checkout
uses: actions/checkout@v4
- 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 }}-${{ env.elixir-version }}-${{ env.otp-version }}-mix-${{ github.sha }}
restore-keys: ${{ runner.os }}-${{ env.elixir-version }}-${{ env.otp-version }}-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: ${{ secrets.POSTGRES_PASSWORD }}
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.12
steps:
- name: Checkout
uses: actions/checkout@v4
- 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 }}-${{ env.elixir-version }}-${{ env.otp-version }}-mix-${{ github.sha }}
restore-keys: ${{ runner.os }}-${{ env.elixir-version }}-${{ env.otp-version }}-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.12
steps:
- name: Checkout
uses: actions/checkout@v4
- 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 }}-${{ env.elixir-version }}-${{ env.otp-version }}-mix-${{ github.sha }}
restore-keys: ${{ runner.os }}-${{ env.elixir-version }}-${{ env.otp-version }}-mix-
- name: Check for unused Mix dependencies
env:
MIX_ENV: test
run: mix deps.unlock --check-unused
deploy_preview_app:
name: Deploy preview app
needs:
- compile
- credo
- deps_audit
- dialyzer
- format
- hex_audit
- migrations
- prettier
- sobelow
- test
- unused_deps
runs-on: ubuntu-latest
permissions: write-all
concurrency:
group: pr-${{ github.event.number }}
environment:
name: pr-${{ github.event.number }}
url: https://bill-bliss-pr-${{ github.event.number }}.fly.dev
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Delete previous deployments
uses: strumwolf/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
environment: pr-${{ github.event.number }}
ref: ${{ github.head_ref }}
onlyRemoveDeployments: true
- name: Deploy preview app
uses: optimumBA/fly-preview-apps@main
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
FLY_ORG: optimum-bh-internship
FLY_REGION: lhr
PHX_HOST: bill-bliss-pr-${{ github.event.number }}.fly.dev
REPO_NAME: invoice-app
with:
name: bill-bliss-pr-${{ github.event.number }}
secrets: APPSIGNAL_APP_ENV=preview APPSIGNAL_PUSH_API_KEY=${{ secrets.APPSIGNAL_PUSH_API_KEY }} PHX_HOST=${{ env.PHX_HOST }} SECRET_KEY_BASE=${{ secrets.SECRET_KEY_BASE }}