From 0fe5c027e91020400f1f3c08023fd8bf94b0549c Mon Sep 17 00:00:00 2001 From: Bartek Tofel Date: Wed, 17 Jan 2024 13:01:35 -0300 Subject: [PATCH] add action that sends test summary to step summary --- .../show-test-summary/action.yml | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 chainlink-testing-framework/show-test-summary/action.yml diff --git a/chainlink-testing-framework/show-test-summary/action.yml b/chainlink-testing-framework/show-test-summary/action.yml new file mode 100644 index 0000000..dea4cbc --- /dev/null +++ b/chainlink-testing-framework/show-test-summary/action.yml @@ -0,0 +1,35 @@ +name: chainlink-testing-framework-show-test-summary +description: Sends test summary to Github Step Summary +inputs: + test_directory: + required: true + description: Directory in which the tests are located + default: ./integration-tests/smoke + +runs: + using: composite + steps: + - name: Print failed test summary + shell: bash + if: always() + run: | + inputDir="${{ .inputs.test_directory}}" + cleanTestDir=${inputDir%/} + directory="$clean_test_dir/.test_summary" + files=("$directory"/*) + if [ -d "$directory" ]; then + echo "Test summary folder found" + if [ ${#files[@]} -gt 0 ]; then + first_file="${files[0]}" + echo "Name of the first test summary file: $(basename "$first_file")" + echo "### Failed Test Execution Logs Dashboard (over VPN):" >> $GITHUB_STEP_SUMMARY + cat "$first_file" | jq -r '.loki[] | "* [\(.test_name)](\(.value))"' >> $GITHUB_STEP_SUMMARY + if [ ${#files[@]} -gt 1 ]; then + echo "Found more than one test summary file. This is incorrect, there should be only one file" + fi + else + echo "Test summary directory is empty. This should not happen" + fi + else + echo "No test summary folder found. If no test failed or log collection wasn't explicitly requested this is correct. Exiting" + fi \ No newline at end of file