This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
build debs in GHA #10247
Merged
Merged
build debs in GHA #10247
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,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/* |
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 @@ | ||
Build the Debian packages in CI. |
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 |
---|---|---|
|
@@ -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,7 @@ 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 +59,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 +92,7 @@ class Builder(object): | |
], | ||
stdout=stdout, | ||
stderr=subprocess.STDOUT, | ||
cwd=projdir, | ||
) | ||
|
||
container_name = "synapse_build_" + tag | ||
|
@@ -179,11 +179,20 @@ 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="*", | ||
default=DISTS, | ||
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: | ||
json.dump(DISTS, sys.stdout) | ||
print() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I find There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fair |
||
else: | ||
run_builds(dists=args.dist, jobs=args.jobs, skip_tests=args.no_check) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to run this on pull requests as well? I'm sometimes quick to dismiss a ❌ on a branch because it happens sometimes due to flaky sytests and I don't necessarily bother looking further (because I assume everything that's been PR'd has been ✔️'d on the CI), but I think personally I'd pay more attention if the failure happens on a PR. Or maybe the concern is that it would take too long to run to be valuable to have on a PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I don't really want to tie up 7 GHA workers for 10-12 minutes every time someone pushes to a PR branch. #8555 suggested an approach of building for oldest and newest supported releases, which might make sense, but I'd rather have that as a separate PR.