Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge branch 'develop' into dependabot/pip/flake8-bugbear-22.9.23
Browse files Browse the repository at this point in the history
  • Loading branch information
David Robertson committed Oct 19, 2022
2 parents 6105308 + 04d7f56 commit 23b6c62
Show file tree
Hide file tree
Showing 66 changed files with 903 additions and 398 deletions.
11 changes: 9 additions & 2 deletions .ci/scripts/calculate_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
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.
Expand Down Expand Up @@ -81,7 +88,7 @@
test_matrix = json.dumps(
trial_sqlite_tests + trial_postgres_tests + trial_no_extra_tests
)
print(f"::set-output name=trial_test_matrix::{test_matrix}")
set_output("trial_test_matrix", test_matrix)


# First calculate the various sytest jobs.
Expand Down Expand Up @@ -125,4 +132,4 @@
print("::endgroup::")

test_matrix = json.dumps(sytest_tests)
print(f"::set-output name=sytest_test_matrix::{test_matrix}")
set_output("sytest_test_matrix", test_matrix)
2 changes: 1 addition & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
esac
# finally, set the 'branch-version' var.
echo "::set-output name=branch-version::$branch"
echo "branch-version=$branch" >> "$GITHUB_OUTPUT"
# Deploy to the target directory.
- name: Deploy to gh pages
Expand Down
36 changes: 30 additions & 6 deletions .github/workflows/release-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- id: set-distros
run: |
# if we're running from a tag, get the full list of distros; otherwise just use debian:sid
dists='["debian:sid"]'
if [[ $GITHUB_REF == refs/tags/* ]]; then
dists=$(scripts-dev/build_debian_packages.py --show-dists-json)
fi
echo "::set-output name=distros::$dists"
echo "distros=$dists" >> "$GITHUB_OUTPUT"
# map the step outputs to job outputs
outputs:
distros: ${{ steps.set-distros.outputs.distros }}
Expand Down Expand Up @@ -70,6 +72,8 @@ jobs:
- name: Set up python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Build the packages
# see https://github.com/docker/build-push-action/issues/252
Expand All @@ -91,18 +95,27 @@ jobs:
path: debs/*

build-wheels:
name: Build wheels on ${{ matrix.os }}
name: Build wheels on ${{ matrix.os }} for ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, macos-10.15]
arch: [x86_64, aarch64]
# is_pr is a flag used to exclude certain jobs from the matrix on PRs.
# It is not read by the rest of the workflow.
is_pr:
- ${{ startsWith(github.ref, 'refs/pull/') }}

exclude:
# Don't build macos wheels on PR CI.
- is_pr: true
os: "macos-10.15"
# Don't build aarch64 wheels on mac.
- os: "macos-10.15"
arch: aarch64
# Don't build aarch64 wheels on PR CI.
- is_pr: true
arch: aarch64

steps:
- uses: actions/checkout@v3
Expand All @@ -116,18 +129,29 @@ jobs:
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.9.0 poetry==1.2.0

# Only build a single wheel in CI.
- name: Set env vars.
run: |
echo "CIBW_BUILD="cp37-manylinux_x86_64"" >> $GITHUB_ENV
- name: Set up QEMU to emulate aarch64
if: matrix.arch == 'aarch64'
uses: docker/setup-qemu-action@v2
with:
platforms: arm64

- name: Build aarch64 wheels
if: matrix.arch == 'aarch64'
run: echo 'CIBW_ARCHS_LINUX=aarch64' >> $GITHUB_ENV

- name: Only build a single wheel on PR
if: startsWith(github.ref, 'refs/pull/')
run: echo "CIBW_BUILD="cp37-manylinux_${{ matrix.arch }}"" >> $GITHUB_ENV

- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
env:
# Skip testing for platforms which various libraries don't have wheels
# for, and so need extra build deps.
CIBW_TEST_SKIP: pp39-* *i686* *musl* pp37-macosx*
# Fix Rust OOM errors on emulated aarch64: https://github.com/rust-lang/cargo/issues/10583
CARGO_NET_GIT_FETCH_WITH_CLI: true
CIBW_ENVIRONMENT_PASS_LINUX: CARGO_NET_GIT_FETCH_WITH_CLI

- uses: actions/upload-artifact@v3
with:
Expand Down
29 changes: 8 additions & 21 deletions .github/workflows/triage-incoming.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,11 @@ on:
types: [ opened ]

jobs:
add_new_issues:
name: Add new issues to the triage board
runs-on: ubuntu-latest
steps:
- uses: octokit/graphql-action@v2.x
id: add_to_project
with:
headers: '{"GraphQL-Features": "projects_next_graphql"}'
query: |
mutation add_to_project($projectid:ID!,$contentid:ID!) {
addProjectV2ItemById(input: {projectId: $projectid contentId: $contentid}) {
item {
id
}
}
}
projectid: ${{ env.PROJECT_ID }}
contentid: ${{ github.event.issue.node_id }}
env:
PROJECT_ID: "PVT_kwDOAIB0Bs4AFDdZ"
GITHUB_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}
triage:
uses: matrix-org/backend-meta/.github/workflows/triage-incoming.yml@v1
with:
project_id: 'PVT_kwDOAIB0Bs4AFDdZ'
content_id: ${{ github.event.issue.node_id }}
secrets:
github_access_token: ${{ secrets.ELEMENT_BOT_TOKEN }}

1 change: 1 addition & 0 deletions changelog.d/10015.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Prevent device names from appearing in device list updates when `allow_device_name_lookup_over_federation` is `false`.
1 change: 1 addition & 0 deletions changelog.d/14018.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support for redirecting to an implementation of a [MSC3886](https://github.com/matrix-org/matrix-spec-proposals/pull/3886) HTTP rendezvous service.
1 change: 1 addition & 0 deletions changelog.d/14126.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Faster joins: prioritise the server we joined by when restarting a partial join resync.
2 changes: 2 additions & 0 deletions changelog.d/14145.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Clarify comment on event contexts.

1 change: 1 addition & 0 deletions changelog.d/14161.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug introduced in 1.30.0 where purging and rejoining a room without restarting in-between would result in a broken room.
1 change: 1 addition & 0 deletions changelog.d/14164.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix a bug introduced in 1.30.0 where purging and rejoining a room without restarting in-between would result in a broken room.
1 change: 1 addition & 0 deletions changelog.d/14195.docker
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix pre-startup logging being lost when using the `Dockerfile-workers` image.
1 change: 1 addition & 0 deletions changelog.d/14198.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Enable url previews when testing with complement.
1 change: 1 addition & 0 deletions changelog.d/14206.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bump pygithub from 1.55 to 1.56.
1 change: 1 addition & 0 deletions changelog.d/14207.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bump twisted from 22.4.0 to 22.8.0.
1 change: 1 addition & 0 deletions changelog.d/14208.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Bump types-setuptools from 65.4.0.0 to 65.5.0.1.
1 change: 1 addition & 0 deletions changelog.d/14212.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Build and publish binary wheels for `aarch64` platforms.
1 change: 1 addition & 0 deletions changelog.d/14214.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
When authenticating batched events, check for auth events in batch as well as DB.
1 change: 1 addition & 0 deletions changelog.d/14215.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix [MSC3030](https://github.com/matrix-org/matrix-spec-proposals/pull/3030) `/timestamp_to_event` endpoint returning potentially inaccurate closest events with `outliers` present.
1 change: 1 addition & 0 deletions changelog.d/14216.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update CI config to avoid GitHub Actions deprecation warnings.
1 change: 1 addition & 0 deletions changelog.d/14217.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update dependency requirements to allow building with poetry-core 1.3.2.
1 change: 1 addition & 0 deletions changelog.d/14221.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Rename the `cache_memory` extra to `cache-memory`, for compatability with poetry-core 1.3.0 and [PEP 685](https://peps.python.org/pep-0685/). From-source installations using this extra will need to install using the new name.
1 change: 1 addition & 0 deletions changelog.d/14222.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support for thread-specific notifications & receipts ([MSC3771](https://github.com/matrix-org/matrix-spec-proposals/pull/3771) and [MSC3773](https://github.com/matrix-org/matrix-spec-proposals/pull/3773)).
1 change: 1 addition & 0 deletions changelog.d/14224.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update CI config to avoid GitHub Actions deprecation warnings.
1 change: 1 addition & 0 deletions changelog.d/14227.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Specify dev-dependencies using lower bounds, to reduce the likelihood of a dependabot merge conflict. The lockfile continues to pin to specific versions.
1 change: 1 addition & 0 deletions changelog.d/14230.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Switch to using the `matrix-org/backend-meta` version of `triage-incoming` for new issues in CI.
2 changes: 2 additions & 0 deletions docker/complement/conf/workers-shared-extra.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ trusted_key_servers: []
enable_registration: true
enable_registration_without_verification: true
bcrypt_rounds: 4
url_preview_enabled: true
url_preview_ip_range_blacklist: []

## Registration ##

Expand Down
20 changes: 8 additions & 12 deletions docker/configure_workers_and_start.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,24 +230,19 @@

# Utility functions
def log(txt: str) -> None:
"""Log something to the stdout.
Args:
txt: The text to log.
"""
print(txt)


def error(txt: str) -> NoReturn:
"""Log something and exit with an error code.
Args:
txt: The text to log in error.
"""
log(txt)
print(txt, file=sys.stderr)
sys.exit(2)


def flush_buffers() -> None:
sys.stdout.flush()
sys.stderr.flush()


def convert(src: str, dst: str, **template_vars: object) -> None:
"""Generate a file from a template
Expand Down Expand Up @@ -328,7 +323,7 @@ def generate_base_homeserver_config() -> None:
# start.py already does this for us, so just call that.
# note that this script is copied in in the official, monolith dockerfile
os.environ["SYNAPSE_HTTP_PORT"] = str(MAIN_PROCESS_HTTP_LISTENER_PORT)
subprocess.check_output(["/usr/local/bin/python", "/start.py", "migrate_config"])
subprocess.run(["/usr/local/bin/python", "/start.py", "migrate_config"], check=True)


def generate_worker_files(
Expand Down Expand Up @@ -642,6 +637,7 @@ def main(args: List[str], environ: MutableMapping[str, str]) -> None:
# Start supervisord, which will start Synapse, all of the configured worker
# processes, redis, nginx etc. according to the config we created above.
log("Starting supervisord")
flush_buffers()
os.execle(
"/usr/local/bin/supervisord",
"supervisord",
Expand Down
18 changes: 13 additions & 5 deletions docker/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,19 @@

# Utility functions
def log(txt: str) -> None:
print(txt, file=sys.stderr)
print(txt)


def error(txt: str) -> NoReturn:
log(txt)
print(txt, file=sys.stderr)
sys.exit(2)


def flush_buffers() -> None:
sys.stdout.flush()
sys.stderr.flush()


def convert(src: str, dst: str, environ: Mapping[str, object]) -> None:
"""Generate a file from a template
Expand Down Expand Up @@ -131,10 +136,10 @@ def generate_config_from_template(

if ownership is not None:
log(f"Setting ownership on /data to {ownership}")
subprocess.check_output(["chown", "-R", ownership, "/data"])
subprocess.run(["chown", "-R", ownership, "/data"], check=True)
args = ["gosu", ownership] + args

subprocess.check_output(args)
subprocess.run(args, check=True)


def run_generate_config(environ: Mapping[str, str], ownership: Optional[str]) -> None:
Expand All @@ -158,7 +163,7 @@ def run_generate_config(environ: Mapping[str, str], ownership: Optional[str]) ->
if ownership is not None:
# make sure that synapse has perms to write to the data dir.
log(f"Setting ownership on {data_dir} to {ownership}")
subprocess.check_output(["chown", ownership, data_dir])
subprocess.run(["chown", ownership, data_dir], check=True)

# create a suitable log config from our template
log_config_file = "%s/%s.log.config" % (config_dir, server_name)
Expand All @@ -185,6 +190,7 @@ def run_generate_config(environ: Mapping[str, str], ownership: Optional[str]) ->
"--open-private-ports",
]
# log("running %s" % (args, ))
flush_buffers()
os.execv(sys.executable, args)


Expand Down Expand Up @@ -267,8 +273,10 @@ def main(args: List[str], environ: MutableMapping[str, str]) -> None:
args = [sys.executable] + args
if ownership is not None:
args = ["gosu", ownership] + args
flush_buffers()
os.execve("/usr/sbin/gosu", args, environ)
else:
flush_buffers()
os.execve(sys.executable, args, environ)


Expand Down
Loading

0 comments on commit 23b6c62

Please sign in to comment.