Skip to content

add mock inference endpoint #12

add mock inference endpoint

add mock inference endpoint #12

Workflow file for this run

name: Backend CI
on:
push:
paths:
- 'backend/**'
- '.github/workflows/backend.yaml'
pull_request:
paths:
- 'backend/**'
- '.github/workflows/backend.yaml'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: psf/black@24.2.0
with:
src: "./backend/src"
jupyter: true
version: 24.2.0
options: "--check --verbose --line-length=150"
test:
needs: lint
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: ${{ secrets.DATABASE_USER }}
POSTGRES_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
POSTGRES_DB: ${{ secrets.DATABASE_DB }}
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12.2
uses: actions/setup-python@v4
with:
python-version: 3.12.2
- name: Install dependencies
run: |
cd backend
python -m pip install --upgrade pip
pip install poetry
poetry export --without-hashes --format=requirements.txt --with "dev" --with "test" > requirements.txt
pip install -r requirements.txt
- name: Run tests
env:
SECRET_KEY: ${{ secrets.SECRET_KEY }}
ALGORITHM: ${{ secrets.ALGORITHM }}
ACCESS_TOKEN_EXPIRE_MINUTES: ${{ secrets.ACCESS_TOKEN_EXPIRE_MINUTES }}
APP_HOST: ${{ secrets.APP_HOST }}
APP_PORT: ${{ secrets.APP_PORT }}
DATABASE_HOSTNAME: ${{ secrets.DATABASE_HOSTNAME }}
DATABASE_PORT: ${{ secrets.DATABASE_PORT }}
DATABASE_DB: ${{ secrets.DATABASE_DB }}
DATABASE_USER: ${{ secrets.DATABASE_USER }}
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
STRIPE_API_VERSION: ${{ secrets.STRIPE_API_VERSION }}
STRIPE_PUBLIC_KEY: ${{ secrets.STRIPE_PUBLIC_KEY }}
STRIPE_SECRET_KEY: ${{ secrets.STRIPE_SECRET_KEY }}
STRIPE_WEBHOOK_SECRET: ${{ secrets.STRIPE_WEBHOOK_SECRET }}
STRIPE_PRICE_ID_THREE: ${{ secrets.STRIPE_PRICE_ID_THREE }}
STRIPE_PRICE_ID_FIVE: ${{ secrets.STRIPE_PRICE_ID_FIVE }}
STRIPE_PRICE_ID_TEN: ${{ secrets.STRIPE_PRICE_ID_TEN }}
run: |
export PYTHONPATH=$PYTHONPATH:$(pwd)/backend
pytest --junitxml=reports/report_func.xml backend/src/tests/
- name: Save junit report
if: always()
uses: actions/upload-artifact@v4
with:
name: test_report
path: ./reports/report_func.xml