diff mbox series

[v6,03/14] CI: stop setting FAILED_TEST_ARTIFACTS N times

Message ID patch-v6-03.14-fdc5b534644-20220525T100743Z-avarab@gmail.com (mailing list archive)
State New
Headers show
Series CI: js/ci-github-workflow-markup rebased on "use $GITHUB_ENV" | expand

Commit Message

Ævar Arnfjörð Bjarmason May 25, 2022, 11:25 a.m. UTC
The FAILED_TEST_ARTIFACTS variable introduced in f72f328bc57 (ci: let
GitHub Actions upload failed tests' directories, 2020-04-11) is only
used once in the main.yml, there is no need to set it N times if we
have N failing tests.

See also 92bf1b60673 (ci: avoid `set-env` construct in
print-test-failures.sh, 2020-11-17) which moved it to using
$GITHUB_ENV, we'll now check if it's set like ci/lib.sh, this makes it
easier to test this script locally.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 ci/print-test-failures.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/ci/print-test-failures.sh b/ci/print-test-failures.sh
index 1249bb0c0cf..8d4d2225371 100755
--- a/ci/print-test-failures.sh
+++ b/ci/print-test-failures.sh
@@ -32,7 +32,6 @@  do
 		case "$CI_TYPE" in
 		github-actions)
 			mkdir -p t/failed-test-artifacts
-			echo "FAILED_TEST_ARTIFACTS=t/failed-test-artifacts" >>$GITHUB_ENV
 			cp "t/test-results/${TEST_OUT}" t/failed-test-artifacts/
 			(
 				cd t &&
@@ -42,3 +41,11 @@  do
 		esac
 	fi
 done
+
+if test -n "$failed"
+then
+	if test -n "$GITHUB_ENV"
+	then
+		echo "FAILED_TEST_ARTIFACTS=t/failed-test-artifacts" >>$GITHUB_ENV
+	fi
+fi