Spaces:
Runtime error
Runtime error
Download .github/workflows/build-deploy.yml from abdullah090809/FastAPI-Project: direct link, hf CLI and curl.
- Browser
- Download file 1.83 kB
-
https://huggingface.co/spaces/abdullah090809/FastAPI-Project/resolve/4b5df3e35f64f5c75547addcb02aee2fe5fcb24e/.github/workflows/build-deploy.yml
- Command line
-
hf download hf://spaces/abdullah090809/FastAPI-Project@4b5df3e35f64f5c75547addcb02aee2fe5fcb24e/.github/workflows/build-deploy.yml
-
curl -L -o build-deploy.yml https://huggingface.co/spaces/abdullah090809/FastAPI-Project/resolve/4b5df3e35f64f5c75547addcb02aee2fe5fcb24e/.github/workflows/build-deploy.yml
1.83 kB
| name: Build and Deploy Code | |
| on: [push, pull_request] | |
| jobs: | |
| job1: | |
| environment: | |
| name: testing | |
| env: | |
| DATABASE_HOSTNAME: localhost | |
| DATABASE_PORT: 5432 | |
| DATABASE_NAME: ${{ secrets.DATABASE_NAME }}_test | |
| DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }} | |
| DATABASE_USERNAME: ${{ secrets.DATABASE_USERNAME }} | |
| SECRET_KEY: ${{ secrets.SECRET_KEY }} | |
| ALGORITHM: ${{ secrets.ALGORITHM }} | |
| ACCESS_TOKEN_EXPIRE_MINUTES: ${{ secrets.ACCESS_TOKEN_EXPIRE_MINUTES }} | |
| services: | |
| postgres: | |
| image: postgres | |
| env: | |
| POSTGRES_PASSWORD: ${{ secrets.DATABASE_PASSWORD }} | |
| POSTGRES_DB: ${{ secrets.DATABASE_NAME }}_test | |
| POSTGRES_USER: ${{ secrets.DATABASE_USERNAME }} | |
| ports: | |
| - 5432:5432 | |
| options: >- | |
| --health-cmd pg_isready | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Pulling Code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Update pip | |
| run: python -m pip install --upgrade pip | |
| - name: Install dependencies | |
| run: pip install -r requirements.txt | |
| - name: Wait for PostgreSQL | |
| run: | | |
| until pg_isready -h localhost -p 5432; do | |
| echo 'waiting for postgres...' | |
| sleep 1 | |
| done | |
| env: | |
| PGPASSWORD: ${{ secrets.DATABASE_PASSWORD }} | |
| - name: Create test database | |
| run: | | |
| psql -h localhost -U postgres -d postgres -c "CREATE DATABASE ${{ secrets.DATABASE_NAME }}_test;" | |
| env: | |
| PGPASSWORD: ${{ secrets.DATABASE_PASSWORD }} | |
| - name: Run tests | |
| run: pytest | |