Skip to content

Commit

Permalink
GitHub: T6494: do not use 0/null value to mark build succeed
Browse files Browse the repository at this point in the history
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
  • Loading branch information
c-po committed Jul 4, 2024
1 parent a414190 commit ac9ac29
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions .github/workflows/package-smoketest.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: VyOS ISO integration Test

on:
push:
pull_request_target:
branches:
- current
Expand Down Expand Up @@ -79,12 +80,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
Expand All @@ -109,12 +111,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
Expand All @@ -139,12 +142,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:
Expand All @@ -160,15 +164,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
Expand Down

0 comments on commit ac9ac29

Please sign in to comment.