force autotest to script to exit with code 1 if any models failed. #1468

This commit is contained in:
davemfish 2023-12-12 11:13:02 -05:00
parent f7597fa276
commit 33a8719cd4
2 changed files with 4 additions and 1 deletions

View File

@ -339,6 +339,7 @@ jobs:
run: make CONDA="$MAMBA_EXE" binaries
- name: Run invest-autotest with binaries
continue-on-error: true
if : |
github.event_name == 'push' &&
(contains(github.ref, 'release') || github.ref == 'refs/heads/main')

View File

@ -67,7 +67,7 @@ def run_model(modelname, binary, workspace, datastack):
binary = binary.replace('/', '\\')
# Using a list here allows subprocess to handle escaping of paths.
command = [binary, 'run', '--workspace', workspace,
'--datastack', datastack, '--headless', modelname]
'--datastack', datastack, modelname]
# Subprocess on linux/mac seems to prefer a list of args, but path escaping
# (by passing the command as a list) seems to work better on Windows.
@ -201,6 +201,8 @@ def main(user_args=None):
print(status_messages)
with open(os.path.join(args.workspace, 'model_results.txt'), 'w') as log:
log.write(status_messages)
if failures > 0:
parser.exit(1, 'invest autotest failed')
if __name__ == '__main__':