Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
############################################################################
#
# Workflow Description:
# Organize all the testing coverage reports. (it would save reports by 'actions/upload-artifact@v3').
#
# Workflow input parameters:
# * test_type: The testing type. In generally, it only has 2 options: 'unit-test' and 'integration-test'.
# * generate_xml_report_finally: Something, it only has 1 test type currently. So it could let this option
# to be 'true' than it would generate XML report finally to let uploading process to use it directly.
#
# Workflow running output:
# No, but it would save the testing coverage reports (coverage.xml) to provide after-process to organize and record.
#
############################################################################

name: Organize testing coverage reports as a testing coverage report

on:
workflow_call:
inputs:
test_type:
description: "The testing type. In generally, it only has 2 options: 'unit-test' and 'integration-test'."
required: true
type: string
generate_xml_report_finally:
description: "Something, it only has 1 test type currently. So it could let this option to be 'true' than it would generate XML report finally to let uploading process to use it directly."
required: true
type: boolean


jobs:
organize_and_generate_test_report:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Download code coverage result file
uses: actions/download-artifact@v3
with:
name: coverage
path: .coverage.${{ inputs.test_type }}*

- name: Setup Python 3.10 in Ubuntu OS
uses: actions/setup-python@v2
with:
python-version: '3.10'

- name: Install Python tool 'coverage'
run: |
python3 -m pip install --upgrade pip
pip3 install -U pip
pip3 install coverage

- name: Combine all code coverage result files
run: coverage combine .coverage.*

- name: Report testing coverage of project code
run: coverage report -m

- name: General testing coverage report as XML format
if: ${{ inputs.generate_xml_report_finally }} == 'true'
run: coverage xml

- name: Rename the testing coverage report with test type
if: ${{ inputs.generate_xml_report_finally }} == 'false'
run: mv .coverage .coverage-${{ inputs.test_type }}

- name: Upload testing coverage report
if: ${{ inputs.generate_xml_report_finally }} == 'true'
uses: actions/upload-artifact@v3
with:
name: final_project_testing_coverage_report
path: coverage.xml
if-no-files-found: error

- name: Upload testing coverage report
if: ${{ inputs.generate_xml_report_finally }} == 'false'
uses: actions/upload-artifact@v3
with:
name: project_testing_coverage_report
path: .coverage-${{ inputs.test_type }}
if-no-files-found: error
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,17 @@
# Organize all the testing coverage reports. (it would save reports by 'actions/upload-artifact@v3').
#
# Workflow input parameters:
# * test_type: The testing type. In generally, it only has 2 options: 'unit-test' and 'integration-test'.
# No input parameters.
#
# Workflow running output:
# No, but it would save the testing coverage reports (coverage.xml) to provide after-process to organize and record.
#
############################################################################

name: Upload test report to Codecov
name: Organize all testing coverage reports, e.g., different runtime OS, as a final testing coverage report.

on:
workflow_call:
inputs:
test_type:
description: "The testing type. In generally, it only has 2 options: 'unit-test' and 'integration-test'."
required: true
type: string


jobs:
Expand All @@ -32,8 +27,8 @@ jobs:
- name: Download code coverage result file
uses: actions/download-artifact@v3
with:
name: coverage
path: .coverage.${{ inputs.test_type }}*
name: project_testing_coverage_report
path: .coverage-*

- name: Setup Python 3.10 in Ubuntu OS
uses: actions/setup-python@v2
Expand All @@ -42,22 +37,22 @@ jobs:

- name: Install Python tool 'coverage'
run: |
python3 -m pip install --upgrade pip
pip3 install -U pip
pip3 install coverage
python -m pip install --upgrade pip
pip install -U pip
pip install coverage

- name: Combine all code coverage result files
run: coverage combine .coverage.*
run: coverage combine .coverage-*

- name: Report testing coverage of project code
run: coverage report -m

- name: Generate testing report for Codacy
- name: Generate testing coverage report as XML file
run: coverage xml

- name: Upload testing coverage report
uses: actions/upload-artifact@v3
with:
name: project_coverage_report
name: final_project_testing_coverage_report
path: coverage.xml
if-no-files-found: error
2 changes: 1 addition & 1 deletion .github/workflows/upload_code_report_to_codacy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- name: Download testing coverage report
uses: actions/download-artifact@v3
with:
name: project_coverage_report
name: final_project_testing_coverage_report
path: ${{ inputs.download_path }}

- name: Generate testing report for Codacy
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upload_test_report_to_codecov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Download code coverage result file
uses: actions/download-artifact@v3
with:
name: project_coverage_report
name: final_project_testing_coverage_report
path: ${{ inputs.download_path }}

- name: Upload coverage report to platform Codecov
Expand Down