Skip to content

Commit

Permalink
Test changed setup, and Python 3.12, on CI
Browse files Browse the repository at this point in the history
Key changes:

- Update the two CI workflows to install the project and its
  dependencies in accordance with the changed recommendations in
  README.md. (This is to test that those recommendations work,
  which the changed test_installation test case partially but not
  completely tests. The old approach to installation still works
  too, so this change on CI is not required to keep CI working.)

- Add Python 3.12 to the CI test matrix in pythonpackage.yml,
  testing it on Ubuntu. (The Cygwin workflow still tests only 3.9.)

Maintenance changes, made to avoid decreasing readability with the
other changes (and hopefully even increase it somewhat):

- Separate commands into more steps, grouping them by more specific
  purposes.

- Decrease the ways the two workflows differ from each other that
  do not represent actual intended behavioral differences. This is
  to make the important differences easier to stop, and to make it
  easier to determine when the same change has or has not been made
  to both workflows.
  • Loading branch information
EliahKagan committed Sep 10, 2023
1 parent 21c5f87 commit 6b54890
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 19 deletions.
41 changes: 32 additions & 9 deletions .github/workflows/cygwin-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,61 @@ jobs:
SHELLOPTS: igncr
TMP: "/tmp"
TEMP: "/tmp"
defaults:
run:
shell: bash.exe -eo pipefail -o igncr "{0}"

steps:
- name: Force LF line endings
run: git config --global core.autocrlf input

- uses: actions/checkout@v4
with:
fetch-depth: 9999

- uses: cygwin/cygwin-install-action@v4
with:
packages: python39 python39-pip python39-virtualenv git

- name: Show python and git versions
run: |
set -x
/usr/bin/python --version
/usr/bin/git version
- name: Tell git to trust this repo
shell: bash.exe -eo pipefail -o igncr "{0}"
run: |
/usr/bin/git config --global --add safe.directory "$(pwd)"
- name: Install dependencies and prepare tests
shell: bash.exe -eo pipefail -o igncr "{0}"
- name: Prepare this repo for tests
run: |
set -x
/usr/bin/python -m pip install --upgrade pip setuptools wheel
/usr/bin/python --version; /usr/bin/git --version
/usr/bin/git submodule update --init --recursive
/usr/bin/git fetch --tags
/usr/bin/python -m pip install -r requirements.txt
/usr/bin/python -m pip install -r test-requirements.txt
TRAVIS=yes ./init-tests-after-clone.sh
- name: Further prepare git configuration for tests
run: |
set -x
/usr/bin/git config --global user.email "travis@ci.com"
/usr/bin/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: |
set -x
/usr/bin/python -m pip install --upgrade pip setuptools wheel
- name: Install project and test dependencies
run: |
set -x
/usr/bin/python -m pip install ".[test]"
- name: Test with pytest
shell: bash.exe -eo pipefail -o igncr "{0}"
run: |
set -x
/usr/bin/python -m pytest
continue-on-error: false
48 changes: 38 additions & 10 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,70 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
include:
- experimental: false
- python-version: "3.12"
experimental: true

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 9999

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies and prepare tests
allow-prereleases: ${{ matrix.experimental }}

- name: Show python and git versions
run: |
set -x
python --version
git version
- name: Prepare this repo for tests
run: |
set -x
python -m pip install --upgrade pip setuptools wheel
python --version; git --version
git submodule update --init --recursive
git fetch --tags --force
pip install -r requirements.txt
pip install -r test-requirements.txt
TRAVIS=yes ./init-tests-after-clone.sh
- name: Prepare git configuration for tests
run: |
set -x
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: |
set -x
python -m pip install --upgrade pip
if pip freeze --all | grep --quiet '^setuptools=='; then
# Python prior to 3.12 ships setuptools. Upgrade it if present.
python -m pip install --upgrade setuptools
fi
python -m pip install --upgrade wheel
- name: Install project and test dependencies
run: |
set -x
pip install ".[test]"
- name: Check types with mypy
# With new versions of pypi 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
run: |
set -x
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: |
Expand Down

0 comments on commit 6b54890

Please sign in to comment.