@@ -211,41 +211,66 @@ runs:
211211 echo "::endgroup::"
212212
213213 - name : Run main script
214- shell : bash
215- run : /bin/bash job.sh
214+ id : run-main-script
215+ shell : bash -e -u -o pipefail {0}
216+ run : |
217+ echo -e "\033[1;34m┌─ launching test ─────────────────────────────────────────────────────────┐\033[0m"
218+ echo -e "\033[1;34m│ script : ${{ inputs.script }}\033[0m"
219+ echo -e "\033[1;34m│ runner : ${{ inputs.runner }}\033[0m"
220+ echo -e "\033[1;34m│ container : ${{ inputs.container-image }}\033[0m"
221+ echo -e "\033[1;34m└──────────────────────────────────────────────────────────────────────────┘\033[0m"
222+ echo "::group::Logs"
223+ EXIT_CODE=0
224+ /bin/bash job.sh || EXIT_CODE=$?
225+ echo "exit_code=$EXIT_CODE" | tee -a "$GITHUB_OUTPUT"
226+ echo "::endgroup::"
227+ exit $EXIT_CODE
216228
217229 - name : Check result
218230 id : check
219- shell : bash
231+ shell : bash -e -u -o pipefail {0}
232+ if : always()
220233 run : |
221- echo "::group::Check result"
222-
223234 docker exec nemo_container_${{ github.run_id }} /opt/venv/bin/coverage combine || true
224- docker exec nemo_container_${{ github.run_id }} /opt/venv/bin/coverage xml
225- docker cp nemo_container_${{ github.run_id }}:/opt/Megatron-Bridge/.coverage .coverage
226- docker cp nemo_container_${{ github.run_id }}:/opt/Megatron-Bridge/coverage.xml coverage.xml
235+ docker exec nemo_container_${{ github.run_id }} /opt/venv/bin/coverage xml || true
236+ docker cp nemo_container_${{ github.run_id }}:/opt/Megatron-Bridge/.coverage .coverage || true
237+ docker cp nemo_container_${{ github.run_id }}:/opt/Megatron-Bridge/coverage.xml coverage.xml || true
227238
228239 coverage_report=coverage-${{ steps.create.outputs.coverage-prefix }}-${{ github.run_id }}-$(uuidgen)
229- echo "coverage_report=$coverage_report" >> "$GITHUB_OUTPUT"
240+ echo "coverage_report=$coverage_report" | tee -a "$GITHUB_OUTPUT"
230241
231242 EXIT_CODE=${{ steps.run-main-script.outputs.exit_code }}
232243 IS_SUCCESS=$([[ "$EXIT_CODE" -eq 0 ]] && echo "true" || echo "false")
233244
234245 if [[ "$IS_SUCCESS" == "false" && "${{ inputs.is-optional }}" == "true" ]]; then
235- echo "::warning:: Test failed, but displayed as successful because it is marked as optional ."
246+ echo "::warning::Test failed but is marked optional — treating as success ."
236247 IS_SUCCESS=true
237248 fi
238249
239- if [[ "$IS_SUCCESS" == "false" ]]; then
240- echo Test did not finish successfully.
241- exit 1
250+ echo "::group::Coverage report"
251+ docker exec -t nemo_container_${{ github.run_id }} /opt/venv/bin/coverage report -i || true
252+ echo "::endgroup::"
253+
254+ if [[ "$IS_SUCCESS" == "true" ]]; then
255+ echo -e "\033[1;32m╔══════════════════════════════════════════════════════════════════════════╗\033[0m"
256+ echo -e "\033[1;32m║ ║\033[0m"
257+ echo -e "\033[1;32m║ ✅ PASSED ║\033[0m"
258+ echo -e "\033[1;32m║ ${{ inputs.script }}\033[0m"
259+ echo -e "\033[1;32m║ ║\033[0m"
260+ echo -e "\033[1;32m╚══════════════════════════════════════════════════════════════════════════╝\033[0m"
261+ echo "::notice title=Result::✅ ${{ inputs.script }} — PASSED"
262+ exit 0
242263 else
243- docker exec -t nemo_container_${{ github.run_id }} /opt/venv/bin/coverage report -i
264+ echo -e "\033[1;31m╔══════════════════════════════════════════════════════════════════════════╗\033[0m"
265+ echo -e "\033[1;31m║ ║\033[0m"
266+ echo -e "\033[1;31m║ ❌ FAILED (exit code: ${EXIT_CODE}) ║\033[0m"
267+ echo -e "\033[1;31m║ ${{ inputs.script }}\033[0m"
268+ echo -e "\033[1;31m║ ║\033[0m"
269+ echo -e "\033[1;31m╚══════════════════════════════════════════════════════════════════════════╝\033[0m"
270+ echo "::error title=Result::❌ ${{ inputs.script }} — FAILED (exit $EXIT_CODE)"
271+ exit 1
244272 fi
245273
246- exit $EXIT_CODE
247- echo "::endgroup::"
248-
249274 - name : Upload artifacts
250275 uses : actions/upload-artifact@v6
251276 if : ${{ steps.check.outputs.coverage_report != 'none' }}
0 commit comments