From 0f0f66827bad6ddfcce60b0f90b395d91bf875ec Mon Sep 17 00:00:00 2001 From: "C. Titus Brown" Date: Wed, 5 Apr 2023 13:30:48 -0700 Subject: [PATCH] MRG: failed tests should cause failed CI / github actions! (#18) * does ci fail? * upd * fix --- find-snakefiles.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/find-snakefiles.py b/find-snakefiles.py index 9ff591c..a52ef59 100755 --- a/find-snakefiles.py +++ b/find-snakefiles.py @@ -100,6 +100,9 @@ def main(): print(f"Saving run script to '{args.output}'", file=sys.stderr) output = open(args.output, 'wt') + print("#! /bin/bash", file=output) + print("failed=0", file=output) + for snakefile in snakefiles: targets = '' metadata = read_snakefile_metadata(snakefile) @@ -116,18 +119,18 @@ def main(): if metadata['expect_fail']: print(f""" -cd {dirname} -snakemake -s {filename} -j 1 -p {targets} >& {filename}.out && echo fail {snakefile} || echo success +cd {dirname} > /dev/null +snakemake -s {filename} -j 1 -p {targets} >& {filename}.out && {{ echo fail {snakefile}; failed=1; }} || echo success {snakefile} cd - > /dev/null """, file=output) else: print(f""" -cd {dirname} -snakemake -s {filename} -j 1 -p {targets} >& {filename}.out && echo success || echo fail {snakefile} +cd {dirname} > /dev/null +snakemake -s {filename} -j 1 -p {targets} >& {filename}.out && echo success {snakefile} || {{ echo fail {snakefile}; failed=1; }} cd - > /dev/null """, file=output) - print("exit 0", file=output) + print("exit $failed", file=output) if __name__ == '__main__':