release: rename distribution to pure-python-git for PyPI
#7
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] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ci-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| test: | |
| name: pytest (${{ matrix.os }} / py${{ matrix.python-version }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Full matrix on Linux; latest Python only on macOS and Windows to | |
| # keep run time reasonable while still catching platform regressions. | |
| include: | |
| - os: ubuntu-latest | |
| python-version: "3.9" | |
| - os: ubuntu-latest | |
| python-version: "3.10" | |
| - os: ubuntu-latest | |
| python-version: "3.11" | |
| - os: ubuntu-latest | |
| python-version: "3.12" | |
| - os: ubuntu-latest | |
| python-version: "3.13" | |
| - os: macos-latest | |
| python-version: "3.13" | |
| - os: windows-latest | |
| python-version: "3.13" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| - name: Show git version (used by interop tests) | |
| shell: bash | |
| run: git --version | |
| - name: Install package + test deps | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install -e ".[test]" | |
| - name: Configure global git identity (some tests shell out to real git) | |
| shell: bash | |
| run: | | |
| git config --global user.name "ci" | |
| git config --global user.email "ci@example.invalid" | |
| git config --global init.defaultBranch main | |
| - name: Run pytest | |
| run: python -m pytest -v --color=yes | |
| - name: Verify `pygit` entry point works | |
| shell: bash | |
| run: | | |
| pygit --version | |
| pygit help | head -5 | |
| - name: Verify `git` is NOT installed by default | |
| shell: bash | |
| run: | | |
| scripts_dir=$(python -c "import sysconfig; print(sysconfig.get_path('scripts'))") | |
| if [[ "${{ runner.os }}" == "Windows" ]]; then | |
| [ ! -f "$scripts_dir/git.exe" ] || (echo "unexpected git.exe in $scripts_dir"; exit 1) | |
| else | |
| [ ! -f "$scripts_dir/git" ] || (echo "unexpected git in $scripts_dir"; exit 1) | |
| fi | |
| - name: Verify opt-in via `pygit install-git-shim` | |
| shell: bash | |
| run: | | |
| pygit install-git-shim | |
| scripts_dir=$(python -c "import sysconfig; print(sysconfig.get_path('scripts'))") | |
| if [[ "${{ runner.os }}" == "Windows" ]]; then | |
| shim="$scripts_dir/git.exe" | |
| else | |
| shim="$scripts_dir/git" | |
| fi | |
| "$shim" --version | grep -q "pygit version" | |
| "$shim" help | grep -q "init" | |
| pygit uninstall-git-shim | |
| [ ! -f "$shim" ] || (echo "uninstall left $shim behind"; exit 1) | |
| - name: Verify opt-in via `pip install "pure-python-git[git]"` extra | |
| shell: bash | |
| run: | | |
| # Install the sibling shim package from this repo, then re-install | |
| # pythongit with the [git] extra. The extra references | |
| # pure-python-git-shim, which should now resolve locally. | |
| python -m pip install ./pure-python-git-shim | |
| scripts_dir=$(python -c "import sysconfig; print(sysconfig.get_path('scripts'))") | |
| if [[ "${{ runner.os }}" == "Windows" ]]; then | |
| shim="$scripts_dir/git.exe" | |
| else | |
| shim="$scripts_dir/git" | |
| fi | |
| [ -f "$shim" ] || (echo "git shim not installed by the shim wheel"; exit 1) | |
| "$shim" --version | grep -q "pygit version" | |
| # Clean up so the test step (which does not want this extra installed) | |
| # ends back in the default state. | |
| python -m pip uninstall -y pure-python-git-shim | |
| [ ! -f "$shim" ] || (echo "pip uninstall left $shim behind"; exit 1) | |
| build: | |
| name: build wheel + sdist | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| cache: pip | |
| - name: Install build tools | |
| run: python -m pip install --upgrade build twine | |
| - name: Build pythongit (main package) | |
| run: python -m build | |
| - name: Build pure-python-git-shim (companion package) | |
| run: python -m build pure-python-git-shim --outdir dist | |
| - name: twine check both distributions | |
| run: python -m twine check dist/* | |
| - name: Smoke-install — default (no `git` shim) | |
| run: | | |
| python -m venv /tmp/install-venv | |
| /tmp/install-venv/bin/pip install dist/pure_python_git-*.whl | |
| /tmp/install-venv/bin/pygit --version | |
| # `git` must NOT be installed by default. | |
| [ ! -f /tmp/install-venv/bin/git ] || (echo "unexpected git in /tmp/install-venv/bin"; exit 1) | |
| - name: Smoke-install — `pure-python-git[git]` extra | |
| run: | | |
| python -m venv /tmp/install-extra-venv | |
| # Install both wheels so the extra resolves against local artifacts. | |
| /tmp/install-extra-venv/bin/pip install dist/pure_python_git_shim-*.whl dist/pure_python_git-*.whl | |
| /tmp/install-extra-venv/bin/pygit --version | |
| /tmp/install-extra-venv/bin/git --version | grep -q "pygit version" | |
| /tmp/install-extra-venv/bin/pip uninstall -y pure-python-git-shim | |
| [ ! -f /tmp/install-extra-venv/bin/git ] || (echo "uninstall failed"; exit 1) | |
| - name: Smoke-install — `pygit install-git-shim` post-install path | |
| run: | | |
| python -m venv /tmp/install-postvenv | |
| /tmp/install-postvenv/bin/pip install dist/pure_python_git-*.whl | |
| /tmp/install-postvenv/bin/pygit install-git-shim | |
| /tmp/install-postvenv/bin/git --version | grep -q "pygit version" | |
| /tmp/install-postvenv/bin/pygit uninstall-git-shim | |
| [ ! -f /tmp/install-postvenv/bin/git ] || (echo "uninstall failed"; exit 1) | |
| - name: Upload distribution artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| if-no-files-found: error | |
| lint: | |
| name: syntax + import sanity | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.13" | |
| - name: Bytecode-compile every module | |
| run: python -m compileall -q pythongit tests | |
| - name: Import smoke test | |
| run: | | |
| python -c " | |
| from pythongit import cli | |
| from pythongit.cli import _COMMANDS | |
| assert len(_COMMANDS) >= 150, f'expected >=150 commands, got {len(_COMMANDS)}' | |
| print(f'OK: {len(_COMMANDS)} commands registered') | |
| " |