Skip to content

Fix various version-related CI breakages #1987

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jan 2, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/alpine-test.yml
Original file line number Diff line number Diff line change
@@ -16,10 +16,10 @@ jobs:
steps:
- name: Prepare Alpine Linux
run: |
apk add sudo git git-daemon python3 py3-pip
apk add sudo git git-daemon python3 py3-pip py3-virtualenv
echo 'Defaults env_keep += "CI GITHUB_* RUNNER_*"' >/etc/sudoers.d/ci_env
addgroup -g 127 docker
adduser -D -u 1001 runner
adduser -D -u 1001 runner # TODO: Check if this still works on GHA as intended.
adduser runner docker
shell: sh -exo pipefail {0} # Run this as root, not the "runner" user.

@@ -47,20 +47,21 @@ jobs:
- name: Set up virtualenv
run: |
python -m venv .venv
. .venv/bin/activate
printf '%s=%s\n' 'PATH' "$PATH" 'VIRTUAL_ENV' "$VIRTUAL_ENV" >>"$GITHUB_ENV"
- name: Update PyPA packages
run: |
# Get the latest pip, wheel, and prior to Python 3.12, setuptools.
. .venv/bin/activate
python -m pip install -U pip $(pip freeze --all | grep -ow ^setuptools) wheel
- name: Install project and test dependencies
run: |
. .venv/bin/activate
pip install ".[test]"
- name: Show version and platform information
run: |
. .venv/bin/activate
uname -a
command -v git python
git version
@@ -69,4 +70,5 @@ jobs:
- name: Test with pytest
run: |
. .venv/bin/activate
pytest --color=yes -p no:sugar --instafail -vv
6 changes: 3 additions & 3 deletions .github/workflows/cygwin-test.yml
Original file line number Diff line number Diff line change
@@ -55,10 +55,10 @@ jobs:
# and cause subsequent tests to fail
cat test/fixtures/.gitconfig >> ~/.gitconfig
- name: Ensure the "pip" command is available
- name: Set up virtualenv
run: |
# This is used unless, and before, an updated pip is installed.
ln -s pip3 /usr/bin/pip
python -m venv .venv
echo 'BASH_ENV=.venv/bin/activate' >>"$GITHUB_ENV"
- name: Update PyPA packages
run: |
18 changes: 11 additions & 7 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
@@ -11,15 +11,19 @@ permissions:
jobs:
build:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-22.04", "macos-latest", "windows-latest"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
exclude:
- os: "macos-latest"
python-version: "3.7"
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
include:
- experimental: false
- os: ubuntu-22.04
python-version: "3.7"
experimental: false
- os: windows-latest
python-version: "3.7"
experimental: false

fail-fast: false

runs-on: ${{ matrix.os }}

@@ -40,7 +44,7 @@ jobs:

- name: Set up WSL (Windows)
if: startsWith(matrix.os, 'windows')
uses: Vampire/setup-wsl@v3.1.1
uses: Vampire/setup-wsl@v4.0.0
with:
distribution: Alpine
additional-packages: bash
18 changes: 9 additions & 9 deletions test/test_git.py
Original file line number Diff line number Diff line change
@@ -762,14 +762,14 @@ def test_environment(self, rw_dir):
def test_handle_process_output(self):
from git.cmd import handle_process_output, safer_popen

line_count = 5002
count = [None, 0, 0]
expected_line_count = 5002
actual_lines = [None, [], []]

def counter_stdout(line):
count[1] += 1
def stdout_handler(line):
actual_lines[1].append(line)

def counter_stderr(line):
count[2] += 1
def stderr_handler(line):
actual_lines[2].append(line)

cmdline = [
sys.executable,
@@ -784,10 +784,10 @@ def counter_stderr(line):
shell=False,
)

handle_process_output(proc, counter_stdout, counter_stderr, finalize_process)
handle_process_output(proc, stdout_handler, stderr_handler, finalize_process)

self.assertEqual(count[1], line_count)
self.assertEqual(count[2], line_count)
self.assertEqual(len(actual_lines[1]), expected_line_count, repr(actual_lines[1]))
self.assertEqual(len(actual_lines[2]), expected_line_count, repr(actual_lines[2]))

def test_execute_kwargs_set_agrees_with_method(self):
parameter_names = inspect.signature(cmd.Git.execute).parameters.keys()