fix: pylong #14
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: Test | |
| on: | |
| push: | |
| branches: [ main, master, develop ] | |
| pull_request: | |
| branches: [ main, master, develop ] | |
| workflow_dispatch: | |
| workflow_call: | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: python:3.12-bookworm | |
| env: | |
| UV_LINK_MODE: copy | |
| CCACHE_DIR: /github/home/.cache/ccache | |
| permissions: | |
| contents: read | |
| checks: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Add Debian sid repository | |
| run: | | |
| echo "deb http://deb.debian.org/debian sid main" >> /etc/apt/sources.list.d/sid.list | |
| echo 'Package: *\nPin: release a=sid\nPin-Priority: 100' > /etc/apt/preferences.d/sid | |
| - name: Install system dependencies | |
| run: | | |
| apt-get update | |
| apt-get install -y build-essential pkg-config libbz2-dev ccache | |
| apt-get install -y -t sid libmapnik-dev fonts-noto-cjk | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| enable-cache: true | |
| cache-dependency-glob: | | |
| uv.lock | |
| pyproject.toml | |
| - name: Cache ccache | |
| uses: actions/cache@v4 | |
| with: | |
| path: /github/home/.cache/ccache | |
| key: ccache-${{ runner.os }}-${{ hashFiles('src/**', 'setup.py', 'pyproject.toml') }} | |
| restore-keys: | | |
| ccache-${{ runner.os }}- | |
| - name: Install Python dependencies and build package | |
| run: | | |
| # Use lockfile when present; avoid doing two full syncs (which can rebuild twice). | |
| if [ -f uv.lock ]; then | |
| uv sync --extra test --frozen --verbose | |
| else | |
| uv sync --extra test --verbose | |
| fi | |
| - name: Run tests with coverage | |
| run: | | |
| uv run pytest test/python_tests -v \ | |
| --cov=mapnik \ | |
| --cov-report=term \ | |
| --cov-report=xml:coverage.xml \ | |
| --cov-report=html:htmlcov \ | |
| --junitxml=junit.xml | |
| - name: Upload coverage reports | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: coverage-reports | |
| path: | | |
| coverage.xml | |
| htmlcov/ | |
| junit.xml | |
| retention-days: 30 | |
| - name: Publish test results | |
| uses: EnricoMi/publish-unit-test-result-action@v2 | |
| if: always() | |
| with: | |
| files: junit.xml | |
| check_name: Test Results | |
| comment_mode: off | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| if: always() | |
| with: | |
| files: ./coverage.xml | |
| flags: unittests | |
| name: python-mapnik-coverage | |
| fail_ci_if_error: false |