forked from matrix-org/synapse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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))
- Loading branch information
Showing
735 changed files
with
51,829 additions
and
37,242 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
{{- /*gotype: github.com/haveyoudebuggedit/gotestfmt/parser.Package*/ -}} | ||
{{- /* | ||
This template contains the format for an individual package. GitHub actions does not currently support nested groups so | ||
we are creating a stylized header for each package. | ||
|
||
This template is based on https://github.com/haveyoudebuggedit/gotestfmt/blob/f179b0e462a9dcf7101515d87eec4e4d7e58b92a/.gotestfmt/github/package.gotpl | ||
which is under the Unlicense licence. | ||
*/ -}} | ||
{{- $settings := .Settings -}} | ||
{{- if and (or (not $settings.HideSuccessfulPackages) (ne .Result "PASS")) (or (not $settings.HideEmptyPackages) (ne .Result "SKIP") (ne (len .TestCases) 0)) -}} | ||
{{- if eq .Result "PASS" -}} | ||
{{ "\033" }}[0;32m | ||
{{- else if eq .Result "SKIP" -}} | ||
{{ "\033" }}[0;33m | ||
{{- else -}} | ||
{{ "\033" }}[0;31m | ||
{{- end -}} | ||
📦 {{ .Name }}{{- "\033" }}[0m | ||
{{- with .Coverage -}} | ||
{{- "\033" -}}[0;37m ({{ . }}% coverage){{- "\033" -}}[0m | ||
{{- end -}} | ||
{{- "\n" -}} | ||
{{- with .Reason -}} | ||
{{- " " -}}🛑 {{ . -}}{{- "\n" -}} | ||
{{- end -}} | ||
{{- with .Output -}} | ||
{{- . -}}{{- "\n" -}} | ||
{{- end -}} | ||
{{- with .TestCases -}} | ||
{{- /* Passing tests are first */ -}} | ||
{{- range . -}} | ||
{{- if eq .Result "PASS" -}} | ||
::group::{{ "\033" }}[0;32m✅{{ " " }}{{- .Name -}} | ||
{{- "\033" -}}[0;37m ({{if $settings.ShowTestStatus}}{{.Result}}; {{end}}{{ .Duration -}} | ||
{{- with .Coverage -}} | ||
, coverage: {{ . }}% | ||
{{- end -}}) | ||
{{- "\033" -}}[0m | ||
{{- "\n" -}} | ||
|
||
{{- with .Output -}} | ||
{{- formatTestOutput . $settings -}} | ||
{{- "\n" -}} | ||
{{- end -}} | ||
|
||
::endgroup::{{- "\n" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{- /* Then skipped tests are second */ -}} | ||
{{- range . -}} | ||
{{- if eq .Result "SKIP" -}} | ||
::group::{{ "\033" }}[0;33m🚧{{ " " }}{{- .Name -}} | ||
{{- "\033" -}}[0;37m ({{if $settings.ShowTestStatus}}{{.Result}}; {{end}}{{ .Duration -}} | ||
{{- with .Coverage -}} | ||
, coverage: {{ . }}% | ||
{{- end -}}) | ||
{{- "\033" -}}[0m | ||
{{- "\n" -}} | ||
|
||
{{- with .Output -}} | ||
{{- formatTestOutput . $settings -}} | ||
{{- "\n" -}} | ||
{{- end -}} | ||
|
||
::endgroup::{{- "\n" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{- /* and failing tests are last */ -}} | ||
{{- range . -}} | ||
{{- if and (ne .Result "PASS") (ne .Result "SKIP") -}} | ||
::group::{{ "\033" }}[0;31m❌{{ " " }}{{- .Name -}} | ||
{{- "\033" -}}[0;37m ({{if $settings.ShowTestStatus}}{{.Result}}; {{end}}{{ .Duration -}} | ||
{{- with .Coverage -}} | ||
, coverage: {{ . }}% | ||
{{- end -}}) | ||
{{- "\033" -}}[0m | ||
{{- "\n" -}} | ||
|
||
{{- with .Output -}} | ||
{{- formatTestOutput . $settings -}} | ||
{{- "\n" -}} | ||
{{- end -}} | ||
|
||
::endgroup::{{- "\n" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- "\n" -}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
#!/usr/bin/env python | ||
# Copyright 2022 The Matrix.org Foundation C.I.C. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# Wraps `auditwheel repair` to first check if we're repairing a potentially abi3 | ||
# compatible wheel, if so rename the wheel before repairing it. | ||
|
||
import argparse | ||
import os | ||
import subprocess | ||
from typing import Optional | ||
from zipfile import ZipFile | ||
|
||
from packaging.tags import Tag | ||
from packaging.utils import parse_wheel_filename | ||
from packaging.version import Version | ||
|
||
|
||
def check_is_abi3_compatible(wheel_file: str) -> None: | ||
"""Check the contents of the built wheel for any `.so` files that are *not* | ||
abi3 compatible. | ||
""" | ||
|
||
with ZipFile(wheel_file, "r") as wheel: | ||
for file in wheel.namelist(): | ||
if not file.endswith(".so"): | ||
continue | ||
|
||
if not file.endswith(".abi3.so"): | ||
raise Exception(f"Found non-abi3 lib: {file}") | ||
|
||
|
||
def cpython(wheel_file: str, name: str, version: Version, tag: Tag) -> str: | ||
"""Replaces the cpython wheel file with a ABI3 compatible wheel""" | ||
|
||
if tag.abi == "abi3": | ||
# Nothing to do. | ||
return wheel_file | ||
|
||
check_is_abi3_compatible(wheel_file) | ||
|
||
abi3_tag = Tag(tag.interpreter, "abi3", tag.platform) | ||
|
||
dirname = os.path.dirname(wheel_file) | ||
new_wheel_file = os.path.join( | ||
dirname, | ||
f"{name}-{version}-{abi3_tag}.whl", | ||
) | ||
|
||
os.rename(wheel_file, new_wheel_file) | ||
|
||
print("Renamed wheel to", new_wheel_file) | ||
|
||
return new_wheel_file | ||
|
||
|
||
def main(wheel_file: str, dest_dir: str, archs: Optional[str]) -> None: | ||
"""Entry point""" | ||
|
||
# Parse the wheel file name into its parts. Note that `parse_wheel_filename` | ||
# normalizes the package name (i.e. it converts matrix_synapse -> | ||
# matrix-synapse), which is not what we want. | ||
_, version, build, tags = parse_wheel_filename(os.path.basename(wheel_file)) | ||
name = os.path.basename(wheel_file).split("-")[0] | ||
|
||
if len(tags) != 1: | ||
# We expect only a wheel file with only a single tag | ||
raise Exception(f"Unexpectedly found multiple tags: {tags}") | ||
|
||
tag = next(iter(tags)) | ||
|
||
if build: | ||
# We don't use build tags in Synapse | ||
raise Exception(f"Unexpected build tag: {build}") | ||
|
||
# If the wheel is for cpython then convert it into an abi3 wheel. | ||
if tag.interpreter.startswith("cp"): | ||
wheel_file = cpython(wheel_file, name, version, tag) | ||
|
||
# Finally, repair the wheel. | ||
if archs is not None: | ||
# If we are given archs then we are on macos and need to use | ||
# `delocate-listdeps`. | ||
subprocess.run(["delocate-listdeps", wheel_file], check=True) | ||
subprocess.run( | ||
["delocate-wheel", "--require-archs", archs, "-w", dest_dir, wheel_file], | ||
check=True, | ||
) | ||
else: | ||
subprocess.run(["auditwheel", "repair", "-w", dest_dir, wheel_file], check=True) | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = argparse.ArgumentParser(description="Tag wheel as abi3 and repair it.") | ||
|
||
parser.add_argument( | ||
"--wheel-dir", | ||
"-w", | ||
metavar="WHEEL_DIR", | ||
help="Directory to store delocated wheels", | ||
required=True, | ||
) | ||
|
||
parser.add_argument( | ||
"--require-archs", | ||
metavar="archs", | ||
default=None, | ||
) | ||
|
||
parser.add_argument( | ||
"wheel_file", | ||
metavar="WHEEL_FILE", | ||
) | ||
|
||
args = parser.parse_args() | ||
|
||
wheel_file = args.wheel_file | ||
wheel_dir = args.wheel_dir | ||
archs = args.require_archs | ||
|
||
main(wheel_file, wheel_dir, archs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
#!/usr/bin/env python | ||
# Copyright 2022 The Matrix.org Foundation C.I.C. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# Calculate the trial jobs to run based on if we're in a PR or not. | ||
|
||
import json | ||
import os | ||
|
||
|
||
def set_output(key: str, value: str): | ||
# See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter | ||
with open(os.environ["GITHUB_OUTPUT"], "at") as f: | ||
print(f"{key}={value}", file=f) | ||
|
||
|
||
IS_PR = os.environ["GITHUB_REF"].startswith("refs/pull/") | ||
|
||
# First calculate the various trial jobs. | ||
# | ||
# For each type of test we only run on Py3.7 on PRs | ||
|
||
trial_sqlite_tests = [ | ||
{ | ||
"python-version": "3.7", | ||
"database": "sqlite", | ||
"extras": "all", | ||
} | ||
] | ||
|
||
if not IS_PR: | ||
trial_sqlite_tests.extend( | ||
{ | ||
"python-version": version, | ||
"database": "sqlite", | ||
"extras": "all", | ||
} | ||
for version in ("3.8", "3.9", "3.10") | ||
) | ||
|
||
|
||
trial_postgres_tests = [ | ||
{ | ||
"python-version": "3.7", | ||
"database": "postgres", | ||
"postgres-version": "10", | ||
"extras": "all", | ||
} | ||
] | ||
|
||
if not IS_PR: | ||
trial_postgres_tests.append( | ||
{ | ||
"python-version": "3.10", | ||
"database": "postgres", | ||
"postgres-version": "14", | ||
"extras": "all", | ||
} | ||
) | ||
|
||
trial_no_extra_tests = [ | ||
{ | ||
"python-version": "3.7", | ||
"database": "sqlite", | ||
"extras": "", | ||
} | ||
] | ||
|
||
print("::group::Calculated trial jobs") | ||
print( | ||
json.dumps( | ||
trial_sqlite_tests + trial_postgres_tests + trial_no_extra_tests, indent=4 | ||
) | ||
) | ||
print("::endgroup::") | ||
|
||
test_matrix = json.dumps( | ||
trial_sqlite_tests + trial_postgres_tests + trial_no_extra_tests | ||
) | ||
set_output("trial_test_matrix", test_matrix) | ||
|
||
|
||
# First calculate the various sytest jobs. | ||
# | ||
# For each type of test we only run on focal on PRs | ||
|
||
|
||
sytest_tests = [ | ||
{ | ||
"sytest-tag": "focal", | ||
}, | ||
{ | ||
"sytest-tag": "focal", | ||
"postgres": "postgres", | ||
}, | ||
{ | ||
"sytest-tag": "focal", | ||
"postgres": "multi-postgres", | ||
"workers": "workers", | ||
}, | ||
] | ||
|
||
if not IS_PR: | ||
sytest_tests.extend( | ||
[ | ||
{ | ||
"sytest-tag": "testing", | ||
"postgres": "postgres", | ||
}, | ||
{ | ||
"sytest-tag": "buster", | ||
"postgres": "multi-postgres", | ||
"workers": "workers", | ||
}, | ||
] | ||
) | ||
|
||
|
||
print("::group::Calculated sytest jobs") | ||
print(json.dumps(sytest_tests, indent=4)) | ||
print("::endgroup::") | ||
|
||
test_matrix = json.dumps(sytest_tests) | ||
set_output("sytest_test_matrix", test_matrix) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
# | ||
# Fetches a version of complement which best matches the current build. | ||
# | ||
# The tarball is unpacked into `./complement`. | ||
|
||
set -e | ||
mkdir -p complement | ||
|
||
# Pick an appropriate version of complement. Depending on whether this is a PR or release, | ||
# etc. we need to use different fallbacks: | ||
# | ||
# 1. First check if there's a similarly named branch (GITHUB_HEAD_REF | ||
# for pull requests, otherwise GITHUB_REF). | ||
# 2. Attempt to use the base branch, e.g. when merging into release-vX.Y | ||
# (GITHUB_BASE_REF for pull requests). | ||
# 3. Use the default complement branch ("HEAD"). | ||
for BRANCH_NAME in "$GITHUB_HEAD_REF" "$GITHUB_BASE_REF" "${GITHUB_REF#refs/heads/}" "HEAD"; do | ||
# Skip empty branch names and merge commits. | ||
if [[ -z "$BRANCH_NAME" || $BRANCH_NAME =~ ^refs/pull/.* ]]; then | ||
continue | ||
fi | ||
|
||
(wget -O - "https://github.com/matrix-org/complement/archive/$BRANCH_NAME.tar.gz" | tar -xz --strip-components=1 -C complement) && break | ||
done |
Oops, something went wrong.