ci: add test output capture and display in workflow summary
This commit is contained in:
@@ -30,14 +30,31 @@ jobs:
|
|||||||
|
|
||||||
- name: Run unit tests
|
- name: Run unit tests
|
||||||
run: |
|
run: |
|
||||||
pytest tests/unit/ -v --cov=. --cov-report=term --cov-report=html --cov-report=xml
|
pytest tests/unit/ -v --cov=. --cov-report=term --cov-report=html --cov-report=xml 2>&1 | tee unit-test-output.txt
|
||||||
|
echo "UNIT_TEST_EXIT_CODE=${PIPESTATUS[0]}" >> $GITHUB_ENV
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
||||||
- name: Run integration tests
|
- name: Run integration tests
|
||||||
run: |
|
run: |
|
||||||
pytest tests/integration/ -v --cov=. --cov-append --cov-report=term --cov-report=html --cov-report=xml
|
pytest tests/integration/ -v --cov=. --cov-append --cov-report=term --cov-report=html --cov-report=xml 2>&1 | tee integration-test-output.txt
|
||||||
|
echo "INTEGRATION_TEST_EXIT_CODE=${PIPESTATUS[0]}" >> $GITHUB_ENV
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Display test results
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
echo "## Backend Test Results" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "### Unit Tests (Exit Code: ${UNIT_TEST_EXIT_CODE:-N/A})" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||||
|
tail -50 unit-test-output.txt >> $GITHUB_STEP_SUMMARY 2>/dev/null || echo "No unit test output" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "### Integration Tests (Exit Code: ${INTEGRATION_TEST_EXIT_CODE:-N/A})" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||||
|
tail -50 integration-test-output.txt >> $GITHUB_STEP_SUMMARY 2>/dev/null || echo "No integration test output" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
- name: Upload backend coverage report
|
- name: Upload backend coverage report
|
||||||
if: always()
|
if: always()
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
@@ -74,9 +91,21 @@ jobs:
|
|||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
- name: Run tests with coverage
|
- name: Run tests with coverage
|
||||||
run: npm run test:coverage
|
run: |
|
||||||
|
npm run test:coverage 2>&1 | tee test-output.txt
|
||||||
|
echo "FRONTEND_TEST_EXIT_CODE=${PIPESTATUS[0]}" >> $GITHUB_ENV
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Display test results
|
||||||
|
if: always()
|
||||||
|
run: |
|
||||||
|
echo "## Frontend Test Results" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "### Test Output (Exit Code: ${FRONTEND_TEST_EXIT_CODE:-N/A})" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||||
|
tail -50 test-output.txt >> $GITHUB_STEP_SUMMARY 2>/dev/null || echo "No test output" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo '```' >> $GITHUB_STEP_SUMMARY
|
||||||
|
|
||||||
- name: Upload frontend coverage report
|
- name: Upload frontend coverage report
|
||||||
if: always()
|
if: always()
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
|
|||||||
Reference in New Issue
Block a user