From 4fcb95318fc49c2686607b6e9752de4e72235b1b Mon Sep 17 00:00:00 2001 From: tligui_y Date: Thu, 28 Aug 2025 12:11:04 +0200 Subject: [PATCH] Update action.yml --- action.yml | 44 +++++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/action.yml b/action.yml index 6c01987..c706fd4 100644 --- a/action.yml +++ b/action.yml @@ -198,7 +198,7 @@ runs: } ;; conda) - conda install -y pytest pytest-cov pytest-json-report coverage >> "$LOG_FILE" 2>&1 || { + conda run -n ci-env pip install pytest pytest-cov pytest-json-report coverage >> "$LOG_FILE" 2>&1 || { exit 1 } ;; @@ -311,8 +311,26 @@ runs: echo "" >> $LOG_FILE echo "📈 Generating coverage summary..." >> $LOG_FILE - pixi run coverage combine > /dev/null 2>> outputs/coverage-error.log || true - pixi run coverage report --format=markdown > markdown/coverage-summary.md 2>> outputs/coverage-error.log && { + + # define runner commands depending on env + case "${{ inputs.env }}" in + pixi) + COV_RUN="pixi run coverage" + PY_RUN="pixi run python" + ;; + conda) + COV_RUN="conda run -n ci-env coverage" + PY_RUN="conda run -n ci-env python" + ;; + pip) + COV_RUN="coverage" + PY_RUN="python" + ;; + esac + + # run coverage + $COV_RUN combine > /dev/null 2>> outputs/coverage-error.log || true + $COV_RUN report --format=markdown > markdown/coverage-summary.md 2>> outputs/coverage-error.log && { echo "✅ Coverage summary generated" >> $LOG_FILE } || { echo "❌ Coverage summary generation failed" >> $LOG_FILE @@ -324,14 +342,14 @@ runs: echo "" >> $LOG_FILE echo "📊 Generating tests markdown summary..." >> $LOG_FILE - pixi run python temp-ci/json_to_md.py \ - --input "markdown/pytest-report.json" \ - --output "markdown/TEST-REPORT.md" \ - --log_long "outputs/raw-test-output.log" \ - --log_short "outputs/short-test-output.log" \ - --params "markdown/runtime_params.json" \ - >> "outputs/md-report.log" 2>&1 && { - echo "✅ Tests markdown generated" >> $LOG_FILE + $PY_RUN temp-ci/json_to_md.py \ + --input "markdown/pytest-report.json" \ + --output "markdown/TEST-REPORT.md" \ + --log_long "outputs/raw-test-output.log" \ + --log_short "outputs/short-test-output.log" \ + --params "markdown/runtime_params.json" \ + >> "outputs/md-report.log" 2>&1 && { + echo "✅ Tests markdown generated" >> $LOG_FILE } || { echo "❌ Tests markdown generation failed" >> $LOG_FILE echo "🪵 Extracting markdown generation error:" >> $LOG_FILE @@ -341,8 +359,8 @@ runs: echo "" >> $LOG_FILE echo "🌳 Generating JSON tree view..." >> $LOG_FILE - pixi run python temp-ci/json_to_tree.py \ - "markdown/pytest-report.json" \ + + $PY_RUN temp-ci/json_to_tree.py "markdown/pytest-report.json" \ >> "outputs/json-tree-gen.log" 2>&1 && { echo "✅ JSON tree view generated" >> $LOG_FILE } || {