Skip to content

Commit 228eda6

Browse files
author
e548609
committed
Merge tag 'v1.70.1' of https://github.com/matrix-org/synapse into matrix
Synapse 1.70.1 (2022-10-28) =========================== Bugfixes -------- - Fix a bug introduced in Synapse 1.70.0rc1 where the access tokens sent to application services as headers were malformed. Application services which were obtaining access tokens from query parameters were not affected. ([\matrix-org#14301](matrix-org#14301)) - Fix room creation being rate limited too aggressively since Synapse v1.69.0. ([\matrix-org#14314](matrix-org#14314))
2 parents cfb92e7 + e0d9013 commit 228eda6

File tree

735 files changed

+51829
-37242
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

735 files changed

+51829
-37242
lines changed

.ci/complement_package.gotpl

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
{{- /*gotype: github.com/haveyoudebuggedit/gotestfmt/parser.Package*/ -}}
2+
{{- /*
3+
This template contains the format for an individual package. GitHub actions does not currently support nested groups so
4+
we are creating a stylized header for each package.
5+
6+
This template is based on https://github.com/haveyoudebuggedit/gotestfmt/blob/f179b0e462a9dcf7101515d87eec4e4d7e58b92a/.gotestfmt/github/package.gotpl
7+
which is under the Unlicense licence.
8+
*/ -}}
9+
{{- $settings := .Settings -}}
10+
{{- if and (or (not $settings.HideSuccessfulPackages) (ne .Result "PASS")) (or (not $settings.HideEmptyPackages) (ne .Result "SKIP") (ne (len .TestCases) 0)) -}}
11+
{{- if eq .Result "PASS" -}}
12+
{{ "\033" }}[0;32m
13+
{{- else if eq .Result "SKIP" -}}
14+
{{ "\033" }}[0;33m
15+
{{- else -}}
16+
{{ "\033" }}[0;31m
17+
{{- end -}}
18+
📦 {{ .Name }}{{- "\033" }}[0m
19+
{{- with .Coverage -}}
20+
{{- "\033" -}}[0;37m ({{ . }}% coverage){{- "\033" -}}[0m
21+
{{- end -}}
22+
{{- "\n" -}}
23+
{{- with .Reason -}}
24+
{{- " " -}}🛑 {{ . -}}{{- "\n" -}}
25+
{{- end -}}
26+
{{- with .Output -}}
27+
{{- . -}}{{- "\n" -}}
28+
{{- end -}}
29+
{{- with .TestCases -}}
30+
{{- /* Passing tests are first */ -}}
31+
{{- range . -}}
32+
{{- if eq .Result "PASS" -}}
33+
::group::{{ "\033" }}[0;32m✅{{ " " }}{{- .Name -}}
34+
{{- "\033" -}}[0;37m ({{if $settings.ShowTestStatus}}{{.Result}}; {{end}}{{ .Duration -}}
35+
{{- with .Coverage -}}
36+
, coverage: {{ . }}%
37+
{{- end -}})
38+
{{- "\033" -}}[0m
39+
{{- "\n" -}}
40+
41+
{{- with .Output -}}
42+
{{- formatTestOutput . $settings -}}
43+
{{- "\n" -}}
44+
{{- end -}}
45+
46+
::endgroup::{{- "\n" -}}
47+
{{- end -}}
48+
{{- end -}}
49+
50+
{{- /* Then skipped tests are second */ -}}
51+
{{- range . -}}
52+
{{- if eq .Result "SKIP" -}}
53+
::group::{{ "\033" }}[0;33m🚧{{ " " }}{{- .Name -}}
54+
{{- "\033" -}}[0;37m ({{if $settings.ShowTestStatus}}{{.Result}}; {{end}}{{ .Duration -}}
55+
{{- with .Coverage -}}
56+
, coverage: {{ . }}%
57+
{{- end -}})
58+
{{- "\033" -}}[0m
59+
{{- "\n" -}}
60+
61+
{{- with .Output -}}
62+
{{- formatTestOutput . $settings -}}
63+
{{- "\n" -}}
64+
{{- end -}}
65+
66+
::endgroup::{{- "\n" -}}
67+
{{- end -}}
68+
{{- end -}}
69+
70+
{{- /* and failing tests are last */ -}}
71+
{{- range . -}}
72+
{{- if and (ne .Result "PASS") (ne .Result "SKIP") -}}
73+
::group::{{ "\033" }}[0;31m❌{{ " " }}{{- .Name -}}
74+
{{- "\033" -}}[0;37m ({{if $settings.ShowTestStatus}}{{.Result}}; {{end}}{{ .Duration -}}
75+
{{- with .Coverage -}}
76+
, coverage: {{ . }}%
77+
{{- end -}})
78+
{{- "\033" -}}[0m
79+
{{- "\n" -}}
80+
81+
{{- with .Output -}}
82+
{{- formatTestOutput . $settings -}}
83+
{{- "\n" -}}
84+
{{- end -}}
85+
86+
::endgroup::{{- "\n" -}}
87+
{{- end -}}
88+
{{- end -}}
89+
{{- end -}}
90+
{{- "\n" -}}
91+
{{- end -}}

.ci/scripts/auditwheel_wrapper.py

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
#!/usr/bin/env python
2+
# Copyright 2022 The Matrix.org Foundation C.I.C.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Wraps `auditwheel repair` to first check if we're repairing a potentially abi3
17+
# compatible wheel, if so rename the wheel before repairing it.
18+
19+
import argparse
20+
import os
21+
import subprocess
22+
from typing import Optional
23+
from zipfile import ZipFile
24+
25+
from packaging.tags import Tag
26+
from packaging.utils import parse_wheel_filename
27+
from packaging.version import Version
28+
29+
30+
def check_is_abi3_compatible(wheel_file: str) -> None:
31+
"""Check the contents of the built wheel for any `.so` files that are *not*
32+
abi3 compatible.
33+
"""
34+
35+
with ZipFile(wheel_file, "r") as wheel:
36+
for file in wheel.namelist():
37+
if not file.endswith(".so"):
38+
continue
39+
40+
if not file.endswith(".abi3.so"):
41+
raise Exception(f"Found non-abi3 lib: {file}")
42+
43+
44+
def cpython(wheel_file: str, name: str, version: Version, tag: Tag) -> str:
45+
"""Replaces the cpython wheel file with a ABI3 compatible wheel"""
46+
47+
if tag.abi == "abi3":
48+
# Nothing to do.
49+
return wheel_file
50+
51+
check_is_abi3_compatible(wheel_file)
52+
53+
abi3_tag = Tag(tag.interpreter, "abi3", tag.platform)
54+
55+
dirname = os.path.dirname(wheel_file)
56+
new_wheel_file = os.path.join(
57+
dirname,
58+
f"{name}-{version}-{abi3_tag}.whl",
59+
)
60+
61+
os.rename(wheel_file, new_wheel_file)
62+
63+
print("Renamed wheel to", new_wheel_file)
64+
65+
return new_wheel_file
66+
67+
68+
def main(wheel_file: str, dest_dir: str, archs: Optional[str]) -> None:
69+
"""Entry point"""
70+
71+
# Parse the wheel file name into its parts. Note that `parse_wheel_filename`
72+
# normalizes the package name (i.e. it converts matrix_synapse ->
73+
# matrix-synapse), which is not what we want.
74+
_, version, build, tags = parse_wheel_filename(os.path.basename(wheel_file))
75+
name = os.path.basename(wheel_file).split("-")[0]
76+
77+
if len(tags) != 1:
78+
# We expect only a wheel file with only a single tag
79+
raise Exception(f"Unexpectedly found multiple tags: {tags}")
80+
81+
tag = next(iter(tags))
82+
83+
if build:
84+
# We don't use build tags in Synapse
85+
raise Exception(f"Unexpected build tag: {build}")
86+
87+
# If the wheel is for cpython then convert it into an abi3 wheel.
88+
if tag.interpreter.startswith("cp"):
89+
wheel_file = cpython(wheel_file, name, version, tag)
90+
91+
# Finally, repair the wheel.
92+
if archs is not None:
93+
# If we are given archs then we are on macos and need to use
94+
# `delocate-listdeps`.
95+
subprocess.run(["delocate-listdeps", wheel_file], check=True)
96+
subprocess.run(
97+
["delocate-wheel", "--require-archs", archs, "-w", dest_dir, wheel_file],
98+
check=True,
99+
)
100+
else:
101+
subprocess.run(["auditwheel", "repair", "-w", dest_dir, wheel_file], check=True)
102+
103+
104+
if __name__ == "__main__":
105+
parser = argparse.ArgumentParser(description="Tag wheel as abi3 and repair it.")
106+
107+
parser.add_argument(
108+
"--wheel-dir",
109+
"-w",
110+
metavar="WHEEL_DIR",
111+
help="Directory to store delocated wheels",
112+
required=True,
113+
)
114+
115+
parser.add_argument(
116+
"--require-archs",
117+
metavar="archs",
118+
default=None,
119+
)
120+
121+
parser.add_argument(
122+
"wheel_file",
123+
metavar="WHEEL_FILE",
124+
)
125+
126+
args = parser.parse_args()
127+
128+
wheel_file = args.wheel_file
129+
wheel_dir = args.wheel_dir
130+
archs = args.require_archs
131+
132+
main(wheel_file, wheel_dir, archs)

.ci/scripts/calculate_jobs.py

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
#!/usr/bin/env python
2+
# Copyright 2022 The Matrix.org Foundation C.I.C.
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Calculate the trial jobs to run based on if we're in a PR or not.
17+
18+
import json
19+
import os
20+
21+
22+
def set_output(key: str, value: str):
23+
# See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter
24+
with open(os.environ["GITHUB_OUTPUT"], "at") as f:
25+
print(f"{key}={value}", file=f)
26+
27+
28+
IS_PR = os.environ["GITHUB_REF"].startswith("refs/pull/")
29+
30+
# First calculate the various trial jobs.
31+
#
32+
# For each type of test we only run on Py3.7 on PRs
33+
34+
trial_sqlite_tests = [
35+
{
36+
"python-version": "3.7",
37+
"database": "sqlite",
38+
"extras": "all",
39+
}
40+
]
41+
42+
if not IS_PR:
43+
trial_sqlite_tests.extend(
44+
{
45+
"python-version": version,
46+
"database": "sqlite",
47+
"extras": "all",
48+
}
49+
for version in ("3.8", "3.9", "3.10")
50+
)
51+
52+
53+
trial_postgres_tests = [
54+
{
55+
"python-version": "3.7",
56+
"database": "postgres",
57+
"postgres-version": "10",
58+
"extras": "all",
59+
}
60+
]
61+
62+
if not IS_PR:
63+
trial_postgres_tests.append(
64+
{
65+
"python-version": "3.10",
66+
"database": "postgres",
67+
"postgres-version": "14",
68+
"extras": "all",
69+
}
70+
)
71+
72+
trial_no_extra_tests = [
73+
{
74+
"python-version": "3.7",
75+
"database": "sqlite",
76+
"extras": "",
77+
}
78+
]
79+
80+
print("::group::Calculated trial jobs")
81+
print(
82+
json.dumps(
83+
trial_sqlite_tests + trial_postgres_tests + trial_no_extra_tests, indent=4
84+
)
85+
)
86+
print("::endgroup::")
87+
88+
test_matrix = json.dumps(
89+
trial_sqlite_tests + trial_postgres_tests + trial_no_extra_tests
90+
)
91+
set_output("trial_test_matrix", test_matrix)
92+
93+
94+
# First calculate the various sytest jobs.
95+
#
96+
# For each type of test we only run on focal on PRs
97+
98+
99+
sytest_tests = [
100+
{
101+
"sytest-tag": "focal",
102+
},
103+
{
104+
"sytest-tag": "focal",
105+
"postgres": "postgres",
106+
},
107+
{
108+
"sytest-tag": "focal",
109+
"postgres": "multi-postgres",
110+
"workers": "workers",
111+
},
112+
]
113+
114+
if not IS_PR:
115+
sytest_tests.extend(
116+
[
117+
{
118+
"sytest-tag": "testing",
119+
"postgres": "postgres",
120+
},
121+
{
122+
"sytest-tag": "buster",
123+
"postgres": "multi-postgres",
124+
"workers": "workers",
125+
},
126+
]
127+
)
128+
129+
130+
print("::group::Calculated sytest jobs")
131+
print(json.dumps(sytest_tests, indent=4))
132+
print("::endgroup::")
133+
134+
test_matrix = json.dumps(sytest_tests)
135+
set_output("sytest_test_matrix", test_matrix)

.ci/scripts/checkout_complement.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
#
3+
# Fetches a version of complement which best matches the current build.
4+
#
5+
# The tarball is unpacked into `./complement`.
6+
7+
set -e
8+
mkdir -p complement
9+
10+
# Pick an appropriate version of complement. Depending on whether this is a PR or release,
11+
# etc. we need to use different fallbacks:
12+
#
13+
# 1. First check if there's a similarly named branch (GITHUB_HEAD_REF
14+
# for pull requests, otherwise GITHUB_REF).
15+
# 2. Attempt to use the base branch, e.g. when merging into release-vX.Y
16+
# (GITHUB_BASE_REF for pull requests).
17+
# 3. Use the default complement branch ("HEAD").
18+
for BRANCH_NAME in "$GITHUB_HEAD_REF" "$GITHUB_BASE_REF" "${GITHUB_REF#refs/heads/}" "HEAD"; do
19+
# Skip empty branch names and merge commits.
20+
if [[ -z "$BRANCH_NAME" || $BRANCH_NAME =~ ^refs/pull/.* ]]; then
21+
continue
22+
fi
23+
24+
(wget -O - "https://github.com/matrix-org/complement/archive/$BRANCH_NAME.tar.gz" | tar -xz --strip-components=1 -C complement) && break
25+
done

0 commit comments

Comments
 (0)