diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..1876023 --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,59 @@ +name: Check FastAPI Backend + +on: + pull_request: + branches: + - dev + +jobs: + test: + name: Run Tests and Check FastAPI + runs-on: ubuntu-latest + + services: + postgres: + image: postgres:13 + env: + POSTGRES_USER: test_user + POSTGRES_PASSWORD: test_password + POSTGRES_DB: test_db + ports: + - 5432:5432 + options: >- + --health-cmd="pg_isready -U test_user" + --health-interval=10s + --health-timeout=5s + --health-retries=5 + + redis: + image: redis:7 + ports: + - 6379:6379 + options: >- + --health-cmd="redis-cli ping" + --health-interval=10s + --health-timeout=5s + --health-retries=5 + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.12' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Check FastAPI Server + env: + REDIS_HOST: localhost + REDIS_PORT: 6379 + run: | + uvicorn app.main:app --host 0.0.0.0 --port 8000 --log-level warning & + sleep 5 + curl -f http://localhost:8000/docs \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 71a2482..138127c 100644 Binary files a/requirements.txt and b/requirements.txt differ