Skip to content

Test native Windows on CI #1246

Test native Windows on CI

Test native Windows on CI #1246

Workflow file for this run

# 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:
build:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "windows-latest"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
include:
- experimental: false
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash --noprofile --norc -exo pipefail {0}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: ${{ matrix.experimental }}
- name: Set up WSL
if: startsWith(matrix.os, 'windows')
uses: Vampire/[email protected]
with:
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 "[email protected]"
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: |
# Get the latest pip, wheel, and prior to Python 3.12, setuptools.
python -m pip install -U pip $(pip freeze --all | grep -oF setuptools) wheel
- name: Install project and test dependencies
run: |
pip install ".[test]"
- name: Show version and platform information
run: |
uname -a
command -v git python
git version
python --version
python -c 'import sys; print(sys.platform)'
python -c 'import os; print(os.name)'
python -c 'import git; print(git.compat.is_win)' # NOTE: Deprecated. Use os.name directly.
# For debugging hook tests on native Windows systems that may have WSL.
- name: Show where bash.exe may be found
if: startsWith(matrix.os, 'windows')
run: |
set +e
type -a bash.exe
python -c 'import shutil; print(shutil.which("bash.exe"))'
bash.exe --version
python -c 'import subprocess; p = subprocess.run(["bash.exe", "--version"]); print(f"result: {p!r}")'
bash.exe -c 'echo "$BASH"'
python -c 'import subprocess; p = subprocess.run(["bash.exe", "-c", """echo "$BASH" """]); print(f"result: {p!r}")'
bash.exe -c 'echo "$BASH_VERSION"'
python -c 'import subprocess; p = subprocess.run(["bash.exe", "-c", """echo "$BASH_VERSION" """]); print(f"result: {p!r}")'
bash.exe -c 'printenv WSL_DISTRO_NAME'
python -c 'import subprocess; p = subprocess.run(["bash.exe", "-c", "printenv WSL_DISTRO_NAME"]); print(f"result: {p!r}")'
bash.exe -c 'ls -l /proc/sys/fs/binfmt_misc/WSLInterop'
python -c 'import subprocess; p = subprocess.run(["bash.exe", "-c", "ls -l /proc/sys/fs/binfmt_misc/WSLInterop"]); print(f"result: {p!r}")'
bash.exe -c 'uname -a'
python -c 'import subprocess; p = subprocess.run(["bash.exe", "-c", "uname -a"]); print(f"result: {p!r}")'
continue-on-error: true
- name: Check types with mypy
run: |
mypy -p git
# With new versions of mypy new issues might arise. This is a problem if there is nobody able to fix them,
# so we have to ignore errors until that changes.
continue-on-error: true
- name: Test with pytest
run: |
pytest --color=yes -p no:sugar --instafail -vv
continue-on-error: false
- name: Documentation
run: |
pip install -r doc/requirements.txt
make -C doc html