Skip to content

Commit 54f9a33

Browse files
reivilibresquahtx
authored andcommitted
Enable Complement CI tests in the 'latest deps' test run. (matrix-org#13213)
Co-authored-by: Sean Quah <[email protected]>
1 parent 20a4dc9 commit 54f9a33

File tree

4 files changed

+58
-5
lines changed

4 files changed

+58
-5
lines changed

.github/workflows/latest_deps.yml

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,42 @@ jobs:
135135
/logs/**/*.log*
136136
137137
138-
# TODO: run complement (as with twisted trunk, see #12473).
138+
complement:
139+
if: "${{ !failure() && !cancelled() }}"
140+
runs-on: ubuntu-latest
141+
142+
strategy:
143+
fail-fast: false
144+
matrix:
145+
include:
146+
- arrangement: monolith
147+
database: SQLite
148+
149+
- arrangement: monolith
150+
database: Postgres
151+
152+
- arrangement: workers
153+
database: Postgres
154+
155+
steps:
156+
- name: Run actions/checkout@v2 for synapse
157+
uses: actions/checkout@v2
158+
with:
159+
path: synapse
160+
161+
- name: Prepare Complement's Prerequisites
162+
run: synapse/.ci/scripts/setup_complement_prerequisites.sh
163+
164+
- run: |
165+
set -o pipefail
166+
TEST_ONLY_IGNORE_POETRY_LOCKFILE=1 POSTGRES=${{ (matrix.database == 'Postgres') && 1 || '' }} WORKERS=${{ (matrix.arrangement == 'workers') && 1 || '' }} COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh -json 2>&1 | gotestfmt
167+
shell: bash
168+
name: Run Complement Tests
139169
140-
# open an issue if the build fails, so we know about it.
170+
# Open an issue if the build fails, so we know about it.
171+
# Only do this if we're not experimenting with this action in a PR.
141172
open-issue:
142-
if: failure()
173+
if: "failure() && github.event_name != 'push' && github.event_name != 'pull_request'"
143174
needs:
144175
# TODO: should mypy be included here? It feels more brittle than the other two.
145176
- mypy

changelog.d/13213.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Enable Complement CI tests in the 'latest deps' test run.

docker/Dockerfile

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,18 @@ COPY pyproject.toml poetry.lock /synapse/
6868
# reason, such as when a git repository is used directly as a dependency.
6969
ARG TEST_ONLY_SKIP_DEP_HASH_VERIFICATION
7070

71-
RUN /root/.local/bin/poetry export --extras all -o /synapse/requirements.txt ${TEST_ONLY_SKIP_DEP_HASH_VERIFICATION:+--without-hashes}
71+
# If specified, we won't use the Poetry lockfile.
72+
# Instead, we'll just install what a regular `pip install` would from PyPI.
73+
ARG TEST_ONLY_IGNORE_POETRY_LOCKFILE
74+
75+
# Export the dependencies, but only if we're actually going to use the Poetry lockfile.
76+
# Otherwise, just create an empty requirements file so that the Dockerfile can
77+
# proceed.
78+
RUN if [ -z "$TEST_ONLY_IGNORE_POETRY_LOCKFILE" ]; then \
79+
/root/.local/bin/poetry export --extras all -o /synapse/requirements.txt ${TEST_ONLY_SKIP_DEP_HASH_VERIFICATION:+--without-hashes}; \
80+
else \
81+
touch /synapse/requirements.txt; \
82+
fi
7283

7384
###
7485
### Stage 1: builder
@@ -108,8 +119,17 @@ COPY synapse /synapse/synapse/
108119
# ... and what we need to `pip install`.
109120
COPY pyproject.toml README.rst /synapse/
110121

122+
# Repeat of earlier build argument declaration, as this is a new build stage.
123+
ARG TEST_ONLY_IGNORE_POETRY_LOCKFILE
124+
111125
# Install the synapse package itself.
112-
RUN pip install --prefix="/install" --no-deps --no-warn-script-location /synapse
126+
# If we have populated requirements.txt, we don't install any dependencies
127+
# as we should already have those from the previous `pip install` step.
128+
RUN if [ -z "$TEST_ONLY_IGNORE_POETRY_LOCKFILE" ]; then \
129+
pip install --prefix="/install" --no-deps --no-warn-script-location /synapse[all]; \
130+
else \
131+
pip install --prefix="/install" --no-warn-script-location /synapse[all]; \
132+
fi
113133

114134
###
115135
### Stage 2: runtime

scripts-dev/complement.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ if [ -z "$skip_docker_build" ]; then
101101
echo_if_github "::group::Build Docker image: matrixdotorg/synapse"
102102
docker build -t matrixdotorg/synapse \
103103
--build-arg TEST_ONLY_SKIP_DEP_HASH_VERIFICATION \
104+
--build-arg TEST_ONLY_IGNORE_POETRY_LOCKFILE \
104105
-f "docker/Dockerfile" .
105106
echo_if_github "::endgroup::"
106107

0 commit comments

Comments
 (0)