Skip to content

Commit dcc4b5a

Browse files
authored
Merge pull request #4 from realtyem/psycopg3-adjust-settings
2 parents 467a8c4 + 0693794 commit dcc4b5a

735 files changed

Lines changed: 13715 additions & 12248 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.

.ci/scripts/auditwheel_wrapper.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
import argparse
2626
import os
2727
import subprocess
28-
from typing import Optional
2928
from zipfile import ZipFile
3029

3130
from packaging.tags import Tag
@@ -80,7 +79,7 @@ def cpython(wheel_file: str, name: str, version: Version, tag: Tag) -> str:
8079
return new_wheel_file
8180

8281

83-
def main(wheel_file: str, dest_dir: str, archs: Optional[str]) -> None:
82+
def main(wheel_file: str, dest_dir: str, archs: str | None) -> None:
8483
"""Entry point"""
8584

8685
# Parse the wheel file name into its parts. Note that `parse_wheel_filename`

.ci/scripts/calculate_jobs.py

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -35,64 +35,64 @@ def set_output(key: str, value: str):
3535

3636
# First calculate the various trial jobs.
3737
#
38-
# For PRs, we only run each type of test with the oldest Python version supported (which
39-
# is Python 3.9 right now)
38+
# For PRs, we only run each type of test with the oldest and newest Python
39+
# version that's supported. The oldest version ensures we don't accidentally
40+
# introduce syntax or code that's too new, and the newest ensures we don't use
41+
# code that's been dropped in the latest supported Python version.
4042

4143
trial_sqlite_tests = [
4244
{
43-
"python-version": "3.9",
45+
"python-version": "3.10",
4446
"database": "sqlite",
4547
"extras": "all",
46-
}
48+
},
49+
{
50+
"python-version": "3.14",
51+
"database": "sqlite",
52+
"extras": "all",
53+
},
4754
]
4855

4956
if not IS_PR:
57+
# Otherwise, check all supported Python versions.
58+
#
59+
# Avoiding running all of these versions on every PR saves on CI time.
5060
trial_sqlite_tests.extend(
5161
{
5262
"python-version": version,
5363
"database": "sqlite",
5464
"extras": "all",
5565
}
56-
for version in ("3.10", "3.11", "3.12", "3.13")
66+
for version in ("3.11", "3.12", "3.13")
5767
)
5868

59-
# Run with both psycopg2 and psycopg.
69+
# Only test postgres against the earliest and latest Python versions that we
70+
# support in order to save on CI time.
6071
trial_postgres_tests = [
6172
{
62-
"python-version": "3.9",
73+
"python-version": "3.10",
6374
"database": "postgres",
64-
"postgres-version": "13",
75+
"postgres-version": "14",
6576
"extras": "all",
6677
},
6778
{
68-
"python-version": "3.9",
79+
"python-version": "3.10",
6980
"database": "psycopg",
70-
"postgres-version": "13",
81+
"postgres-version": "14",
82+
"extras": "all",
83+
},
84+
{
85+
"python-version": "3.14",
86+
"database": "postgres",
87+
"postgres-version": "17",
7188
"extras": "all",
7289
},
7390
]
7491

75-
if not IS_PR:
76-
trial_postgres_tests.extend(
77-
[
78-
{
79-
"python-version": "3.13",
80-
"database": "postgres",
81-
"postgres-version": "17",
82-
"extras": "all",
83-
},
84-
{
85-
"python-version": "3.13",
86-
"database": "psycopg",
87-
"postgres-version": "17",
88-
"extras": "all",
89-
},
90-
]
91-
)
92-
92+
# Ensure that Synapse passes unit tests even with no extra dependencies installed.
9393
trial_no_extra_tests = [
9494
{
95-
"python-version": "3.9",
95+
"python-version": "3.10",
9696
"database": "sqlite",
9797
"extras": "",
9898
}
@@ -114,24 +114,24 @@ def set_output(key: str, value: str):
114114

115115
# First calculate the various sytest jobs.
116116
#
117-
# For each type of test we only run on bullseye on PRs
117+
# For each type of test we only run on bookworm on PRs
118118

119119

120120
sytest_tests = [
121121
{
122-
"sytest-tag": "bullseye",
122+
"sytest-tag": "bookworm",
123123
},
124124
{
125-
"sytest-tag": "bullseye",
125+
"sytest-tag": "bookworm",
126126
"postgres": "postgres",
127127
},
128128
{
129-
"sytest-tag": "bullseye",
129+
"sytest-tag": "bookworm",
130130
"postgres": "multi-postgres",
131131
"workers": "workers",
132132
},
133133
{
134-
"sytest-tag": "bullseye",
134+
"sytest-tag": "bookworm",
135135
"postgres": "multi-postgres",
136136
"workers": "workers",
137137
"reactor": "asyncio",
@@ -142,11 +142,11 @@ def set_output(key: str, value: str):
142142
sytest_tests.extend(
143143
[
144144
{
145-
"sytest-tag": "bullseye",
145+
"sytest-tag": "bookworm",
146146
"reactor": "asyncio",
147147
},
148148
{
149-
"sytest-tag": "bullseye",
149+
"sytest-tag": "bookworm",
150150
"postgres": "postgres",
151151
"reactor": "asyncio",
152152
},

.ci/scripts/prepare_old_deps.sh

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,23 @@ export VIRTUALENV_NO_DOWNLOAD=1
1616
# to select the lowest possible versions, rather than resorting to this sed script.
1717

1818
# Patch the project definitions in-place:
19-
# - Replace all lower and tilde bounds with exact bounds
20-
# - Replace all caret bounds---but not the one that defines the supported Python version!
21-
# - Delete all lines referring to psycopg2 --- so no testing of postgres support.
19+
# - `-E` use extended regex syntax.
20+
# - Don't modify the line that defines required Python versions.
21+
# - Replace all lower and tilde bounds with exact bounds.
22+
# - Replace all caret bounds with exact bounds.
23+
# - Delete all lines referring to psycopg2 - so no testing of postgres support.
2224
# - Use pyopenssl 17.0, which is the oldest version that works with
2325
# a `cryptography` compiled against OpenSSL 1.1.
2426
# - Omit systemd: we're not logging to journal here.
2527

26-
sed -i \
27-
-e "s/[~>]=/==/g" \
28-
-e '/^python = "^/!s/\^/==/g' \
29-
-e "/psycopg2/d" \
30-
-e 's/pyOpenSSL = "==16.0.0"/pyOpenSSL = "==17.0.0"/' \
31-
-e '/systemd/d' \
32-
pyproject.toml
28+
sed -i -E '
29+
/^\s*requires-python\s*=/b
30+
s/[~>]=/==/g
31+
s/\^/==/g
32+
/psycopg2/d
33+
s/pyOpenSSL\s*==\s*16\.0\.0"/pyOpenSSL==17.0.0"/
34+
/systemd/d
35+
' pyproject.toml
3336

3437
echo "::group::Patched pyproject.toml"
3538
cat pyproject.toml

.git-blame-ignore-revs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,8 @@ c4268e3da64f1abb5b31deaeb5769adb6510c0a7
2626
# Update black to 23.1.0 (https://github.com/matrix-org/synapse/pull/15103)
2727
9bb2eac71962970d02842bca441f4bcdbbf93a11
2828

29+
# Use type hinting generics in standard collections (https://github.com/element-hq/synapse/pull/19046)
30+
fc244bb592aa481faf28214a2e2ce3bb4e95d990
31+
32+
# Write union types as X | Y where possible (https://github.com/element-hq/synapse/pull/19111)
33+
fcac7e0282b074d4bd3414d1c9c181e9701875d9

.github/workflows/docker.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
touch "${{ runner.temp }}/digests/${digest#sha256:}"
7676
7777
- name: Upload digest
78-
uses: actions/upload-artifact@v4
78+
uses: actions/upload-artifact@v5
7979
with:
8080
name: digests-${{ matrix.suffix }}
8181
path: ${{ runner.temp }}/digests/*
@@ -95,7 +95,7 @@ jobs:
9595
- build
9696
steps:
9797
- name: Download digests
98-
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
98+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
9999
with:
100100
path: ${{ runner.temp }}/digests
101101
pattern: digests-*
@@ -120,10 +120,10 @@ jobs:
120120
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
121121

122122
- name: Install Cosign
123-
uses: sigstore/cosign-installer@d7543c93d881b35a8faa02e8e3605f69b7a1ce62 # v3.10.0
123+
uses: sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad # v4.0.0
124124

125125
- name: Calculate docker image tag
126-
uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0
126+
uses: docker/metadata-action@318604b99e75e41977312d83839a89be02ca4893 # v5.9.0
127127
with:
128128
images: ${{ matrix.repository }}
129129
flavor: |

.github/workflows/docs-pr.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
cp book/welcome_and_overview.html book/index.html
4040
4141
- name: Upload Artifact
42-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
42+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
4343
with:
4444
name: book
4545
path: book

.github/workflows/fix_lint.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ jobs:
4747
- run: cargo fmt
4848
continue-on-error: true
4949

50-
- uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 # v6.0.1
50+
- uses: stefanzweifel/git-auto-commit-action@28e16e81777b558cc906c8750092100bbb34c5e3 # v7.0.0
5151
with:
5252
commit_message: "Attempt to fix linting"

.github/workflows/latest_deps.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ jobs:
139139
fail-fast: false
140140
matrix:
141141
include:
142-
- sytest-tag: bullseye
142+
- sytest-tag: bookworm
143143

144-
- sytest-tag: bullseye
144+
- sytest-tag: bookworm
145145
postgres: postgres
146146
workers: workers
147147
redis: redis
@@ -173,7 +173,7 @@ jobs:
173173
if: ${{ always() }}
174174
run: /sytest/scripts/tap_to_gha.pl /logs/results.tap
175175
- name: Upload SyTest logs
176-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
176+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
177177
if: ${{ always() }}
178178
with:
179179
name: Sytest Logs - ${{ job.status }} - (${{ join(matrix.*, ', ') }})

.github/workflows/push_complement_image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
password: ${{ secrets.GITHUB_TOKEN }}
5656
- name: Work out labels for complement image
5757
id: meta
58-
uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0
58+
uses: docker/metadata-action@318604b99e75e41977312d83839a89be02ca4893 # v5.9.0
5959
with:
6060
images: ghcr.io/${{ github.repository }}/complement-synapse
6161
tags: |

.github/workflows/release-artifacts.yml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ jobs:
101101
echo "ARTIFACT_NAME=${DISTRO#*:}" >> "$GITHUB_OUTPUT"
102102
103103
- name: Upload debs as artifacts
104-
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
104+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
105105
with:
106106
name: debs-${{ steps.artifact-name.outputs.ARTIFACT_NAME }}
107107
path: debs/*
@@ -114,8 +114,8 @@ jobs:
114114
os:
115115
- ubuntu-24.04
116116
- ubuntu-24.04-arm
117-
- macos-13 # This uses x86-64
118117
- macos-14 # This uses arm64
118+
- macos-15-intel # This uses x86-64
119119
# is_pr is a flag used to exclude certain jobs from the matrix on PRs.
120120
# It is not read by the rest of the workflow.
121121
is_pr:
@@ -124,7 +124,7 @@ jobs:
124124
exclude:
125125
# Don't build macos wheels on PR CI.
126126
- is_pr: true
127-
os: "macos-13"
127+
os: "macos-15-intel"
128128
- is_pr: true
129129
os: "macos-14"
130130
# Don't build aarch64 wheels on PR CI.
@@ -141,20 +141,25 @@ jobs:
141141
python-version: "3.x"
142142

143143
- name: Install cibuildwheel
144-
run: python -m pip install cibuildwheel==3.0.0
144+
run: python -m pip install cibuildwheel==3.2.1
145145

146146
- name: Only build a single wheel on PR
147147
if: startsWith(github.ref, 'refs/pull/')
148-
run: echo "CIBW_BUILD="cp39-manylinux_*"" >> $GITHUB_ENV
148+
run: echo "CIBW_BUILD="cp310-manylinux_*"" >> $GITHUB_ENV
149149

150150
- name: Build wheels
151151
run: python -m cibuildwheel --output-dir wheelhouse
152152
env:
153-
# Skip testing for platforms which various libraries don't have wheels
154-
# for, and so need extra build deps.
155-
CIBW_TEST_SKIP: pp3*-* *i686* *musl*
153+
# The platforms that we build for are determined by the
154+
# `tool.cibuildwheel.skip` option in `pyproject.toml`.
156155

157-
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
156+
# We skip testing wheels for the following platforms in CI:
157+
#
158+
# pp3*-* (PyPy wheels) broke in CI (TODO: investigate).
159+
# musl: (TODO: investigate).
160+
CIBW_TEST_SKIP: pp3*-* *musl*
161+
162+
- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
158163
with:
159164
name: Wheel-${{ matrix.os }}
160165
path: ./wheelhouse/*.whl
@@ -175,7 +180,7 @@ jobs:
175180
- name: Build sdist
176181
run: python -m build --sdist
177182

178-
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
183+
- uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
179184
with:
180185
name: Sdist
181186
path: dist/*.tar.gz
@@ -191,7 +196,7 @@ jobs:
191196
runs-on: ubuntu-latest
192197
steps:
193198
- name: Download all workflow run artifacts
194-
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
199+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
195200
- name: Build a tarball for the debs
196201
# We need to merge all the debs uploads into one folder, then compress
197202
# that.
@@ -200,16 +205,11 @@ jobs:
200205
mv debs*/* debs/
201206
tar -cvJf debs.tar.xz debs
202207
- name: Attach to release
203-
# Pinned to work around https://github.com/softprops/action-gh-release/issues/445
204-
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v0.1.15
205208
env:
206209
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
207-
with:
208-
files: |
209-
Sdist/*
210-
Wheel*/*
211-
debs.tar.xz
212-
# if it's not already published, keep the release as a draft.
213-
draft: true
214-
# mark it as a prerelease if the tag contains 'rc'.
215-
prerelease: ${{ contains(github.ref, 'rc') }}
210+
run: |
211+
gh release upload "${{ github.ref_name }}" \
212+
Sdist/* \
213+
Wheel*/* \
214+
debs.tar.xz \
215+
--repo ${{ github.repository }}

0 commit comments

Comments
 (0)