From 213fa93ea12cfe0a488ab3af5c1c918c88164ae0 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Fri, 19 Aug 2022 08:35:17 +0800 Subject: [PATCH 1/4] [Breaking Change] (config) 2 major changes: 1. Rename the workflow about organizing all testing coverage reports in different runtime OS and Python version. 2. Modify the steps. --- ...rage_reports_with_different_os_and_py_version.yaml} | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename .github/workflows/{organize_and_generate_testing_report.yaml => organize_all_testing_coverage_reports_with_different_os_and_py_version.yaml} (85%) diff --git a/.github/workflows/organize_and_generate_testing_report.yaml b/.github/workflows/organize_all_testing_coverage_reports_with_different_os_and_py_version.yaml similarity index 85% rename from .github/workflows/organize_and_generate_testing_report.yaml rename to .github/workflows/organize_all_testing_coverage_reports_with_different_os_and_py_version.yaml index 87fc7fd7..695fe581 100644 --- a/.github/workflows/organize_and_generate_testing_report.yaml +++ b/.github/workflows/organize_all_testing_coverage_reports_with_different_os_and_py_version.yaml @@ -11,7 +11,7 @@ # ############################################################################ -name: Upload test report to Codecov +name: Organize testing coverage reports as a testing coverage report on: workflow_call: @@ -52,12 +52,12 @@ jobs: - name: Report testing coverage of project code run: coverage report -m - - name: Generate testing report for Codacy - run: coverage xml + - name: Rename the testing coverage report with test type + run: mv .coverage .coverage-${{ inputs.test_type }} - name: Upload testing coverage report uses: actions/upload-artifact@v3 with: - name: project_coverage_report - path: coverage.xml + name: project_testing_coverage_report + path: .coverage-${{ inputs.test_type }} if-no-files-found: error From b112d78298bf95023a2ebc761ace300759dea08f Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Fri, 19 Aug 2022 08:38:32 +0800 Subject: [PATCH 2/4] [New Feature] (config) Add new reusable GitHub Action workflow about organizing all testing reports with different test types. --- ...ting_reports_with_different_test_type.yaml | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/organize_all_testing_reports_with_different_test_type.yaml diff --git a/.github/workflows/organize_all_testing_reports_with_different_test_type.yaml b/.github/workflows/organize_all_testing_reports_with_different_test_type.yaml new file mode 100644 index 00000000..bdd51fc2 --- /dev/null +++ b/.github/workflows/organize_all_testing_reports_with_different_test_type.yaml @@ -0,0 +1,58 @@ +############################################################################ +# +# Workflow Description: +# Organize all the testing coverage reports. (it would save reports by 'actions/upload-artifact@v3'). +# +# Workflow input parameters: +# 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: Organize all testing coverage reports, e.g., different runtime OS, as a final testing coverage report. + +on: + workflow_call: + + +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: project_testing_coverage_report + path: .coverage-* + + - name: Setup Python 3.10 in Ubuntu OS + uses: actions/setup-python@v2 + with: + python-version: '3.10' + + - name: Install Python tool 'coverage' + run: | + python -m pip install --upgrade pip + pip install -U pip + pip 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: Generate testing coverage report as XML file + run: coverage xml + + - name: Upload testing coverage report + uses: actions/upload-artifact@v3 + with: + name: final_project_testing_coverage_report + path: coverage.xml + if-no-files-found: error From a97587b3dcb64a4982cde2cd5120b33aecb337ee Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Fri, 19 Aug 2022 09:05:16 +0800 Subject: [PATCH 3/4] [Breaking Change] (config) Add a new input parameter and modify steps. --- ...orts_with_different_os_and_py_version.yaml | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/organize_all_testing_coverage_reports_with_different_os_and_py_version.yaml b/.github/workflows/organize_all_testing_coverage_reports_with_different_os_and_py_version.yaml index 695fe581..96dcad58 100644 --- a/.github/workflows/organize_all_testing_coverage_reports_with_different_os_and_py_version.yaml +++ b/.github/workflows/organize_all_testing_coverage_reports_with_different_os_and_py_version.yaml @@ -5,6 +5,8 @@ # # 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. @@ -20,6 +22,10 @@ on: 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: @@ -52,10 +58,24 @@ jobs: - 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 From fa4c1fbf62ca9b990bcd217ee6352b1d446e3246 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Fri, 19 Aug 2022 09:07:54 +0800 Subject: [PATCH 4/4] [Breaking Change] (config) Modify the download name to align with the workflow about organizing testing coverage reports. --- .github/workflows/upload_code_report_to_codacy.yaml | 2 +- .github/workflows/upload_test_report_to_codecov.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/upload_code_report_to_codacy.yaml b/.github/workflows/upload_code_report_to_codacy.yaml index 90b1185b..709003e7 100644 --- a/.github/workflows/upload_code_report_to_codacy.yaml +++ b/.github/workflows/upload_code_report_to_codacy.yaml @@ -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 diff --git a/.github/workflows/upload_test_report_to_codecov.yaml b/.github/workflows/upload_test_report_to_codecov.yaml index d3498de7..6912f550 100644 --- a/.github/workflows/upload_test_report_to_codecov.yaml +++ b/.github/workflows/upload_test_report_to_codecov.yaml @@ -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