prepare_old_deps.sh 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/usr/bin/env bash
  2. # this script is run by GitHub Actions in a plain `focal` container; it
  3. # - installs the minimal system requirements, and poetry;
  4. # - patches the project definition file to refer to old versions only;
  5. # - creates a venv with these old versions using poetry; and finally
  6. # - invokes `trial` to run the tests with old deps.
  7. set -ex
  8. # Prevent virtualenv from auto-updating pip to an incompatible version
  9. export VIRTUALENV_NO_DOWNLOAD=1
  10. # TODO: in the future, we could use an implementation of
  11. # https://github.com/python-poetry/poetry/issues/3527
  12. # https://github.com/pypa/pip/issues/8085
  13. # to select the lowest possible versions, rather than resorting to this sed script.
  14. # Patch the project definitions in-place:
  15. # - Replace all lower and tilde bounds with exact bounds
  16. # - Replace all caret bounds---but not the one that defines the supported Python version!
  17. # - Delete all lines referring to psycopg2 --- so no testing of postgres support.
  18. # - Use pyopenssl 17.0, which is the oldest version that works with
  19. # a `cryptography` compiled against OpenSSL 1.1.
  20. # - Omit systemd: we're not logging to journal here.
  21. sed -i \
  22. -e "s/[~>]=/==/g" \
  23. -e '/^python = "^/!s/\^/==/g' \
  24. -e "/psycopg2/d" \
  25. -e 's/pyOpenSSL = "==16.0.0"/pyOpenSSL = "==17.0.0"/' \
  26. -e '/systemd/d' \
  27. pyproject.toml
  28. echo "::group::Patched pyproject.toml"
  29. cat pyproject.toml
  30. echo "::endgroup::"