Add submodules: recursive temporarily, for testing #2761
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 | |
| name: Python package | |
| on: [push, pull_request, workflow_dispatch] | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| strategy: | |
| matrix: | |
| os-type: [ubuntu, macos, windows] | |
| python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.13t", "3.14", "3.14t"] | |
| exclude: | |
| - os-type: macos | |
| python-version: "3.7" # Not available for the ARM-based macOS runners. | |
| - os-type: macos | |
| python-version: "3.13t" | |
| - os-type: macos | |
| python-version: "3.14t" | |
| - os-type: windows | |
| python-version: "3.13" # FIXME: Fix and enable Python 3.13 and 3.14 on Windows (#1955). | |
| - os-type: windows | |
| python-version: "3.13t" | |
| - os-type: windows | |
| python-version: "3.14" | |
| - os-type: windows | |
| python-version: "3.14t" | |
| include: | |
| - os-ver: latest | |
| - os-type: ubuntu | |
| python-version: "3.7" | |
| os-ver: "22.04" | |
| - build-docs: true # We ensure documentation builds, except on very old interpreters. | |
| - python-version: "3.7" | |
| build-docs: false | |
| - python-version: "3.8" | |
| build-docs: false | |
| - experimental: false | |
| fail-fast: false | |
| runs-on: ${{ matrix.os-type }}-${{ matrix.os-ver }} | |
| defaults: | |
| run: | |
| shell: bash --noprofile --norc -exo pipefail {0} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| # Temporary, for testing. The standing decision is to NOT pre-clone | |
| # submodules on CI; see https://github.com/gitpython-developers/GitPython/pull/1715 | |
| submodules: recursive | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| allow-prereleases: ${{ matrix.experimental }} | |
| - name: Set up WSL (Windows) | |
| if: matrix.os-type == 'windows' | |
| uses: Vampire/setup-wsl@v6.0.0 | |
| with: | |
| wsl-version: 1 | |
| distribution: Debian | |
| - name: Prepare this repo for tests | |
| run: | | |
| ./init-tests-after-clone.sh | |
| - name: Set git user identity and command aliases for the tests | |
| run: | | |
| git config --global user.email "travis@ci.com" | |
| git config --global user.name "Travis Runner" | |
| # If we rewrite the user's config by accident, we will mess it up | |
| # and cause subsequent tests to fail | |
| cat test/fixtures/.gitconfig >> ~/.gitconfig | |
| - name: Update PyPA packages | |
| run: | | |
| python -m pip install -U pip 'setuptools; python_version<"3.12"' wheel | |
| - name: Install project and test dependencies | |
| run: | | |
| pip install '.[test]' | |
| - name: Show file ownership and safe.directory entries | |
| run: | | |
| echo "==================== File ownership ====================" | |
| for p in \ | |
| "$(pwd)" \ | |
| "$(pwd)/.git" \ | |
| "$(pwd)/git/ext/gitdb" \ | |
| "$(pwd)/git/ext/gitdb/.git" \ | |
| "$(pwd)/git/ext/gitdb/gitdb/ext/smmap" \ | |
| "$(pwd)/git/ext/gitdb/gitdb/ext/smmap/.git" \ | |
| "${HOME:-}" \ | |
| "${HOME:-}/.gitconfig"; do | |
| if [ -n "$p" ]; then | |
| ls -ld -- "$p" 2>/dev/null || echo "(missing: $p)" | |
| fi | |
| done | |
| echo | |
| echo "==================== safe.directory entries ====================" | |
| git config --global --get-all safe.directory 2>&1 || echo "(none)" | |
| - name: Show version and platform information | |
| run: | | |
| uname -a | |
| command -v git python | |
| git version | |
| python --version | |
| python -c 'import os, sys; print(f"sys.platform={sys.platform!r}, os.name={os.name!r}")' | |
| # For debugging hook tests on native Windows systems that may have WSL. | |
| - name: Show bash.exe candidates (Windows) | |
| if: matrix.os-type == 'windows' | |
| run: | | |
| set +e | |
| bash.exe -c 'printenv WSL_DISTRO_NAME; uname -a' | |
| python -c 'import subprocess; subprocess.run(["bash.exe", "-c", "printenv WSL_DISTRO_NAME; uname -a"])' | |
| continue-on-error: true | |
| - name: Check types with mypy | |
| if: matrix.python-version != '3.7' && matrix.python-version != '3.8' | |
| run: | | |
| mypy --python-version="${PYTHON_VERSION%t}" # Version only, with no "t" for free-threaded. | |
| env: | |
| MYPY_FORCE_COLOR: "1" | |
| TERM: "xterm-256color" # For color: https://github.com/python/mypy/issues/13817 | |
| PYTHON_VERSION: ${{ matrix.python-version }} | |
| - name: Test with pytest | |
| run: | | |
| pytest --color=yes -p no:sugar --instafail -vv | |
| continue-on-error: false | |
| - name: Documentation | |
| if: matrix.build-docs | |
| run: | | |
| pip install '.[doc]' | |
| make -C doc html |