Skip to content

Remove View on GitHub from footer #14

Remove View on GitHub from footer

Remove View on GitHub from footer #14

Workflow file for this run

name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Run Ruff
run: |
ruff check app/ tests/
- name: Run Black
run: |
black --check app/ tests/
- name: Run MyPy
run: |
mypy app/ || true
test:
name: Test
runs-on: ubuntu-latest
services:
redis:
image: redis:7-alpine
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
postgres:
image: postgres:15-alpine
env:
POSTGRES_DB: falcon_inference
POSTGRES_USER: falcon
POSTGRES_PASSWORD: falcon_test_password
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Create models directory
run: |
mkdir -p models
python scripts/train_model.py
- name: Run tests
env:
REDIS_HOST: localhost
POSTGRES_HOST: localhost
POSTGRES_PASSWORD: falcon_test_password
run: |
pytest tests/unit/ -v --cov=app --cov-report=xml
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
flags: unittests
name: codecov-umbrella
security:
name: Security Scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install pip-audit
run: |
pip install pip-audit
- name: Run pip-audit
run: |
pip-audit -r requirements.txt || true
docker:
name: Docker Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: falcon-worker:test
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Test Docker image
run: |
python scripts/train_model.py
docker run --rm falcon-worker:test python -c "import app; print('OK')"