Files
fastapi-demo/.gitea/workflows/ci.yml
T
m1000 4769940a00
FastAPI CI / test (push) Successful in 1m6s
Add deploy
2026-11-13 02:43:24 +03:00

42 lines
905 B
YAML

name: FastAPI CI
on:
push:
branches:
- main
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
run: pytest -v
- name: Build Docker image
run: docker build -t fastapi-demo:latest .
- name: Deploy application
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
docker rm -f fastapi-demo || true
docker run -d \
--name fastapi-demo \
--restart unless-stopped \
-p 127.0.0.1:8000:8000 \
fastapi-demo:latest