From eee95379464fdbf1ed97ba7bb661a1f5bc87801f Mon Sep 17 00:00:00 2001 From: tligui_y Date: Tue, 19 Aug 2025 16:26:04 +0200 Subject: [PATCH] Update action.yml --- action.yml | 51 ++++++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/action.yml b/action.yml index fdd8401..82f0b36 100644 --- a/action.yml +++ b/action.yml @@ -56,6 +56,11 @@ inputs: required: false default: "" + session-wrapper: + description: "Wrapper de session (ex: dbus-run-session --)" + required: false + default: "" + pre-test-cmd: description: "Commands to run before pytest (e.g. start Xvfb, dunst, sleep, export DISPLAY)" required: false @@ -233,38 +238,38 @@ runs: pip|custom) ;; # pytest doit déjà être dans le PATH esac - bash -c " + WRAP="${{ inputs.session-wrapper }} bash -c" + + $WRAP ' set -e - # Pré-test - if [ -n '${{ inputs.pre-test-cmd }}' ]; then - echo '▶️ Running pre-test commands...' | tee -a $LOG_FILE - eval \"${{ inputs.pre-test-cmd }}\" + if [ -n "${{ inputs.pre-test-cmd }}" ]; then + echo "▶️ Running pre-test commands..." | tee -a $LOG_FILE + eval "${{ inputs.pre-test-cmd }}" >> $LOG_FILE 2>&1 fi set +e - # Run tests - if [ -n '${{ inputs.test-run-cmd }}' ]; then - echo '▶️ Running tests with wrapper: ${{ inputs.test-run-cmd }}' | tee -a $LOG_FILE - eval \"${{ inputs.test-run-cmd }} \\\"$CMD\\\"\" - STATUS=\$? + if [ -n "${{ inputs.test-run-cmd }}" ]; then + echo "▶️ Running tests with wrapper: ${{ inputs.test-run-cmd }}" | tee -a $LOG_FILE + FULL_CMD="${{ inputs.test-run-cmd }} \"$CMD\"" + bash -c "$FULL_CMD" >> outputs/full-output.log 2>&1 + STATUS=$? else - echo '▶️ Running tests (direct)' | tee -a $LOG_FILE - eval \"$CMD\" - STATUS=\$? + echo "▶️ Running tests (direct)" | tee -a $LOG_FILE + bash -c "$CMD" >> outputs/full-output.log 2>&1 + STATUS=$? fi - set -e - # Post-test - if [ -n '${{ inputs.post-test-cmd }}' ]; then - echo '▶️ Running post-test commands...' | tee -a $LOG_FILE - eval \"${{ inputs.post-test-cmd }}\" - fi - - exit \$STATUS - " >> outputs/full-output.log 2>&1 - echo "▶️ END" + if [ -n "${{ inputs.post-test-cmd }}" ]; then + echo "▶️ Running post-test commands..." | tee -a $LOG_FILE + eval "${{ inputs.post-test-cmd }}" >> $LOG_FILE 2>&1 + fi + + echo "▶️ END" | tee -a $LOG_FILE + exit $STATUS + ' + cat outputs/full-output.log awk '/=+ test session starts =+/{flag=1} /-+ JSON report -+/{flag=0} flag' outputs/full-output.log > outputs/raw-test-output.log