From 577d618b9a74bb5d3f72284302d93c3991fa7212 Mon Sep 17 00:00:00 2001 From: Angelo Danducci Date: Fri, 27 Oct 2023 15:58:25 -0400 Subject: [PATCH] only publish images if image tests run (#11123) * only publish images if image tests run * fix indent in bash command * fix condition syntax * set value in the image test * test runner stopping correctly on fail * revert purposeful failure * tidy up trailing whitespace (cherry picked from commit 905cfde0d2086e559752380a50920ccefbaf9019) --- .azure/test-linux.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.azure/test-linux.yml b/.azure/test-linux.yml index c97d4f693975..3268f29bd4f0 100644 --- a/.azure/test-linux.yml +++ b/.azure/test-linux.yml @@ -29,6 +29,7 @@ jobs: QISKIT_SUPPRESS_PACKAGING_WARNINGS: Y PIP_CACHE_DIR: $(Pipeline.Workspace)/.pip QISKIT_TEST_CAPTURE_STREAMS: 1 + HAVE_VISUAL_TESTS_RUN: false steps: - task: UsePythonVersion@0 @@ -197,7 +198,9 @@ jobs: env: SETUPTOOLS_ENABLE_FEATURES: "legacy-editable" - - bash: image_tests/bin/python -m unittest discover -v test/visual + - bash: | + echo "##vso[task.setvariable variable=HAVE_VISUAL_TESTS_RUN;]true" + image_tests/bin/python -m unittest discover -v test/visual displayName: 'Run image test' env: # Needed to suppress a warning in jupyter-core 5.x by eagerly migrating to @@ -213,7 +216,7 @@ jobs: archiveType: tar archiveFile: '$(Build.ArtifactStagingDirectory)/visual_test_failures.tar.gz' verbose: true - condition: failed() + condition: and(failed(), eq(variables.HAVE_VISUAL_TESTS_RUN, 'true')) - task: ArchiveFiles@2 displayName: Archive circuit results @@ -222,7 +225,7 @@ jobs: archiveType: tar archiveFile: '$(Build.ArtifactStagingDirectory)/circuit_results.tar.gz' verbose: true - condition: failed() + condition: and(failed(), eq(variables.HAVE_VISUAL_TESTS_RUN, 'true')) - task: ArchiveFiles@2 displayName: Archive graph results @@ -231,7 +234,7 @@ jobs: archiveType: tar archiveFile: '$(Build.ArtifactStagingDirectory)/graph_results.tar.gz' verbose: true - condition: failed() + condition: and(failed(), eq(variables.HAVE_VISUAL_TESTS_RUN, 'true')) - task: PublishBuildArtifacts@1 displayName: 'Publish image test failure diffs' @@ -240,4 +243,4 @@ jobs: artifactName: 'image_test_failure_img_diffs' Parallel: true ParallelCount: 8 - condition: failed() + condition: and(failed(), eq(variables.HAVE_VISUAL_TESTS_RUN, 'true'))