From 601d2f1c088a04f3cb471cd5d19d920e824869f3 Mon Sep 17 00:00:00 2001 From: chenhaoran Date: Mon, 25 Nov 2024 20:04:30 +0800 Subject: [PATCH] ci: set test step in ci when tdgpt file changed --- Jenkinsfile2 | 23 +++++++++++++++++------ tests/army/tmq/a.py | 13 +++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 tests/army/tmq/a.py diff --git a/Jenkinsfile2 b/Jenkinsfile2 index 5a6868b907..f163767557 100644 --- a/Jenkinsfile2 +++ b/Jenkinsfile2 @@ -6,6 +6,7 @@ node { file_zh_changed = '' file_en_changed = '' file_no_doc_changed = '1' +file_only_tdgpt_change_except = '1' def abortPreviousBuilds() { def currentJobName = env.JOB_NAME def currentBuildNumber = env.BUILD_NUMBER.toInteger() @@ -73,6 +74,14 @@ def check_docs(){ ''', returnStdout: true ).trim() + + file_only_tdgpt_change_except = sh ( + script: ''' + cat ${file_no_doc_changed} |grep -v "forecastoperator.c\\|anomalywindowoperator.c" || : + ''', + returnStdout: true + ).trim() + echo "file_zh_changed: ${file_zh_changed}" echo "file_en_changed: ${file_en_changed}" echo "file_no_doc_changed: ${file_no_doc_changed}" @@ -570,12 +579,14 @@ pipeline { ''' + timeout_cmd + ''' time ./run.sh -e -m /home/m.json -t tdgpt_cases.task -b ${BRANCH_NAME}_${BUILD_ID} -l ${WKDIR}/log -o 1200 ''' + extra_param + ''' ''' } else { - sh ''' - cd ${WKC}/tests/parallel_test - export DEFAULT_RETRY_TIME=2 - date - ''' + timeout_cmd + ''' time ./run.sh -e -m /home/m.json -t cases.task -b ${BRANCH_NAME}_${BUILD_ID} -l ${WKDIR}/log -o 1200 ''' + extra_param + ''' - ''' + if ( file_only_tdgpt_change_except != '' ) { + sh ''' + cd ${WKC}/tests/parallel_test + export DEFAULT_RETRY_TIME=2 + date + ''' + timeout_cmd + ''' time ./run.sh -e -m /home/m.json -t cases.task -b ${BRANCH_NAME}_${BUILD_ID} -l ${WKDIR}/log -o 1200 ''' + extra_param + ''' + ''' + } } } } diff --git a/tests/army/tmq/a.py b/tests/army/tmq/a.py new file mode 100644 index 0000000000..9236e3a5b3 --- /dev/null +++ b/tests/army/tmq/a.py @@ -0,0 +1,13 @@ +import click + +@click.command() +@click.option('--count', default=1, help='Number of greetings.') +@click.option('--name', prompt='Your name', + help='The person to greet.') +def hello(count, name): + """Simple program that greets NAME for a total of COUNT times.""" + for x in range(count): + click.echo('Hello %s!' % name) + +if __name__ == '__main__': + hello() \ No newline at end of file