2021-03-25 17:53:54 +01:00
|
|
|
#!/usr/bin/env bash
|
2022-04-12 12:50:11 +02:00
|
|
|
# this script is run by GitHub Actions in a plain `focal` container; it
|
|
|
|
# - installs the minimal system requirements, and poetry;
|
|
|
|
# - patches the project definition file to refer to old versions only;
|
|
|
|
# - creates a venv with these old versions using poetry; and finally
|
|
|
|
# - invokes `trial` to run the tests with old deps.
|
2020-02-10 01:41:20 +01:00
|
|
|
|
|
|
|
set -ex
|
|
|
|
|
2021-01-25 20:22:35 +01:00
|
|
|
# Prevent virtualenv from auto-updating pip to an incompatible version
|
|
|
|
export VIRTUALENV_NO_DOWNLOAD=1
|
|
|
|
|
2022-04-12 12:50:11 +02:00
|
|
|
# TODO: in the future, we could use an implementation of
|
|
|
|
# https://github.com/python-poetry/poetry/issues/3527
|
|
|
|
# https://github.com/pypa/pip/issues/8085
|
|
|
|
# to select the lowest possible versions, rather than resorting to this sed script.
|
|
|
|
|
|
|
|
# Patch the project definitions in-place:
|
|
|
|
# - Replace all lower and tilde bounds with exact bounds
|
2022-06-17 20:07:04 +02:00
|
|
|
# - Replace all caret bounds---but not the one that defines the supported Python version!
|
2022-04-12 12:50:11 +02:00
|
|
|
# - Delete all lines referring to psycopg2 --- so no testing of postgres support.
|
2022-06-17 20:07:04 +02:00
|
|
|
# - Use pyopenssl 17.0, which is the oldest version that works with
|
|
|
|
# a `cryptography` compiled against OpenSSL 1.1.
|
2022-04-12 12:50:11 +02:00
|
|
|
# - Omit systemd: we're not logging to journal here.
|
|
|
|
|
|
|
|
sed -i \
|
|
|
|
-e "s/[~>]=/==/g" \
|
2022-06-17 20:07:04 +02:00
|
|
|
-e '/^python = "^/!s/\^/==/g' \
|
2022-04-12 12:50:11 +02:00
|
|
|
-e "/psycopg2/d" \
|
|
|
|
-e 's/pyOpenSSL = "==16.0.0"/pyOpenSSL = "==17.0.0"/' \
|
|
|
|
-e '/systemd/d' \
|
|
|
|
pyproject.toml
|
|
|
|
|
|
|
|
# Use poetry to do the installation. This ensures that the versions are all mutually
|
|
|
|
# compatible (as far the package metadata declares, anyway); pip's package resolver
|
|
|
|
# is more lax.
|
|
|
|
#
|
|
|
|
# Rather than `poetry install --no-dev`, we drop all dev dependencies from the
|
|
|
|
# toml file. This means we don't have to ensure compatibility between old deps and
|
|
|
|
# dev tools.
|
|
|
|
|
2022-09-06 13:43:04 +02:00
|
|
|
pip install toml wheel
|
2022-04-12 12:50:11 +02:00
|
|
|
|
|
|
|
REMOVE_DEV_DEPENDENCIES="
|
|
|
|
import toml
|
|
|
|
with open('pyproject.toml', 'r') as f:
|
|
|
|
data = toml.loads(f.read())
|
|
|
|
|
|
|
|
del data['tool']['poetry']['dev-dependencies']
|
|
|
|
|
|
|
|
with open('pyproject.toml', 'w') as f:
|
|
|
|
toml.dump(data, f)
|
|
|
|
"
|
|
|
|
python3 -c "$REMOVE_DEV_DEPENDENCIES"
|
|
|
|
|
2022-09-06 13:43:04 +02:00
|
|
|
pip install poetry==1.2.0
|
|
|
|
poetry lock
|
2022-04-12 12:50:11 +02:00
|
|
|
|
|
|
|
echo "::group::Patched pyproject.toml"
|
|
|
|
cat pyproject.toml
|
|
|
|
echo "::endgroup::"
|
|
|
|
echo "::group::Lockfile after patch"
|
|
|
|
cat poetry.lock
|
|
|
|
echo "::endgroup::"
|