Skip to content

Commit 9db70d2

Browse files
committed
Merge branch 'develop' into jason/cap-worker-locks
2 parents e0d2882 + 613cb4d commit 9db70d2

126 files changed

Lines changed: 7012 additions & 1194 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
# Re-usable workflow (https://docs.github.com/en/actions/how-tos/reuse-automations/reuse-workflows)
2+
name: Reusable Complement testing
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
use_latest_deps:
8+
type: boolean
9+
default: false
10+
use_twisted_trunk:
11+
type: boolean
12+
default: false
13+
14+
# Control the permissions granted to `GITHUB_TOKEN`.
15+
permissions:
16+
# `actions/checkout` reads the repository (also see
17+
# https://github.com/actions/checkout/tree/de0fac2e4500dabe0009e67214ff5f5447ce83dd/#recommended-permissions)
18+
contents: read
19+
20+
env:
21+
RUST_VERSION: 1.87.0
22+
23+
jobs:
24+
complement:
25+
runs-on: ubuntu-latest
26+
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
include:
31+
- arrangement: monolith
32+
database: SQLite
33+
34+
- arrangement: monolith
35+
database: Postgres
36+
37+
- arrangement: workers
38+
database: Postgres
39+
40+
steps:
41+
- name: Checkout synapse codebase
42+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
43+
with:
44+
path: synapse
45+
46+
# Log Docker system info for debugging (compare with your local environment) and
47+
# tracking GitHub runner changes over time (can easily compare a run from last
48+
# week with the current one in question).
49+
- run: docker system info
50+
shell: bash
51+
52+
- name: Install Rust
53+
uses: dtolnay/rust-toolchain@e97e2d8cc328f1b50210efc529dca0028893a2d9 # master
54+
with:
55+
toolchain: ${{ env.RUST_VERSION }}
56+
- uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2.9.1
57+
58+
# We use `poetry` in `complement.sh`
59+
- uses: matrix-org/setup-python-poetry@5bbf6603c5c930615ec8a29f1b5d7d258d905aa4 # v2.0.0
60+
with:
61+
poetry-version: "2.2.1"
62+
# Matches the `path` where we checkout Synapse above
63+
working-directory: "synapse"
64+
65+
- name: Prepare Complement's Prerequisites
66+
run: synapse/.ci/scripts/setup_complement_prerequisites.sh
67+
68+
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0
69+
with:
70+
cache-dependency-path: complement/go.sum
71+
go-version-file: complement/go.mod
72+
73+
# This step is specific to the 'Twisted trunk' test run:
74+
- name: Patch dependencies
75+
if: ${{ inputs.use_twisted_trunk }}
76+
run: |
77+
set -x
78+
DEBIAN_FRONTEND=noninteractive sudo apt-get install -yqq python3 pipx
79+
pipx install poetry==2.2.1
80+
81+
poetry remove -n twisted
82+
poetry add -n --extras tls git+https://github.com/twisted/twisted.git#trunk
83+
poetry lock
84+
working-directory: synapse
85+
86+
# Run the image sanity check test first as this is the first thing we want to know
87+
# about (are we actually testing what we expect?) and we don't want to debug
88+
# downstream failures (wild goose chase).
89+
- name: Sanity check Complement image
90+
id: run_sanity_check_complement_image_test
91+
# -p=1: We're using `-p 1` to force the test packages to run serially as GHA boxes
92+
# are underpowered and don't like running tons of Synapse instances at once.
93+
# -json: Output JSON format so that gotestfmt can parse it.
94+
#
95+
# tee /tmp/gotest-complement.log: We tee the output to a file so that we can re-process it
96+
# later on for better formatting with gotestfmt. But we still want the command
97+
# to output to the terminal as it runs so we can see what's happening in
98+
# real-time.
99+
run: |
100+
set -o pipefail
101+
COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh --in-repo -p 1 -json -run 'TestSynapseVersion/Synapse_version_matches_current_git_checkout' 2>&1 | tee /tmp/gotest-sanity-check-complement.log
102+
shell: bash
103+
env:
104+
POSTGRES: ${{ (matrix.database == 'Postgres') && 1 || '' }}
105+
WORKERS: ${{ (matrix.arrangement == 'workers') && 1 || '' }}
106+
107+
- name: Formatted sanity check Complement test logs
108+
# Always run this step if we attempted to run the Complement tests.
109+
if: always() && steps.run_sanity_check_complement_image_test.outcome != 'skipped'
110+
# We do not hide successful tests in `gotestfmt` here as the list of sanity
111+
# check tests is so short. Feel free to change this when we get more tests.
112+
#
113+
# Note that the `-hide` argument is interpreted by `gotestfmt`. From it,
114+
# it derives several values under `$settings` and passes them to our
115+
# custom `.ci/complement_package.gotpl` template to render the output.
116+
run: cat /tmp/gotest-sanity-check-complement.log | gotestfmt -hide "successful-downloads,empty-packages"
117+
118+
- name: Run Complement Tests
119+
id: run_complement_tests
120+
# -p=1: We're using `-p 1` to force the test packages to run serially as GHA boxes
121+
# are underpowered and don't like running tons of Synapse instances at once.
122+
# -json: Output JSON format so that gotestfmt can parse it.
123+
#
124+
# tee /tmp/gotest-complement.log: We tee the output to a file so that we can re-process it
125+
# later on for better formatting with gotestfmt. But we still want the command
126+
# to output to the terminal as it runs so we can see what's happening in
127+
# real-time.
128+
run: |
129+
set -o pipefail
130+
COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh -p 1 -json 2>&1 | tee /tmp/gotest-complement.log
131+
shell: bash
132+
env:
133+
POSTGRES: ${{ (matrix.database == 'Postgres') && 1 || '' }}
134+
WORKERS: ${{ (matrix.arrangement == 'workers') && 1 || '' }}
135+
TEST_ONLY_IGNORE_POETRY_LOCKFILE: ${{ inputs.use_latest_deps && 1 || '' }}
136+
TEST_ONLY_SKIP_DEP_HASH_VERIFICATION: ${{ inputs.use_twisted_trunk && 1 || '' }}
137+
138+
- name: Formatted Complement test logs (only failing are shown)
139+
# Always run this step if we attempted to run the Complement tests.
140+
if: always() && steps.run_complement_tests.outcome != 'skipped'
141+
# Hide successful tests in order to reduce the verbosity of the otherwise very large output.
142+
#
143+
# Note that the `-hide` argument is interpreted by `gotestfmt`. From it,
144+
# it derives several values under `$settings` and passes them to our
145+
# custom `.ci/complement_package.gotpl` template to render the output.
146+
run: cat /tmp/gotest-complement.log | gotestfmt -hide "successful-downloads,successful-tests,empty-packages"
147+
148+
- name: Run in-repo Complement Tests
149+
id: run_in_repo_complement_tests
150+
# -p=1: We're using `-p 1` to force the test packages to run serially as GHA boxes
151+
# are underpowered and don't like running tons of Synapse instances at once.
152+
# -json: Output JSON format so that gotestfmt can parse it.
153+
#
154+
# tee /tmp/gotest-in-repo-complement.log: We tee the output to a file so that we can re-process it
155+
# later on for better formatting with gotestfmt. But we still want the command
156+
# to output to the terminal as it runs so we can see what's happening in
157+
# real-time.
158+
run: |
159+
set -o pipefail
160+
COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh --in-repo -p 1 -json 2>&1 | tee /tmp/gotest-in-repo-complement.log
161+
shell: bash
162+
env:
163+
POSTGRES: ${{ (matrix.database == 'Postgres') && 1 || '' }}
164+
WORKERS: ${{ (matrix.arrangement == 'workers') && 1 || '' }}
165+
TEST_ONLY_IGNORE_POETRY_LOCKFILE: ${{ inputs.use_latest_deps && 1 || '' }}
166+
TEST_ONLY_SKIP_DEP_HASH_VERIFICATION: ${{ inputs.use_twisted_trunk && 1 || '' }}
167+
168+
- name: Formatted in-repo Complement test logs (only failing are shown)
169+
# Always run this step if we attempted to run the Complement tests.
170+
if: always() && steps.run_in_repo_complement_tests.outcome != 'skipped'
171+
# Hide successful tests in order to reduce the verbosity of the otherwise very large output.
172+
#
173+
# Note that the `-hide` argument is interpreted by `gotestfmt`. From it,
174+
# it derives several values under `$settings` and passes them to our
175+
# custom `.ci/complement_package.gotpl` template to render the output.
176+
run: cat /tmp/gotest-in-repo-complement.log | gotestfmt -hide "successful-downloads,successful-tests,empty-packages"

.github/workflows/latest_deps.yml

Lines changed: 3 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -181,84 +181,11 @@ jobs:
181181
/logs/**/*.log*
182182
183183
complement:
184+
uses: ./.github/workflows/complement_tests.yml
184185
needs: check_repo
185186
if: "!failure() && !cancelled() && needs.check_repo.outputs.should_run_workflow == 'true'"
186-
runs-on: ubuntu-latest
187-
188-
strategy:
189-
fail-fast: false
190-
matrix:
191-
include:
192-
- arrangement: monolith
193-
database: SQLite
194-
195-
- arrangement: monolith
196-
database: Postgres
197-
198-
- arrangement: workers
199-
database: Postgres
200-
201-
steps:
202-
- name: Check out synapse codebase
203-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
204-
with:
205-
path: synapse
206-
207-
- name: Prepare Complement's Prerequisites
208-
run: synapse/.ci/scripts/setup_complement_prerequisites.sh
209-
210-
- uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
211-
with:
212-
cache-dependency-path: complement/go.sum
213-
go-version-file: complement/go.mod
214-
215-
- name: Run Complement Tests
216-
id: run_complement_tests
217-
# -p=1: We're using `-p 1` to force the test packages to run serially as GHA boxes
218-
# are underpowered and don't like running tons of Synapse instances at once.
219-
# -json: Output JSON format so that gotestfmt can parse it.
220-
#
221-
# tee /tmp/gotest-complement.log: We tee the output to a file so that we can re-process it
222-
# later on for better formatting with gotestfmt. But we still want the command
223-
# to output to the terminal as it runs so we can see what's happening in
224-
# real-time.
225-
run: |
226-
set -o pipefail
227-
COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh -p 1 -json 2>&1 | tee /tmp/gotest-complement.log
228-
shell: bash
229-
env:
230-
POSTGRES: ${{ (matrix.database == 'Postgres') && 1 || '' }}
231-
WORKERS: ${{ (matrix.arrangement == 'workers') && 1 || '' }}
232-
TEST_ONLY_IGNORE_POETRY_LOCKFILE: 1
233-
234-
- name: Formatted Complement test logs
235-
# Always run this step if we attempted to run the Complement tests.
236-
if: always() && steps.run_complement_tests.outcome != 'skipped'
237-
run: cat /tmp/gotest-complement.log | gotestfmt -hide "successful-downloads,empty-packages"
238-
239-
- name: Run in-repo Complement Tests
240-
id: run_in_repo_complement_tests
241-
# -p=1: We're using `-p 1` to force the test packages to run serially as GHA boxes
242-
# are underpowered and don't like running tons of Synapse instances at once.
243-
# -json: Output JSON format so that gotestfmt can parse it.
244-
#
245-
# tee /tmp/gotest-in-repo-complement.log: We tee the output to a file so that we can re-process it
246-
# later on for better formatting with gotestfmt. But we still want the command
247-
# to output to the terminal as it runs so we can see what's happening in
248-
# real-time.
249-
run: |
250-
set -o pipefail
251-
COMPLEMENT_DIR=`pwd`/complement synapse/scripts-dev/complement.sh --in-repo -p 1 -json 2>&1 | tee /tmp/gotest-in-repo-complement.log
252-
shell: bash
253-
env:
254-
POSTGRES: ${{ (matrix.database == 'Postgres') && 1 || '' }}
255-
WORKERS: ${{ (matrix.arrangement == 'workers') && 1 || '' }}
256-
TEST_ONLY_IGNORE_POETRY_LOCKFILE: 1
257-
258-
- name: Formatted in-repo Complement test logs
259-
# Always run this step if we attempted to run the Complement tests.
260-
if: always() && steps.run_in_repo_complement_tests.outcome != 'skipped'
261-
run: cat /tmp/gotest-in-repo-complement.log | gotestfmt -hide "successful-downloads,empty-packages"
187+
with:
188+
use_latest_deps: true
262189

263190
# Open an issue if the build fails, so we know about it.
264191
# Only do this if we're not experimenting with this action in a PR.

.github/workflows/release-artifacts.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
6565

6666
- name: Set up docker layer caching
67-
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
67+
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
6868
with:
6969
path: /tmp/.buildx-cache
7070
key: ${{ runner.os }}-buildx-${{ github.sha }}

0 commit comments

Comments
 (0)