optimize tests #246
Workflow file for this run
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: Python package test | |
| on: | |
| push: | |
| branches: [main] | |
| paths-ignore: | |
| - "uv.lock" | |
| - "conda/meta.yaml" | |
| - "docs/**" | |
| pull_request: | |
| branches: [main] | |
| paths-ignore: | |
| - "uv.lock" | |
| - "conda/meta.yaml" | |
| schedule: | |
| - cron: '0 8 * * 1,4' | |
| workflow_call: | |
| jobs: | |
| test: | |
| # 🏷️ This keeps the UI clean: Only 4 jobs total | |
| name: "🧪 Python ${{ matrix.python-version }} (Sequential Splits)" | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # uv will handle installing these specific versions inside the GDAL container | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| # We use the latest stable GDAL image as our base environment | |
| container: | |
| image: ghcr.io/osgeo/gdal:ubuntu-full-latest | |
| steps: | |
| - name: ⬇️ Checkout | |
| uses: actions/checkout@v4 | |
| - name: ⚡ Install uv (Binary Copy) | |
| run: | | |
| docker create --name uv-exporter ghcr.io/astral-sh/uv:latest | |
| docker cp uv-exporter:/uv /usr/local/bin/uv | |
| docker cp uv-exporter:/uvx /usr/local/bin/uvx | |
| docker rm uv-exporter | |
| - name: 🏗️ Setup Env | |
| run: | | |
| uv python install ${{ matrix.python-version }} | |
| uv sync --all-extras --python ${{ matrix.python-version }} | |
| uv pip install pytest-split pytest-cov | |
| - name: 🧪 Run Sequential Splits | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| AWS_REQUEST_PAYER: ${{ vars.AWS_REQUEST_PAYER }} | |
| AWS_DEFAULT_REGION: ${{ vars.AWS_DEFAULT_REGION }} | |
| CDSE_S3_ACCESS_KEY: ${{ secrets.CDSE_S3_ACCESS_KEY }} | |
| CDSE_S3_ACCESS_SECRET: ${{ secrets.CDSE_S3_ACCESS_SECRET }} | |
| CURL_CA_BUNDLE: /etc/ssl/certs/ca-certificates.crt | |
| run: | | |
| # Loop through 4 splits to avoid a "Wall of Tests" in the UI | |
| # --cov-append merges coverage data from each split as we go | |
| for i in {1..4}; do | |
| echo "▶️ Running Split $i of 4..." | |
| uv run pytest -v \ | |
| --splits 4 \ | |
| --group $i \ | |
| --cov=mapchete_eo \ | |
| --cov-append \ | |
| --cov-report=xml:coverage.xml \ | |
| --junitxml=pytest-split-$i.xml | |
| done | |
| - name: 📊 Upload to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| file: ./coverage.xml | |
| flags: py${{ matrix.python-version }} |