Skip to content

Add Toss price recommendation notification and test coverage #366

Add Toss price recommendation notification and test coverage

Add Toss price recommendation notification and test coverage #366

Workflow file for this run

name: Test
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.13"]
services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: test_db
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis:7-alpine
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install UV
run: pip install uv
- name: Load cached venv
id: cached-uv-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/uv.lock') }}
- name: Install dependencies
run: uv sync --group test
- name: Set environment variables from env.example
run: |
chmod +x scripts/setup-test-env.sh
bash scripts/setup-test-env.sh
- name: Run tests
run: |
uv run pytest tests/ -v --cov=app --cov-report=xml --cov-report=html
- name: Upload coverage reports to GitHub
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage reports to GitHub
uses: actions/upload-artifact@v4
with:
name: coverage-report-${{ matrix.python-version }}
path: htmlcov/
security:
runs-on: ubuntu-latest
env:
PYTHON_VERSION: "3.13"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install UV
run: pip install uv
- name: Load cached venv
id: cached-uv-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('**/uv.lock') }}
- name: Install dependencies
run: uv sync --group dev
- name: Run security checks
run: |
uv run bandit -r app/ -f json -o bandit-report.json || true
uv run safety check --json --output safety-report.json || true
- name: Upload security reports
uses: actions/upload-artifact@v4
with:
name: security-reports
path: |
bandit-report.json
safety-report.json