Revamp #20
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 every pull request, but only on push to main | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - "*" | |
| pull_request: | |
| env: | |
| LATEST_PY_VERSION: "3.13" | |
| jobs: | |
| lint-python: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install a specific version of uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| version: "latest" | |
| # Ensure docs build without warnings | |
| # - name: Check docs | |
| # run: uv run --group docs mkdocs build --strict | |
| # Use ruff-action so we get annotations in the Github UI | |
| - uses: astral-sh/ruff-action@v3 | |
| pytest: | |
| name: Pytest | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.11", "3.12", "3.13", "3.14"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install a specific version of uv | |
| uses: astral-sh/setup-uv@v6 | |
| with: | |
| version: "latest" | |
| - name: Run pytest | |
| run: uv run pytest | |
| publish: | |
| needs: [pytest] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ env.LATEST_PY_VERSION }} | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install flit | |
| python -m pip install . | |
| - name: Set tag version | |
| id: tag | |
| # https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions | |
| run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} | |
| - name: Set module version | |
| id: module | |
| # https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions | |
| run: echo ::set-output name=version::$(python -c 'from importlib.metadata import version; print(version("aiopmtiles"))') | |
| - name: Build and publish | |
| if: steps.tag.outputs.tag == steps.module.outputs.version | |
| env: | |
| FLIT_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
| FLIT_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
| run: flit publish |