Check pytest outcome.

This commit is contained in:
Patrick Lehmann
2025-07-18 07:57:01 +02:00
parent 4d2d4c47fc
commit 1a3ba03626
2 changed files with 24 additions and 3 deletions

View File

@@ -245,6 +245,7 @@ jobs:
- ConfigParams - ConfigParams
- UnitTestingParams - UnitTestingParams
- UnitTesting - UnitTesting
if: success() || failure()
with: with:
# coverage_sqlite_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_sqlite }} # coverage_sqlite_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_sqlite }}
# coverage_xml_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_xml }} # coverage_xml_artifact: ${{ fromJson(needs.UnitTestingParams.outputs.artifact_names).codecoverage_xml }}
@@ -267,6 +268,7 @@ jobs:
- ConfigParams - ConfigParams
- UnitTestingParams - UnitTestingParams
- UnitTesting - UnitTesting
if: success() || failure()
with: with:
testsuite-summary-name: ${{ needs.ConfigParams.outputs.package_fullname }} testsuite-summary-name: ${{ needs.ConfigParams.outputs.package_fullname }}
merged_junit_filename: ${{ needs.ConfigParams.outputs.unittest_merged_report_xml_filename }} merged_junit_filename: ${{ needs.ConfigParams.outputs.unittest_merged_report_xml_filename }}

View File

@@ -342,6 +342,7 @@ jobs:
# Run pytests # Run pytests
- name: ✅ Run unit tests (Ubuntu/macOS) - name: ✅ Run unit tests (Ubuntu/macOS)
id: pytest_bash
if: matrix.system != 'windows' if: matrix.system != 'windows'
continue-on-error: true continue-on-error: true
run: | run: |
@@ -359,6 +360,7 @@ jobs:
fi fi
- name: ✅ Run unit tests (Windows) - name: ✅ Run unit tests (Windows)
id: pytest_posh
if: matrix.system == 'windows' if: matrix.system == 'windows'
continue-on-error: true continue-on-error: true
run: | run: |
@@ -376,16 +378,19 @@ jobs:
} }
- name: Convert coverage to XML format (Cobertura) - name: Convert coverage to XML format (Cobertura)
id: convert_xml
if: inputs.coverage_xml_artifact != '' if: inputs.coverage_xml_artifact != ''
continue-on-error: true continue-on-error: true
run: coverage xml --data-file=.coverage run: coverage xml --data-file=.coverage
- name: Convert coverage to JSON format - name: Convert coverage to JSON format
id: convert_json
if: inputs.coverage_json_artifact != '' if: inputs.coverage_json_artifact != ''
continue-on-error: true continue-on-error: true
run: coverage json --data-file=.coverage run: coverage json --data-file=.coverage
- name: Convert coverage to HTML format - name: Convert coverage to HTML format
id: convert_html
if: inputs.coverage_html_artifact != '' if: inputs.coverage_html_artifact != ''
continue-on-error: true continue-on-error: true
run: | run: |
@@ -427,7 +432,7 @@ jobs:
retention-days: 1 retention-days: 1
- name: 📤 Upload 'Coverage XML Report' artifact - name: 📤 Upload 'Coverage XML Report' artifact
if: inputs.coverage_xml_artifact != '' if: inputs.coverage_xml_artifact != '' && steps.convert_xml.outcome == 'success'
continue-on-error: true continue-on-error: true
uses: pyTooling/upload-artifact@v4 uses: pyTooling/upload-artifact@v4
with: with:
@@ -437,7 +442,7 @@ jobs:
retention-days: 1 retention-days: 1
- name: 📤 Upload 'Coverage JSON Report' artifact - name: 📤 Upload 'Coverage JSON Report' artifact
if: inputs.coverage_json_artifact != '' if: inputs.coverage_json_artifact != '' && steps.convert_json.outcome == 'success'
continue-on-error: true continue-on-error: true
uses: pyTooling/upload-artifact@v4 uses: pyTooling/upload-artifact@v4
with: with:
@@ -447,7 +452,7 @@ jobs:
retention-days: 1 retention-days: 1
- name: 📤 Upload 'Coverage HTML Report' artifact - name: 📤 Upload 'Coverage HTML Report' artifact
if: inputs.coverage_html_artifact != '' if: inputs.coverage_html_artifact != '' && steps.convert_html.outcome == 'success'
continue-on-error: true continue-on-error: true
uses: pyTooling/upload-artifact@v4 uses: pyTooling/upload-artifact@v4
with: with:
@@ -456,3 +461,17 @@ jobs:
path: '*' path: '*'
if-no-files-found: error if-no-files-found: error
retention-days: 1 retention-days: 1
- name: Generate error messages
shell: bash
run: |
exitCode=0
if [[ "${{ steps.pytest_bash.outcome }}" == "failure" || "${{ steps.pytest_posh.outcome }}" == "failure" ]]; then
printf "❌ pytest: %s\n" "Error in pytest execution."
printf "::error title=%s::%s\n" "pytest" "Error in pytest execution."
exitCode=1
else
printf "✅ pytest: No errors.\n"
fi
exit $exitCode