diff options
author | Dan Callahan <danc@element.io> | 2021-04-12 15:27:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-12 15:27:05 +0100 |
commit | 3efde8b69a660be22c65e0a548b4a7d7f815cb5b (patch) | |
tree | 47d8c951155491b0ec46da67bca633e05a8f54fd /scripts-dev | |
parent | Require AppserviceRegistrationType (#9548) (diff) | |
download | synapse-3efde8b69a660be22c65e0a548b4a7d7f815cb5b.tar.xz |
Add option to skip unit tests when building debs (#9793)
Signed-off-by: Dan Callahan <danc@element.io>
Diffstat (limited to 'scripts-dev')
-rwxr-xr-x | scripts-dev/build_debian_packages | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/scripts-dev/build_debian_packages b/scripts-dev/build_debian_packages index bddc441df2..3bb6e2c7ea 100755 --- a/scripts-dev/build_debian_packages +++ b/scripts-dev/build_debian_packages @@ -41,7 +41,7 @@ class Builder(object): self._lock = threading.Lock() self._failed = False - def run_build(self, dist): + def run_build(self, dist, skip_tests=False): """Build deb for a single distribution""" if self._failed: @@ -49,13 +49,13 @@ class Builder(object): raise Exception("failed") try: - self._inner_build(dist) + self._inner_build(dist, skip_tests) except Exception as e: print("build of %s failed: %s" % (dist, e), file=sys.stderr) self._failed = True raise - def _inner_build(self, dist): + def _inner_build(self, dist, skip_tests=False): projdir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) os.chdir(projdir) @@ -99,6 +99,7 @@ class Builder(object): "--volume=" + debsdir + ":/debs", "-e", "TARGET_USERID=%i" % (os.getuid(), ), "-e", "TARGET_GROUPID=%i" % (os.getgid(), ), + "-e", "DEB_BUILD_OPTIONS=%s" % ("nocheck" if skip_tests else ""), "dh-venv-builder:" + tag, ], stdout=stdout, stderr=subprocess.STDOUT) @@ -122,7 +123,7 @@ class Builder(object): self.active_containers.remove(c) -def run_builds(dists, jobs=1): +def run_builds(dists, jobs=1, skip_tests=False): builder = Builder(redirect_stdout=(jobs > 1)) def sig(signum, _frame): @@ -131,7 +132,7 @@ def run_builds(dists, jobs=1): signal.signal(signal.SIGINT, sig) with ThreadPoolExecutor(max_workers=jobs) as e: - res = e.map(builder.run_build, dists) + res = e.map(lambda dist: builder.run_build(dist, skip_tests), dists) # make sure we consume the iterable so that exceptions are raised. for r in res: @@ -147,8 +148,12 @@ if __name__ == '__main__': help='specify the number of builds to run in parallel', ) parser.add_argument( + '--no-check', action='store_true', + help='skip running tests after building', + ) + 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) + run_builds(dists=args.dist, jobs=args.jobs, skip_tests=args.no_check) |