switch to UV #513
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: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '*' | |
| pull_request: | |
| env: | |
| LATEST_PY_VERSION: '3.14' | |
| jobs: | |
| tests: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.11', '3.12', '3.13', '3.14'] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "0.9.*" | |
| enable-cache: true | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| uv sync | |
| - name: Run pre-commit | |
| if: ${{ matrix.python-version == env.LATEST_PY_VERSION }} | |
| run: | | |
| uv run pre-commit run --all-files | |
| - name: Run tests | |
| run: uv run pytest --cov morecantile --cov-report term-missing --cov-report xml | |
| - name: Upload Results | |
| if: ${{ matrix.python-version == env.LATEST_PY_VERSION }} | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| files: ./coverage.xml | |
| flags: unittests | |
| fail_ci_if_error: false | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| # We need two set of tests because rasterio wheels are not availble for python 3.14 yet | |
| tests-rasterio: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.11', '3.12', '3.13'] | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "0.9.*" | |
| enable-cache: true | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| uv sync --extra rasterio | |
| - name: Run tests | |
| run: uv run pytest --cov morecantile --cov-report term-missing --cov-report xml | |
| benchmark: | |
| needs: [tests, tests-rasterio] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "0.9.*" | |
| enable-cache: true | |
| python-version: ${{ env.LATEST_PY_VERSION }} | |
| - name: Install dependencies | |
| run: | | |
| uv sync --group benchmark | |
| - name: Run Benchmark | |
| run: | | |
| uv run pytest tests/benchmarks.py --benchmark-only --benchmark-columns 'min, max, mean, median' --benchmark-sort 'min' --benchmark-json output.json | |
| - name: Store and Compare benchmark result | |
| uses: benchmark-action/github-action-benchmark@v1 | |
| with: | |
| name: morecantile Benchmarks | |
| tool: 'pytest' | |
| output-file-path: output.json | |
| alert-threshold: '150%' | |
| comment-on-alert: true | |
| fail-on-alert: false | |
| # GitHub API token to make a commit comment | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| gh-pages-branch: 'gh-benchmarks' | |
| # Make a commit on `gh-pages` only if main | |
| auto-push: ${{ github.ref == 'refs/heads/main' }} | |
| benchmark-data-dir-path: dev/benchmarks | |
| publish: | |
| needs: [tests, tests-rasterio] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "0.9.*" | |
| enable-cache: true | |
| python-version: ${{ env.LATEST_PY_VERSION }} | |
| - name: Install dependencies | |
| run: | | |
| uv sync --group deploy | |
| - name: Set tag version | |
| id: tag | |
| run: | | |
| echo "version=${GITHUB_REF#refs/*/}" | |
| echo "version=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | |
| - name: Set module version | |
| id: module | |
| run: | | |
| echo "version=$(uv run hatch --quiet version)" >> $GITHUB_OUTPUT | |
| - name: Build and publish | |
| if: ${{ steps.tag.outputs.version }} == ${{ steps.module.outputs.version}} | |
| env: | |
| HATCH_INDEX_USER: ${{ secrets.PYPI_USERNAME }} | |
| HATCH_INDEX_AUTH: ${{ secrets.PYPI_PASSWORD }} | |
| run: | | |
| uv run hatch build | |
| uv run hatch publish |