Update trial old deps CI to use poetry 1.2.0 (#13707)

This commit is contained in:
Erik Johnston 2022-09-06 12:43:04 +01:00 committed by GitHub
parent b455c2a5ec
commit b5effc7201
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 29 deletions

View file

@ -5,18 +5,8 @@
# - creates a venv with these old versions using poetry; and finally # - creates a venv with these old versions using poetry; and finally
# - invokes `trial` to run the tests with old deps. # - invokes `trial` to run the tests with old deps.
# Prevent tzdata from asking for user input
export DEBIAN_FRONTEND=noninteractive
set -ex set -ex
apt-get update
apt-get install -y \
python3 python3-dev python3-pip python3-venv pipx \
libxml2-dev libxslt-dev xmlsec1 zlib1g-dev libjpeg-dev libwebp-dev
export LANG="C.UTF-8"
# Prevent virtualenv from auto-updating pip to an incompatible version # Prevent virtualenv from auto-updating pip to an incompatible version
export VIRTUALENV_NO_DOWNLOAD=1 export VIRTUALENV_NO_DOWNLOAD=1
@ -33,12 +23,6 @@ export VIRTUALENV_NO_DOWNLOAD=1
# a `cryptography` compiled against OpenSSL 1.1. # a `cryptography` compiled against OpenSSL 1.1.
# - Omit systemd: we're not logging to journal here. # - Omit systemd: we're not logging to journal here.
# TODO: also replace caret bounds, see https://python-poetry.org/docs/dependency-specification/#version-constraints
# We don't use these yet, but IIRC they are the default bound used when you `poetry add`.
# The sed expression 's/\^/==/g' ought to do the trick. But it would also change
# `python = "^3.7"` to `python = "==3.7", which would mean we fail because olddeps
# runs on 3.8 (#12343).
sed -i \ sed -i \
-e "s/[~>]=/==/g" \ -e "s/[~>]=/==/g" \
-e '/^python = "^/!s/\^/==/g' \ -e '/^python = "^/!s/\^/==/g' \
@ -55,7 +39,7 @@ sed -i \
# toml file. This means we don't have to ensure compatibility between old deps and # toml file. This means we don't have to ensure compatibility between old deps and
# dev tools. # dev tools.
pip install --user toml pip install toml wheel
REMOVE_DEV_DEPENDENCIES=" REMOVE_DEV_DEPENDENCIES="
import toml import toml
@ -69,8 +53,8 @@ with open('pyproject.toml', 'w') as f:
" "
python3 -c "$REMOVE_DEV_DEPENDENCIES" python3 -c "$REMOVE_DEV_DEPENDENCIES"
pipx install poetry==1.1.14 pip install poetry==1.2.0
~/.local/bin/poetry lock poetry lock
echo "::group::Patched pyproject.toml" echo "::group::Patched pyproject.toml"
cat pyproject.toml cat pyproject.toml
@ -78,6 +62,3 @@ echo "::endgroup::"
echo "::group::Lockfile after patch" echo "::group::Lockfile after patch"
cat poetry.lock cat poetry.lock
echo "::endgroup::" echo "::endgroup::"
~/.local/bin/poetry install -E "all test"
~/.local/bin/poetry run trial --jobs=2 tests

View file

@ -135,16 +135,47 @@ jobs:
# Note: sqlite only; no postgres # Note: sqlite only; no postgres
if: ${{ !cancelled() && !failure() }} # Allow previous steps to be skipped, but not fail if: ${{ !cancelled() && !failure() }} # Allow previous steps to be skipped, but not fail
needs: linting-done needs: linting-done
runs-on: ubuntu-latest runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Test with old deps
uses: docker://ubuntu:focal # For old python and sqlite # There aren't wheels for some of the older deps, so we need to install
# Note: focal seems to be using 3.8, but the oldest is 3.7? # their build dependencies
# See https://github.com/matrix-org/synapse/issues/12343 - run: |
sudo apt-get -qq install build-essential libffi-dev python-dev \
libxml2-dev libxslt-dev xmlsec1 zlib1g-dev libjpeg-dev libwebp-dev
- uses: actions/setup-python@v4
with: with:
workdir: /github/workspace python-version: '3.7'
entrypoint: .ci/scripts/test_old_deps.sh
# Calculating the old-deps actually takes a bunch of time, so we cache the
# pyproject.toml / poetry.lock. We need to cache pyproject.toml as
# otherwise the `poetry install` step will error due to the poetry.lock
# file being outdated.
#
# This caches the output of `Prepare old deps`, which should generate the
# same `pyproject.toml` and `poetry.lock` for a given `pyproject.toml` input.
- uses: actions/cache@v3
id: cache-poetry-old-deps
name: Cache poetry.lock
with:
path: |
poetry.lock
pyproject.toml
key: poetry-old-deps2-${{ hashFiles('pyproject.toml') }}
- name: Prepare old deps
if: steps.cache-poetry-old-deps.outputs.cache-hit != 'true'
run: .ci/scripts/prepare_old_deps.sh
# We only now install poetry so that `setup-python-poetry` caches the
# right poetry.lock's dependencies.
- uses: matrix-org/setup-python-poetry@v1
with:
python-version: '3.7'
extras: "all test"
- run: poetry run trial -j 2 tests
- name: Dump logs - name: Dump logs
# Logs are most useful when the command fails, always include them. # Logs are most useful when the command fails, always include them.
if: ${{ always() }} if: ${{ always() }}

1
changelog.d/13707.misc Normal file
View file

@ -0,0 +1 @@
Update trial old deps CI to use poetry 1.2.0.