ci: simplify UV dependency caching in backend workflows #22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Backend Tests | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| jobs: | |
| test-backend: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./backend | |
| services: | |
| postgres: | |
| image: postgres:16 | |
| env: | |
| POSTGRES_USER: postgres | |
| POSTGRES_PASSWORD: postgres | |
| POSTGRES_DB: devbin_test | |
| ports: | |
| - 5433:5432 | |
| options: >- | |
| --health-cmd "pg_isready -U postgres" | |
| --health-interval 5s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.13' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| with: | |
| version: "0.9.18" | |
| enable-cache: true | |
| cache-dependency-glob: "backend/uv.lock" | |
| - name: Install dependencies | |
| run: uv sync --extra test --extra migrations --extra metrics | |
| - name: Run tests | |
| env: | |
| APP_DATABASE_URL: postgresql+asyncpg://postgres:postgres@localhost:5433/devbin_test | |
| APP_BASE_FOLDER_PATH: ./files/devbin_test_files | |
| APP_DEBUG: "true" | |
| APP_CORS_DOMAINS: '["http://test"]' | |
| APP_ALLOW_CORS_WILDCARD: "false" | |
| run: uv run pytest |