|
| 1 | +############################################################################ |
| 2 | +# |
| 3 | +# Workflow Description: |
| 4 | +# Organize all the testing coverage reports. (it would save reports by 'actions/upload-artifact@v3'). |
| 5 | +# |
| 6 | +# Workflow input parameters: |
| 7 | +# No input parameters. |
| 8 | +# |
| 9 | +# Workflow running output: |
| 10 | +# No, but it would save the testing coverage reports (coverage.xml) to provide after-process to organize and record. |
| 11 | +# |
| 12 | +############################################################################ |
| 13 | + |
| 14 | +name: Organize all testing coverage reports, e.g., different runtime OS, as a final testing coverage report. |
| 15 | + |
| 16 | +on: |
| 17 | + workflow_call: |
| 18 | + |
| 19 | + |
| 20 | +jobs: |
| 21 | + organize_and_generate_test_report: |
| 22 | + runs-on: ubuntu-latest |
| 23 | + steps: |
| 24 | + - name: Checkout |
| 25 | + uses: actions/checkout@v2 |
| 26 | + |
| 27 | + - name: Download code coverage result file |
| 28 | + uses: actions/download-artifact@v3 |
| 29 | + with: |
| 30 | + name: project_testing_coverage_report |
| 31 | + path: .coverage-* |
| 32 | + |
| 33 | + - name: Setup Python 3.10 in Ubuntu OS |
| 34 | + uses: actions/setup-python@v2 |
| 35 | + with: |
| 36 | + python-version: '3.10' |
| 37 | + |
| 38 | + - name: Install Python tool 'coverage' |
| 39 | + run: | |
| 40 | + python -m pip install --upgrade pip |
| 41 | + pip install -U pip |
| 42 | + pip install coverage |
| 43 | +
|
| 44 | + - name: Combine all code coverage result files |
| 45 | + run: coverage combine .coverage-* |
| 46 | + |
| 47 | + - name: Report testing coverage of project code |
| 48 | + run: coverage report -m |
| 49 | + |
| 50 | + - name: Generate testing coverage report as XML file |
| 51 | + run: coverage xml |
| 52 | + |
| 53 | + - name: Upload testing coverage report |
| 54 | + uses: actions/upload-artifact@v3 |
| 55 | + with: |
| 56 | + name: final_project_testing_coverage_report |
| 57 | + path: coverage.xml |
| 58 | + if-no-files-found: error |
0 commit comments