Merge pull request #87 from iplweb/dependabot/uv/pip-26.0 #329
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: Tests | |
| on: | |
| push: | |
| branches: | |
| - dev | |
| - master | |
| - feature/* | |
| pull_request: | |
| branches: | |
| - dev | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| # Skip this job if it's a "Merge tag" commit on the dev branch | |
| if: | | |
| !(github.ref == 'refs/heads/dev' && contains(github.event.head_commit.message, 'Merge tag')) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 # Add job-level timeout | |
| continue-on-error: ${{ matrix.python-version == '3.14' }} | |
| strategy: | |
| max-parallel: 4 | |
| matrix: | |
| python-version: ["3.12", "3.14"] | |
| services: | |
| redis: | |
| image: redis | |
| ports: | |
| - 6379:6379 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| postgres: | |
| image: iplweb/bpp_dbserver:latest | |
| env: | |
| POSTGRES_DB: postgres | |
| POSTGRES_PASSWORD: password | |
| POSTGRES_USER: postgres | |
| ports: | |
| - 5433:5432 | |
| # Set health checks to wait until postgres has started | |
| options: >- | |
| --health-cmd "pg_isready --username=postgres" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache APT packages | |
| uses: actions/cache@v4 | |
| with: | |
| path: /var/cache/apt/archives | |
| key: ${{ runner.os }}-apt-${{ hashFiles('.github/workflows/tests.yml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-apt- | |
| - name: Cache Playwright browsers | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/ms-playwright | |
| key: ${{ runner.os }}-playwright-${{ hashFiles('**/uv.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-playwright- | |
| - name: Cache Yarn dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/yarn | |
| node_modules | |
| key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock', '**/package.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-yarn- | |
| - name: Cache UV dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cache/uv | |
| ~/.local/share/uv | |
| .venv | |
| key: ${{ runner.os }}-uv-with-playwright-${{ hashFiles('**/uv.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-uv-with-playwright- | |
| ${{ runner.os }}-uv- | |
| - name: System setup and dependencies | |
| timeout-minutes: 10 | |
| run: | | |
| set -e # Exit on any error | |
| uname -a | |
| sudo apt update | |
| sudo apt install software-properties-common gettext libldap2-dev libsasl2-dev libcairo2-dev | |
| curl -fsSL https://deb.nodesource.com/setup_current.x | sudo bash - | |
| sudo apt install -y libpq-dev nodejs redis-tools | |
| sudo npm install -g --force yarn grunt-cli | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: "uv.lock" | |
| - name: Install Python ${{ matrix.python-version }} | |
| timeout-minutes: 10 | |
| run: | | |
| uv python install ${{ matrix.python-version }} | |
| uv python pin ${{ matrix.python-version }} | |
| - name: Install Python deps via uv | |
| timeout-minutes: 10 | |
| run: | | |
| uv sync --all-extras | |
| - name: Build assets (yarn, collectstatic) | |
| timeout-minutes: 10 | |
| env: | |
| DJANGO_BPP_DB_HOST: 127.0.0.1 | |
| DJANGO_BPP_DB_PORT: 5433 | |
| DJANGO_BPP_DB_USER: postgres | |
| run: | | |
| uv run make assets | |
| - name: playwright install chromium | |
| timeout-minutes: 10 | |
| env: | |
| DJANGO_BPP_DB_HOST: 127.0.0.1 | |
| DJANGO_BPP_DB_PORT: 5433 | |
| DJANGO_BPP_DB_USER: postgres | |
| run: | | |
| uv run playwright install chromium | |
| - name: Wait for services | |
| timeout-minutes: 2 | |
| run: | | |
| # Wait for PostgreSQL to be ready | |
| until pg_isready -h 127.0.0.1 -p 5433 -U postgres; do | |
| echo "Waiting for PostgreSQL..." | |
| sleep 2 | |
| done | |
| # Wait for Redis to be ready | |
| until redis-cli -h 127.0.0.1 -p 6379 ping; do | |
| echo "Waiting for Redis..." | |
| sleep 2 | |
| done | |
| - name: Tests (without Playwright) | |
| timeout-minutes: 20 | |
| env: | |
| DJANGO_BPP_DB_HOST: 127.0.0.1 | |
| DJANGO_BPP_DB_PORT: 5433 | |
| DJANGO_BPP_DB_USER: postgres | |
| run: | | |
| uv run pytest -m "not playwright" -n auto --cov=src/ --cov-branch --cov-report=xml:cov.xml | |
| - name: Tests (Playwright) | |
| timeout-minutes: 20 | |
| env: | |
| DJANGO_BPP_DB_HOST: 127.0.0.1 | |
| DJANGO_BPP_DB_PORT: 5433 | |
| DJANGO_BPP_DB_USER: postgres | |
| run: | | |
| uv run pytest -m "playwright" -n auto --cov=src/ --cov-branch --cov-append --cov-report=xml:cov.xml | |
| - name: Upload coverage to Coveralls (parallel) | |
| if: always() | |
| uses: coverallsapp/github-action@v2 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| flag-name: tests | |
| parallel: true | |
| file: cov.xml |