Require mcpyrate 4.3.0, and test on Python 3.15 in CI #153
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
| # This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
| # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
| # | |
| # This version is customized to install with pdm, lint with ruff, and test with unpythonic.test.fixtures. | |
| name: Python package | |
| on: | |
| push: | |
| branches: [ master ] | |
| tags: ["v*"] | |
| pull_request: | |
| branches: [ master ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Set up Python | |
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: "3.14" | |
| - name: Install ruff | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install ruff | |
| - name: Lint with ruff | |
| run: ruff check . --ignore SIM103 | |
| - name: Lint advisories (non-blocking) | |
| run: ruff check . --select SIM103 || true | |
| test: | |
| needs: lint | |
| runs-on: ${{ matrix.os }} | |
| defaults: | |
| run: | |
| shell: bash # so the `tr` in "Determine Python version string for PDM" works on Windows (uses Git Bash) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Full Python/PyPy matrix on Linux; newest CPython plus PyPy on | |
| # macOS and Windows. Rationale: unpythonic is pure Python but | |
| # exercises unusual control-flow machinery (continuations, dynvars, | |
| # TCO, generator tricks), where OS-specific regressions can surface | |
| # independently of Python minor version. PyPy is included on every | |
| # OS because it's a separate interpreter family — the control-flow | |
| # code paths differ from CPython and can have their own quirks. | |
| os: [ubuntu-latest] | |
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14", "3.15", "pypy-3.11"] | |
| include: | |
| - os: macos-latest | |
| python-version: "3.14" | |
| - os: macos-latest | |
| python-version: "pypy-3.11" | |
| - os: windows-latest | |
| python-version: "3.14" | |
| - os: windows-latest | |
| python-version: "pypy-3.11" | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| # 3.15 is at rc1, which the setup-python manifest marks unstable, so a bare | |
| # "3.15" resolves to nothing without this. Versions that have a stable release | |
| # are unaffected — a prerelease is only used when no stable one satisfies the | |
| # request. Becomes a no-op once 3.15 final ships. | |
| allow-prereleases: true | |
| - name: Install tools in CI venv | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install pdm | |
| - name: Create in-project virtualenv and install dependencies | |
| run: | | |
| # Point PDM at the interpreter `setup-python` already installed, rather than | |
| # letting it fetch a second one — its index has no prerelease build, so asking | |
| # for a version like "3.15" fails while that very interpreter is on PATH. This | |
| # also removes the need to translate CI's `pypy-3.11` into PDM's `pypy@3.11`. | |
| # Ask Python for its own path: under Git Bash on Windows, `which python` gives | |
| # an MSYS path that PDM, a native Windows program, cannot resolve. | |
| pdm use -f "$(python -c 'import sys; print(sys.executable)')" | |
| # "When you run pdm install the first time on a new PDM-managed project, whose Python interpreter is not decided yet, | |
| # PDM will create a virtualenv in <project_root>/.venv, and install dependencies into it." | |
| # https://pdm-project.org/en/latest/usage/venv/ | |
| pdm install | |
| - name: Test with unpythonic.test.fixtures | |
| run: pdm run python runtests.py | |
| build-dist: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: "3.14" | |
| - run: pip install build | |
| - run: python -m build | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: dist | |
| path: dist/ | |
| publish: | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: build-dist | |
| runs-on: ubuntu-latest | |
| environment: pypi | |
| permissions: | |
| id-token: write | |
| steps: | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2 | |
| with: | |
| packages-dir: dist/ |