From b5ac16190ac8fa853808b0c2e16ec9899414458b Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Thu, 4 Jul 2024 17:40:43 +0200 Subject: GitHub: T6494: do not use 0/null value to mark build succeed GitHub performs loose equality comparisons. If the types do not match, GitHub coerces the type to a number. GitHub casts data types to a number using these conversions: https://docs.github.com/en/actions/learn-github-actions/expressions --- .github/workflows/package-smoketest.yml | 41 ++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/.github/workflows/package-smoketest.yml b/.github/workflows/package-smoketest.yml index 08c8d42f5..56fee5784 100644 --- a/.github/workflows/package-smoketest.yml +++ b/.github/workflows/package-smoketest.yml @@ -79,12 +79,13 @@ jobs: id: test shell: bash run: | - # always fail first - echo "exit_code=1" >> $GITHUB_OUTPUT + set -e sudo make test - exit_code=$? - echo "exit_code=$exit_code" >> $GITHUB_OUTPUT - exit $exit_code + if [[ $? == 0 ]]; then + echo "exit_code=success" >> $GITHUB_OUTPUT + else + echo "exit_code=fail" >> $GITHUB_OUTPUT + fi test_config_load: needs: build_iso @@ -109,12 +110,13 @@ jobs: id: test shell: bash run: | - # always fail first - echo "exit_code=1" >> $GITHUB_OUTPUT + set -e sudo make testc - exit_code=$? - echo "exit_code=$exit_code" >> $GITHUB_OUTPUT - exit $exit_code + if [[ $? == 0 ]]; then + echo "exit_code=success" >> $GITHUB_OUTPUT + else + echo "exit_code=fail" >> $GITHUB_OUTPUT + fi test_raid1_install: needs: build_iso @@ -139,12 +141,13 @@ jobs: id: test shell: bash run: | - # always fail first - echo "exit_code=1" >> $GITHUB_OUTPUT + set -e sudo make testraid - exit_code=$? - echo "exit_code=$exit_code" >> $GITHUB_OUTPUT - exit $exit_code + if [[ $? == 0 ]]; then + echo "exit_code=success" >> $GITHUB_OUTPUT + else + echo "exit_code=fail" >> $GITHUB_OUTPUT + fi result: needs: @@ -160,15 +163,15 @@ jobs: uses: mshick/add-pr-comment@v2 with: message: | - CI integration ${{ needs.test_smoketest_cli.outputs.exit_code == 0 && needs.test_config_load.outputs.exit_code == 0 && needs.test_raid1_install.outputs.exit_code == 0 && '👍 passed!' || '❌ failed!' }} + CI integration ${{ needs.test_smoketest_cli.outputs.exit_code == 'success' && needs.test_config_load.outputs.exit_code == 'success' && needs.test_raid1_install.outputs.exit_code == 'success' && '👍 passed!' || '❌ failed!' }} ### Details [CI logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) - * ${{ needs.test_smoketest_cli.outputs.exit_code == '0' && '👍 passed' || '❌ failed' }} CLI Smoketests returned: ${{ needs.test_smoketest_cli.outputs.exit_code }} - * ${{ needs.test_config_load.outputs.exit_code == '0' && '👍 passed' || '❌ failed' }} Config tests returned: ${{ needs.test_config_load.outputs.exit_code }} - * ${{ needs.test_raid1_install.outputs.exit_code == '0' && '👍 passed' || '❌ failed' }} RAID1 tests returned: ${{ needs.test_raid1_install.outputs.exit_code }} + * CLI Smoketests ${{ needs.test_smoketest_cli.outputs.exit_code == 'success' && '👍 passed' || '❌ failed' }} + * Config tests ${{ needs.test_config_load.outputs.exit_code == 'success' && '👍 passed' || '❌ failed' }} + * RAID1 tests ${{ needs.test_raid1_install.outputs.exit_code == 'success' && '👍 passed' || '❌ failed' }} message-id: "SMOKETEST_RESULTS" allow-repeats: false -- cgit v1.2.3