From 5f2848f379ebefd100fc0a1ac5a034f447137f60 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Mon, 12 Jul 2021 19:03:14 +0100 Subject: [PATCH 1/8] build debs in GHA (#10247) GHA workflow to build the debs --- .github/workflows/debs.yml | 44 +++++++++++++++++++++++++++++++ changelog.d/10247.misc | 1 + scripts-dev/build_debian_packages | 17 +++++++++--- 3 files changed, 58 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/debs.yml create mode 100644 changelog.d/10247.misc diff --git a/.github/workflows/debs.yml b/.github/workflows/debs.yml new file mode 100644 index 0000000000..e03a419426 --- /dev/null +++ b/.github/workflows/debs.yml @@ -0,0 +1,44 @@ +# GitHub actions workflow which builds the debian packages. + +name: Debs + +on: + push: + branches: ["develop", "release-*"] + +permissions: + contents: read + +jobs: + # first get the list of distros to build for. + get-distros: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - id: set-distros + run: | + echo "::set-output name=distros::$(scripts-dev/build_debian_packages --show-dists-json)" + # map the step outputs to job outputs + outputs: + distros: ${{ steps.set-distros.outputs.distros }} + + # now build the packages with a matrix build. + build-debs: + needs: get-distros + name: "Build .deb packages" + runs-on: ubuntu-latest + strategy: + matrix: + distro: ${{ fromJson(needs.get-distros.outputs.distros) }} + + steps: + - uses: actions/checkout@v2 + with: + path: src + - uses: actions/setup-python@v2 + - run: ./src/scripts-dev/build_debian_packages "${{ matrix.distro }}" + - uses: actions/upload-artifact@v2 + with: + name: packages + path: debs/* diff --git a/changelog.d/10247.misc b/changelog.d/10247.misc new file mode 100644 index 0000000000..5824907bca --- /dev/null +++ b/changelog.d/10247.misc @@ -0,0 +1 @@ +Build the Debian packages in CI. diff --git a/scripts-dev/build_debian_packages b/scripts-dev/build_debian_packages index 546724f89f..e25c5bb265 100755 --- a/scripts-dev/build_debian_packages +++ b/scripts-dev/build_debian_packages @@ -10,6 +10,7 @@ # can be passed on the commandline for debugging. import argparse +import json import os import signal import subprocess @@ -34,6 +35,8 @@ By default, builds for all known distributions, but a list of distributions can be passed on the commandline for debugging. """ +projdir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + class Builder(object): def __init__(self, redirect_stdout=False): @@ -57,9 +60,6 @@ class Builder(object): raise def _inner_build(self, dist, skip_tests=False): - projdir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) - os.chdir(projdir) - tag = dist.split(":", 1)[1] # Make the dir where the debs will live. @@ -93,6 +93,7 @@ class Builder(object): ], stdout=stdout, stderr=subprocess.STDOUT, + cwd=projdir, ) container_name = "synapse_build_" + tag @@ -179,6 +180,11 @@ if __name__ == "__main__": action="store_true", help="skip running tests after building", ) + parser.add_argument( + "--show-dists-json", + action="store_true", + help="instead of building the packages, just list the dists to build for, as a json array", + ) parser.add_argument( "dist", nargs="*", @@ -186,4 +192,7 @@ if __name__ == "__main__": help="a list of distributions to build for. Default: %(default)s", ) args = parser.parse_args() - run_builds(dists=args.dist, jobs=args.jobs, skip_tests=args.no_check) + if args.show_dists_json: + print(json.dumps(DISTS)) + else: + run_builds(dists=args.dist, jobs=args.jobs, skip_tests=args.no_check) From ae81ec428d4fc0600b5cc06df2c2b8cb696d43c9 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Tue, 13 Jul 2021 00:20:11 +0100 Subject: [PATCH 2/8] Build the python release artifacts in GHA too --- .../{debs.yml => release-artifacts.yml} | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) rename .github/workflows/{debs.yml => release-artifacts.yml} (59%) diff --git a/.github/workflows/debs.yml b/.github/workflows/release-artifacts.yml similarity index 59% rename from .github/workflows/debs.yml rename to .github/workflows/release-artifacts.yml index e03a419426..9d1fb89834 100644 --- a/.github/workflows/debs.yml +++ b/.github/workflows/release-artifacts.yml @@ -1,11 +1,17 @@ -# GitHub actions workflow which builds the debian packages. +# GitHub actions workflow which builds the release artifacts. -name: Debs +name: Build release artifacts on: push: + # we build on develop and release branches to (hopefully) get early warning + # of things breaking branches: ["develop", "release-*"] + # we also rebuild on tags, so that we can be sure of picking the artifacts + # from the right tag. + tags: ["v*"] + permissions: contents: read @@ -40,5 +46,19 @@ jobs: - run: ./src/scripts-dev/build_debian_packages "${{ matrix.distro }}" - uses: actions/upload-artifact@v2 with: - name: packages + name: debs path: debs/* + + build-sdist: + name: "Build pypi distribution files" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - run: pip install wheel + - run: | + python setup.py sdist bdist_wheel + - uses: actions/upload-artifact@v2 + with: + name: python-dist + path: dist/* From 2d8b60e0f23ac43546d666520a3d43d867a57526 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Tue, 13 Jul 2021 11:50:14 +0100 Subject: [PATCH 3/8] Github Actions workflow to attach release artifacts to release (#10379) --- .github/workflows/release-artifacts.yml | 28 ++++++++++++++++++++++++- changelog.d/10379.misc | 1 + 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 changelog.d/10379.misc diff --git a/.github/workflows/release-artifacts.yml b/.github/workflows/release-artifacts.yml index 9d1fb89834..f292d703ed 100644 --- a/.github/workflows/release-artifacts.yml +++ b/.github/workflows/release-artifacts.yml @@ -13,7 +13,7 @@ on: tags: ["v*"] permissions: - contents: read + contents: write jobs: # first get the list of distros to build for. @@ -62,3 +62,29 @@ jobs: with: name: python-dist path: dist/* + + # if it's a tag, create a release and attach the artifacts to it + attach-assets: + name: "Attach assets to release" + if: startsWith(github.ref, 'refs/tags/') + needs: + - build-debs + - build-sdist + runs-on: ubuntu-latest + steps: + - name: Download all workflow run artifacts + uses: actions/download-artifact@v2 + - name: Build a tarball for the debs + run: tar -cvJf debs.tar.xz debs + - name: Attach to release + uses: softprops/action-gh-release@a929a66f232c1b11af63782948aa2210f981808a # PR#109 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + files: | + python-dist/* + debs.tar.xz + # if it's not already published, keep the release as a draft. + draft: true + # mark it as a prerelease if the tag contains 'rc'. + prerelease: ${{ contains(github.ref, 'rc') }} diff --git a/changelog.d/10379.misc b/changelog.d/10379.misc new file mode 100644 index 0000000000..00bf178bb8 --- /dev/null +++ b/changelog.d/10379.misc @@ -0,0 +1 @@ +Add Github Actions workflow to attach release artifacts to release. From f7bfa694aec6cb933b2b6e2ff971cda98dba3c6c Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Tue, 13 Jul 2021 11:57:55 +0100 Subject: [PATCH 4/8] 1.38.0rc3 --- CHANGES.md | 9 +++++++++ changelog.d/10247.misc | 1 - changelog.d/10379.misc | 1 - debian/changelog | 8 ++++++-- synapse/__init__.py | 2 +- 5 files changed, 16 insertions(+), 5 deletions(-) delete mode 100644 changelog.d/10247.misc delete mode 100644 changelog.d/10379.misc diff --git a/CHANGES.md b/CHANGES.md index a1419d6495..dbdf0a1185 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,12 @@ +Synapse 1.38.0rc3 (2021-07-13) +============================== + +Internal Changes +---------------- + +- Build the Debian packages in CI. ([\#10247](https://github.com/matrix-org/synapse/issues/10247), [\#10379](https://github.com/matrix-org/synapse/issues/10379)) + + Synapse 1.38.0rc2 (2021-07-09) ============================== diff --git a/changelog.d/10247.misc b/changelog.d/10247.misc deleted file mode 100644 index 5824907bca..0000000000 --- a/changelog.d/10247.misc +++ /dev/null @@ -1 +0,0 @@ -Build the Debian packages in CI. diff --git a/changelog.d/10379.misc b/changelog.d/10379.misc deleted file mode 100644 index 00bf178bb8..0000000000 --- a/changelog.d/10379.misc +++ /dev/null @@ -1 +0,0 @@ -Add Github Actions workflow to attach release artifacts to release. diff --git a/debian/changelog b/debian/changelog index cafd03c6c1..efc84718a4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,12 @@ -matrix-synapse-py3 (1.37.1ubuntu1) UNRELEASED; urgency=medium +matrix-synapse-py3 (1.38.0rc3) prerelease; urgency=medium + [ Erik Johnston ] * Add synapse_review_recent_signups script - -- Erik Johnston Thu, 01 Jul 2021 15:55:03 +0100 + [ Synapse Packaging team ] + * New synapse release 1.38.0rc3. + + -- Synapse Packaging team Tue, 13 Jul 2021 11:53:56 +0100 matrix-synapse-py3 (1.37.1) stable; urgency=medium diff --git a/synapse/__init__.py b/synapse/__init__.py index 119afa9ebe..bbd691fba2 100644 --- a/synapse/__init__.py +++ b/synapse/__init__.py @@ -47,7 +47,7 @@ try: except ImportError: pass -__version__ = "1.38.0rc2" +__version__ = "1.38.0rc3" if bool(os.environ.get("SYNAPSE_TEST_PATCH_LOG_CONTEXTS", False)): # We import here so that we don't have to install a bunch of deps when From c647c2a9ac7badd96cf15c35c86cc035db1b3fc5 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Tue, 13 Jul 2021 13:19:06 +0100 Subject: [PATCH 5/8] 1.38.0 --- CHANGES.md | 6 ++++++ debian/changelog | 2 +- synapse/__init__.py | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index dbdf0a1185..745c565740 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,9 @@ +Synapse 1.38.0 (2021-07-13) +=========================== + +No significant changes. + + Synapse 1.38.0rc3 (2021-07-13) ============================== diff --git a/debian/changelog b/debian/changelog index efc84718a4..573a6fefd0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,7 +6,7 @@ matrix-synapse-py3 (1.38.0rc3) prerelease; urgency=medium [ Synapse Packaging team ] * New synapse release 1.38.0rc3. - -- Synapse Packaging team Tue, 13 Jul 2021 11:53:56 +0100 + -- Synapse Packaging team Tue, 13 Jul 2021 13:15:40 +0100 matrix-synapse-py3 (1.37.1) stable; urgency=medium diff --git a/synapse/__init__.py b/synapse/__init__.py index bbd691fba2..5ecce24eee 100644 --- a/synapse/__init__.py +++ b/synapse/__init__.py @@ -47,7 +47,7 @@ try: except ImportError: pass -__version__ = "1.38.0rc3" +__version__ = "1.38.0" if bool(os.environ.get("SYNAPSE_TEST_PATCH_LOG_CONTEXTS", False)): # We import here so that we don't have to install a bunch of deps when From 08a8297c0d7ae84c9ef3c1335168dd1759204da1 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Tue, 13 Jul 2021 13:22:12 +0100 Subject: [PATCH 6/8] fix debian changelog --- debian/changelog | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 573a6fefd0..43d26fc133 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +matrix-synapse-py3 (1.38.0) stable; urgency=medium + + * New synapse release 1.38.0. + + -- Synapse Packaging team Tue, 13 Jul 2021 13:20:56 +0100 + matrix-synapse-py3 (1.38.0rc3) prerelease; urgency=medium [ Erik Johnston ] @@ -6,7 +12,7 @@ matrix-synapse-py3 (1.38.0rc3) prerelease; urgency=medium [ Synapse Packaging team ] * New synapse release 1.38.0rc3. - -- Synapse Packaging team Tue, 13 Jul 2021 13:15:40 +0100 + -- Synapse Packaging team Tue, 13 Jul 2021 11:53:56 +0100 matrix-synapse-py3 (1.37.1) stable; urgency=medium From f7309622e02c94fd55fabb59e43ebec237fc17f5 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Tue, 13 Jul 2021 13:23:07 +0100 Subject: [PATCH 7/8] Update CHANGES.md --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 745c565740..5e23ee2d88 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,7 @@ Synapse 1.38.0 (2021-07-13) =========================== -No significant changes. +No significant changes since 1.38.0rc3. Synapse 1.38.0rc3 (2021-07-13) From 519ec8271ff6a1d59043ac318c34dca898e079dc Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Tue, 13 Jul 2021 13:25:46 +0100 Subject: [PATCH 8/8] Move upgrade blurb --- CHANGES.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 5e23ee2d88..82baaa2d1f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,8 @@ Synapse 1.38.0 (2021-07-13) =========================== +This release includes a database schema update which could result in elevated disk usage. See the [upgrade notes](https://matrix-org.github.io/synapse/develop/upgrade#upgrading-to-v1380) for more information. + No significant changes since 1.38.0rc3. @@ -32,8 +34,6 @@ Improved Documentation Synapse 1.38.0rc1 (2021-07-06) ============================== -This release includes a database schema update which could result in elevated disk usage. See the [upgrade notes](https://matrix-org.github.io/synapse/develop/upgrade#upgrading-to-v1380) for more information. - Features --------