Skip to content

feat: add product management functionality #338

feat: add product management functionality

feat: add product management functionality #338

Workflow file for this run

name: "Run tests"
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened]
permissions:
contents: read
jobs:
tests:
# Set up a Postgres DB service. By default, Phoenix applications
# use Postgres. This creates a database for running tests.
# Additional services can be defined here if required.
services:
db:
image: postgres:16
ports: ['5432:5432']
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./tololo
name: Test on OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}
strategy:
matrix:
otp: ['26.2.5.6'] # Define the OTP version [required]
elixir: ['1.18.1'] # Define the elixir version [required]
steps:
# Step: Setup Elixir + Erlang image as the base.
- name: Set up Elixir
id: beam
uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.otp}}
elixir-version: ${{matrix.elixir}}
# Step: Check out the code.
- name: Checkout code
uses: actions/checkout@v4
# Step: Define how to cache deps. Restores existing cache if present.
- name: Cache deps
id: cache-deps
uses: actions/cache@v4
env:
cache-name: cache-elixir-deps
with:
path: deps
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ env.cache-name }}-
# Step: Define how to cache the `_build` directory. After the first run,
# this speeds up tests runs a lot. This includes not re-compiling our
# project's downloaded deps every run.
- name: Cache compiled build
id: cache-build
uses: actions/cache@v4
env:
cache-name: cache-compiled-build
with:
path: _build
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-${{ env.cache-name }}-
${{ runner.os }}-mix-
# Step: Download project dependencies. If unchanged, uses
# the cached version.
- name: Install dependencies
run: mix deps.get
- name: Install Migrations
run: MIX_ENV=test mix setup
# Step: Run project tests.
- name: Run tests
run: mix test
env:
ADMIN_API_KEY: test
# Step: Run Credo to analyze code.
- name: Run Credo
run: mix credo
# Step: Check that the checked in code has already been formatted.
# This step fails if something was found unformatted.
# Customize this step as desired.
- name: Format
run: mix format
- name: Ash codegen check (for migrations, GraphQL schema, etc.)
run: mix ash.codegen --check
# Dialyxir
# Cache key based on Erlang/Elixir version and the mix.lock hash
# - name: Restore PLT cache
# id: plt_cache
# uses: actions/cache/restore@v3
# with:
# key: |
# plt-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
# restore-keys: |
# plt-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-
# path: |
# priv/plts
# # Create PLTs if no cache was found
# - name: Create PLTs
# if: steps.plt_cache.outputs.cache-hit != 'true'
# run: mix dialyzer --plt
# # By default, the GitHub Cache action will only save the cache if all steps in the job succeed,
# # so we separate the cache restore and save steps in case running dialyzer fails.
# - name: Save PLT cache
# id: plt_cache_save
# uses: actions/cache/save@v3
# if: steps.plt_cache.outputs.cache-hit != 'true'
# with:
# key: |
# plt-${{ runner.os }}-${{ steps.beam.outputs.otp-version }}-${{ steps.beam.outputs.elixir-version }}-${{ hashFiles('**/mix.lock') }}
# path: |
# priv/plts
# - name: Run dialyzer
# # Two formats are included for ease of debugging and it is lightly recommended to use both, see https://github.com/jeremyjh/dialyxir/issues/530 for reasoning
# # --format github is helpful to print the warnings in a way that GitHub understands and can place on the /files page of a PR
# # --format dialyxir allows the raw GitHub actions logs to be useful because they have the full warning printed
# run: mix dialyzer --format github --format dialyxir