Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
oferqm authored Feb 15, 2024
1 parent f50cb85 commit d30cdc2
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion .github/workflows/quam_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,35 @@ jobs:
- name: Test with pytest
run: |
pip install pytest
pytest
pytest
- name: Run pytest and generate a report
run: pytest --junitxml=pytest-report.xml
- name: Upload pytest report as an artifact
uses: actions/upload-artifact@v2
with:
name: pytest-report-${{ matrix.python-version }}
path: pytest-report.xml

- name: Add test report summary to run summary
if: success() || failure() # This makes it run regardless of the job outcome
uses: actions/github-script@v5
with:
script: |
const reportPath = '${{ github.workspace }}/pytest-report.xml';
const report = require('fs').readFileSync(reportPath, 'utf-8');
// Parse the XML report or extract relevant information here
// This example assumes you have a way to extract a summary from your report
// For simplicity, we're just adding a placeholder message
const summary = `### Test Report Summary\n\n- Total Tests: X\n- Passed: Y\n- Failed: Z\n\nSee [pytest-report-${{ matrix.python-version }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts) for more details.`;
console.log(summary);
github.rest.actions.createWorkflowRunSummary({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.runId,
text: summary,
headers: {
'Content-Type': 'text/markdown',
},
});

0 comments on commit d30cdc2

Please sign in to comment.