From 64ce07497bc5b3ee6cd3b87989f20b6fefe115ff Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sat, 20 Aug 2022 10:38:27 +0800 Subject: [PATCH 01/31] [New Feature] (script) Add sample shell scripts for testing. --- scripts/ci/get-integration-test-paths.sh | 34 +++++++++++++++++ scripts/ci/get-unit-test-paths.sh | 34 +++++++++++++++++ scripts/run_pytest_in_develop.sh | 47 ++++++++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 scripts/ci/get-integration-test-paths.sh create mode 100644 scripts/ci/get-unit-test-paths.sh create mode 100644 scripts/run_pytest_in_develop.sh diff --git a/scripts/ci/get-integration-test-paths.sh b/scripts/ci/get-integration-test-paths.sh new file mode 100644 index 00000000..45ab8e9c --- /dev/null +++ b/scripts/ci/get-integration-test-paths.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +set -ex +runtime_os=$1 + +declare -a base_tests + +getalltests() { + declare -a testpatharray=( $(ls -F "$1" | grep -v '/$' | grep -v '__init__.py' | grep -v 'test_config.py' | grep -v -E '^_[a-z_]{1,64}.py' | grep -v '__pycache__')) + + declare -a alltestpaths + for (( i = 0; i < ${#testpatharray[@]}; i++ )) ; do + alltestpaths[$i]=$1${testpatharray[$i]} + done + + base_tests=("${alltestpaths[@]}") +} + +base_path=test/integration_test/ + +getalltests $base_path + +dest=( "${base_tests[@]}" ) + + +if echo "$runtime_os" | grep -q "windows"; +then + printf '%s\n' "${dest[@]}" | jq -R . +elif echo "$runtime_os" | grep -q "unix"; +then + printf '%s\n' "${dest[@]}" | jq -R . | jq -cs . +else + printf 'error' | jq -R . +fi diff --git a/scripts/ci/get-unit-test-paths.sh b/scripts/ci/get-unit-test-paths.sh new file mode 100644 index 00000000..6c615137 --- /dev/null +++ b/scripts/ci/get-unit-test-paths.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +set -ex +runtime_os=$1 + +declare -a init_tests + +getalltests() { + declare -a testpatharray=( $(ls -F "$1" | grep -v '/$' | grep -v '__init__.py' | grep -v 'test_config.py' | grep -v -E '^_[a-z_]{1,64}.py' | grep -v '__pycache__')) + + declare -a alltestpaths + for (( i = 0; i < ${#testpatharray[@]}; i++ )) ; do + alltestpaths[$i]=$1${testpatharray[$i]} + done + + init_tests=("${alltestpaths[@]}") +} + +init_path=test/unit_test/ + +getalltests $init_path + +dest=( "${init_tests[@]}" ) + + +if echo "$runtime_os" | grep -q "windows"; +then + printf "${dest[@]}" | jq -R . +elif echo "$runtime_os" | grep -q "unix"; +then + printf '%s\n' "${dest[@]}" | jq -R . | jq -cs . +else + printf 'error' | jq -R . +fi diff --git a/scripts/run_pytest_in_develop.sh b/scripts/run_pytest_in_develop.sh new file mode 100644 index 00000000..0c21f47b --- /dev/null +++ b/scripts/run_pytest_in_develop.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash + +########################################################################################## +# +# Target: +# For develop to be more easier to run testing via *pytest*. +# +# Description: +# It does 2 things: run script for getting testing items and run the testing via tool *pytest*. +# This bash file must to receive a argument *testing_type* which is the key condition to let +# script runs unit test or integration test. +# +# Allowable argument: +# * unit-test: Get and run unit test. +# * integration-test: Get and run integration test. +# +########################################################################################## + +set -exm +testing_type=$1 +echo "⚙️ It would run the " + testing_type + " of the Python package SmoothCrawler-Cluster." + +echo "🔍 Get the testing items ... ⏳" + +if echo "$testing_type" | grep -q "unit-test"; +then + test_path=$(bash ./scripts/ci/get-unit-test-paths.sh windows | sed "s/\"//g" | sed 's/^//') +elif echo "$testing_type" | grep -q "integration-test"; +then + test_path=$(bash ./scripts/ci/get-integration-test-paths.sh windows | sed "s/\"//g" | sed 's/^//') +else + test_path='error' +fi + +if echo $test_path | grep -q "error"; +then + echo "❌ Got error when it tried to get testing items... 😱" + exit 1 +else + echo "🎉🎊🍾 Get the testing items successfully!" + echo "📄 The testing items are: " + echo $test_path + + echo "🤖⚒ It would start to run testing with Python testing framework *pytest*." + pytest $test_path +fi + From 84d76b242daab788c9ba634e0e8c5f5bbb5ec68b Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sat, 20 Aug 2022 10:39:12 +0800 Subject: [PATCH 02/31] [New Feature] (code) Add sample Python library source code. --- test_gh_workflow/__init__.py | 1 + test_gh_workflow/sample.py | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 test_gh_workflow/__init__.py create mode 100644 test_gh_workflow/sample.py diff --git a/test_gh_workflow/__init__.py b/test_gh_workflow/__init__.py new file mode 100644 index 00000000..9730af16 --- /dev/null +++ b/test_gh_workflow/__init__.py @@ -0,0 +1 @@ +# # This test directory for testing to simulate a Python library project structure. diff --git a/test_gh_workflow/sample.py b/test_gh_workflow/sample.py new file mode 100644 index 00000000..682c3790 --- /dev/null +++ b/test_gh_workflow/sample.py @@ -0,0 +1,3 @@ + +def hello_python() -> str: + return "Hello Python" From 56a953530b209361b3f6cdbdd00c4749af258e43 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sat, 20 Aug 2022 10:39:39 +0800 Subject: [PATCH 03/31] [New Feature] (test) Add sample test code of Python library project. --- test/__init__.py | 1 + test/integration_test/__init__.py | 0 test/integration_test/sample.py | 15 +++++++++++++++ test/unit_test/__init__.py | 0 test/unit_test/sample.py | 15 +++++++++++++++ 5 files changed, 31 insertions(+) create mode 100644 test/__init__.py create mode 100644 test/integration_test/__init__.py create mode 100644 test/integration_test/sample.py create mode 100644 test/unit_test/__init__.py create mode 100644 test/unit_test/sample.py diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 00000000..9730af16 --- /dev/null +++ b/test/__init__.py @@ -0,0 +1 @@ +# # This test directory for testing to simulate a Python library project structure. diff --git a/test/integration_test/__init__.py b/test/integration_test/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/integration_test/sample.py b/test/integration_test/sample.py new file mode 100644 index 00000000..cac9f336 --- /dev/null +++ b/test/integration_test/sample.py @@ -0,0 +1,15 @@ +import test_gh_workflow.sample +import logging +import pytest + + +@pytest.fixture(scope="function") +def get_hello_python() -> str: + return test_gh_workflow.sample.hello_python() + + +def test_sample(get_hello_python: str) -> None: + logging.info("Start Integration test.") + assert get_hello_python == "Hello Python", "The return value should be 'Hello Python'." + logging.info("This is Integration test done.") + diff --git a/test/unit_test/__init__.py b/test/unit_test/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/unit_test/sample.py b/test/unit_test/sample.py new file mode 100644 index 00000000..8ac2a03c --- /dev/null +++ b/test/unit_test/sample.py @@ -0,0 +1,15 @@ +import test_gh_workflow.sample +import logging +import pytest + + +@pytest.fixture(scope="function") +def get_hello_python() -> str: + return test_gh_workflow.sample.hello_python() + + +def test_sample(get_hello_python: str) -> None: + logging.info("Start Unit test.") + assert get_hello_python == "Hello Python", "The return value should be 'Hello Python'." + logging.info("This is Unit test done.") + From 9ce19eba178e3b76e2f82da5737cea0e19786279 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sat, 20 Aug 2022 10:40:41 +0800 Subject: [PATCH 04/31] [New Feature] (config) Add sample testing coverage configuration for Python library source code. --- .coveragerc | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 00000000..3834c598 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,11 @@ +# # This test directory for testing to simulate a Python library project structure. + +[run] +parallel = True +relative_files = True +source=./test_gh_workflow + +omit = + */__init__.py + +#ignore_errors = True From 8ec68f903b1677771a713d8d69d3f59e6f97e6d1 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sat, 20 Aug 2022 10:41:14 +0800 Subject: [PATCH 05/31] [New Feature] (config) Add sample PyTest configuration. --- pytest.ini | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 pytest.ini diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 00000000..2f66d7ab --- /dev/null +++ b/pytest.ini @@ -0,0 +1,14 @@ +# # This test directory for testing to simulate a Python library project structure. + +# pytest.ini +[pytest] +minversion = 0.1.0 + +addopts = + --cov=./test_gh_workflow + --cov-config=./.coveragerc + -r a + -v + --reruns 3 + +testpaths = From 327e81572588dcb24080ccdeed8f924974dfa6bc Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sat, 20 Aug 2022 10:41:59 +0800 Subject: [PATCH 06/31] [New Feature] (config) Add sample configuration for Codecov service. --- codecov.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 codecov.yml diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..b305b67a --- /dev/null +++ b/codecov.yml @@ -0,0 +1,4 @@ +# # This test directory for testing to simulate a Python library project structure. + +codecov: + token: $CODECOV_TOKEN From 10d77307ffc3fe69fd85b37a0184f01ca03fef20 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sat, 20 Aug 2022 10:42:54 +0800 Subject: [PATCH 07/31] [New Feature] (config) Add .gitignore setting for development. --- .gitignore | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..7a71fa75 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +# # This test directory for testing to simulate a Python library project structure. + +.DS_Store +__pycache__ +.coverage +.coverage.* +.pypirc +.pytest_cache/ +.python-version +code_source/ +coverage.xml From e41a5cf08c6b485c356e5bbbbe643efcc7c0d68a Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sat, 20 Aug 2022 10:44:36 +0800 Subject: [PATCH 08/31] [New Feature] (config) Add configuration of CI tool GitHub Action. --- .../workflows/test-reusable-workflows.yaml | 120 ++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 .github/workflows/test-reusable-workflows.yaml diff --git a/.github/workflows/test-reusable-workflows.yaml b/.github/workflows/test-reusable-workflows.yaml new file mode 100644 index 00000000..9b840dad --- /dev/null +++ b/.github/workflows/test-reusable-workflows.yaml @@ -0,0 +1,120 @@ +name: github-action reusable workflows test +on: + push: + branches: + - "develop" + - "release" + - "release-**" + - "release/**" + - "master" + paths-ignore: + - ".gitcommitrules" + - ".gitignore" + - "LICENSE" + - "README.md" + pull_request: + branches: + - "develop" + - "release" + - "release-**" + - "release/**" + paths-ignore: + - ".gitcommitrules" + - ".gitignore" + - "LICENSE" + - "README.md" + +jobs: + + prep-testbed_unit-test: +# name: Prepare all unit test items + uses: Chisanan232/GitHub-Action-Template-Python/.github/workflows/prepare_test_items.yaml@master + with: + shell_path: scripts/ci/get-unit-test-paths.sh + shell_arg: unix + + + prep-testbed_integration-test: +# name: Prepare all integration test items + uses: Chisanan232/GitHub-Action-Template-Python/.github/workflows/prepare_test_items.yaml@master + with: + shell_path: scripts/ci/get-integration-test-paths.sh + shell_arg: unix + + + run_unit-test: +# name: Run all unit test items + needs: prep-testbed_unit-test + uses: Chisanan232/GitHub-Action-Template-Python/.github/workflows/run_test_items_via_pytest.yaml@master + with: + test_type: unit-test + all_test_items_paths: ${{needs.prep-testbed_unit-test.outputs.all_test_items}} + + + run_integration-test: +# name: Run all integration test items. This testing would test the code with other resource or system to ensure the features work finely. + needs: prep-testbed_integration-test + uses: Chisanan232/GitHub-Action-Template-Python/.github/workflows/run_test_items_via_pytest.yaml@master + with: + test_type: integration-test + all_test_items_paths: ${{needs.prep-testbed_integration-test.outputs.all_test_items}} + + + unit-test_codecov: +# name: Organize and generate the testing report and upload it to Codecov + needs: run_unit-test + uses: Chisanan232/GitHub-Action-Template-Python/.github/workflows/organize_all_testing_coverage_reports_with_different_os_and_py_version.yaml@master + with: + test_type: unit-test + generate_xml_report_finally: false + + + integration-test_codecov: +# name: Organize and generate the testing report and upload it to Codecov + needs: run_integration-test + uses: Chisanan232/GitHub-Action-Template-Python/.github/workflows/organize_all_testing_coverage_reports_with_different_os_and_py_version.yaml@master + with: + test_type: integration-test + generate_xml_report_finally: false + + + organize_all-test_codecov_and_generate_report: +# name: Organize and generate the testing report and upload it to Codecov + needs: [unit-test_codecov, integration-test_codecov] + uses: Chisanan232/GitHub-Action-Template-Python/.github/workflows/organize_all_testing_reports_with_different_test_type.yaml@master + + + codecov_finish: +# name: Organize and generate the testing report and upload it to Codecov + if: github.ref_name == 'release' || github.ref_name == 'master' + needs: organize_all-test_codecov_and_generate_report + uses: Chisanan232/GitHub-Action-Template-Python/.github/workflows/upload_test_report_to_codecov.yaml@master + secrets: + codecov_token: ${{ secrets.CODECOV_TOKEN }} + with: + download_path: ./ + codecov_flags: unit-test, integration-test + codecov_name: smoothcrawler-appintegration_github-actions_test # optional + + + codacy_finish: +# name: Upload test report to Codacy to analyse and record code quality + needs: [codecov_finish] + uses: Chisanan232/GitHub-Action-Template-Python/.github/workflows/upload_code_report_to_codacy.yaml@master + secrets: + codacy_token: ${{ secrets.CODACY_PROJECT_TOKEN }} + with: + download_path: ./coverage.xml + + +# pre-building_check: +## name: Check about it could work finely by installing the Python package with setup.py file +# needs: [codecov_finish, codacy_finish] +# uses: Chisanan232/GitHub-Action-Template-Python/.github/workflows/upload_code_report_to_codacy.yaml +# with: +# python_package_name: smoothcrawler +# test_import_package_code_1: import smoothcrawler as mr +# test_import_package_code_2: from smoothcrawler.crawler import SimpleCrawler +# test_import_package_code_3: from smoothcrawler.components.data import BaseHTTPResponseParser, BaseDataHandler +# test_python_script: ./scripts/test_crawler.py + From 5ae160b001a4d320f4454a937f9daba9da16ec6b Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sat, 20 Aug 2022 11:29:11 +0800 Subject: [PATCH 09/31] [New Feature] (config) Add sample configuration about Python dependencies via requirements format file. --- requirements/requirements-test.txt | 11 +++++++++++ requirements/requirements.txt | 2 ++ 2 files changed, 13 insertions(+) create mode 100644 requirements/requirements-test.txt create mode 100644 requirements/requirements.txt diff --git a/requirements/requirements-test.txt b/requirements/requirements-test.txt new file mode 100644 index 00000000..a059ff3f --- /dev/null +++ b/requirements/requirements-test.txt @@ -0,0 +1,11 @@ +###### SmoothCrawler-AppIntegration Development (or Testing) Dependencies Requirements ###### +## For running pytest ## +pytest >= 7.0.0 +pytest-cov >= 3.0.0 +pytest-html >= 3.1.1 +pytest-rerunfailures >= 10.2 + +## For calculating code coverage ## +coverage >= 6.2 # In Python 3.6, its latest version supported is 6.2. But it supports 6.4 version in Python 3.10. +codecov >= 2.1.12 +coveralls >= 3.3.1 diff --git a/requirements/requirements.txt b/requirements/requirements.txt new file mode 100644 index 00000000..f97a1e17 --- /dev/null +++ b/requirements/requirements.txt @@ -0,0 +1,2 @@ +###### SmoothCrawler-AppIntegration Dependencies Requirements ###### +## Code - Basic ## From f716582d7fdff75ce41169758f398902e371b6e5 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sat, 20 Aug 2022 16:39:11 +0800 Subject: [PATCH 10/31] [Bug Fix] (config) Fix the issue about incorrect usage at if-condition. --- ...coverage_reports_with_different_os_and_py_version.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 96dcad58..688e52cc 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 @@ -59,15 +59,15 @@ jobs: run: coverage report -m - name: General testing coverage report as XML format - if: ${{ inputs.generate_xml_report_finally }} == 'true' + 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' + 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' + if: inputs.generate_xml_report_finally == 'true' uses: actions/upload-artifact@v3 with: name: final_project_testing_coverage_report @@ -75,7 +75,7 @@ jobs: if-no-files-found: error - name: Upload testing coverage report - if: ${{ inputs.generate_xml_report_finally }} == 'false' + if: inputs.generate_xml_report_finally == 'false' uses: actions/upload-artifact@v3 with: name: project_testing_coverage_report From 4349ea8d19e5dd29bc8a058087e449325a963512 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sat, 20 Aug 2022 16:44:18 +0800 Subject: [PATCH 11/31] [Bug Fix] (config) Fix the issue about incorrect usage at if-condition. --- ...coverage_reports_with_different_os_and_py_version.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 688e52cc..4f99c88a 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 @@ -59,15 +59,15 @@ jobs: run: coverage report -m - name: General testing coverage report as XML format - if: inputs.generate_xml_report_finally == 'true' + 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' + 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' + if: ${{ inputs.generate_xml_report_finally == 'true' }} uses: actions/upload-artifact@v3 with: name: final_project_testing_coverage_report @@ -75,7 +75,7 @@ jobs: if-no-files-found: error - name: Upload testing coverage report - if: inputs.generate_xml_report_finally == 'false' + if: ${{ inputs.generate_xml_report_finally == 'false' }} uses: actions/upload-artifact@v3 with: name: project_testing_coverage_report From 4ec69d0817b3bfbfd5182d249c75a48ad208f522 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sat, 20 Aug 2022 16:50:18 +0800 Subject: [PATCH 12/31] [Bug Fix] (config) Fix the issue about incorrect usage at if-condition. --- ...coverage_reports_with_different_os_and_py_version.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 4f99c88a..0db60ad2 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 @@ -59,15 +59,15 @@ jobs: run: coverage report -m - name: General testing coverage report as XML format - if: ${{ inputs.generate_xml_report_finally == 'true' }} + 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' }} + 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' }} + if: ${{ inputs.generate_xml_report_finally == true }} uses: actions/upload-artifact@v3 with: name: final_project_testing_coverage_report @@ -75,7 +75,7 @@ jobs: if-no-files-found: error - name: Upload testing coverage report - if: ${{ inputs.generate_xml_report_finally == 'false' }} + if: ${{ inputs.generate_xml_report_finally == false }} uses: actions/upload-artifact@v3 with: name: project_testing_coverage_report From c3c589741b3a789609bd9d424fa3fad96427d923 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sat, 20 Aug 2022 17:08:00 +0800 Subject: [PATCH 13/31] [Bug Fix] (config) Fix the issue about incorrect usage at if-condition. --- ...coverage_reports_with_different_os_and_py_version.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 0db60ad2..688e52cc 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 @@ -59,15 +59,15 @@ jobs: run: coverage report -m - name: General testing coverage report as XML format - if: ${{ inputs.generate_xml_report_finally == true }} + 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 }} + 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 }} + if: inputs.generate_xml_report_finally == 'true' uses: actions/upload-artifact@v3 with: name: final_project_testing_coverage_report @@ -75,7 +75,7 @@ jobs: if-no-files-found: error - name: Upload testing coverage report - if: ${{ inputs.generate_xml_report_finally == false }} + if: inputs.generate_xml_report_finally == 'false' uses: actions/upload-artifact@v3 with: name: project_testing_coverage_report From de4f167305d794f6d5c2580123319f6e7ee0ea19 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sat, 20 Aug 2022 17:16:42 +0800 Subject: [PATCH 14/31] [Bug Fix] (config) Fix the issue about incorrect usage at if-condition. --- ...coverage_reports_with_different_os_and_py_version.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 688e52cc..0db60ad2 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 @@ -59,15 +59,15 @@ jobs: run: coverage report -m - name: General testing coverage report as XML format - if: inputs.generate_xml_report_finally == 'true' + 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' + 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' + if: ${{ inputs.generate_xml_report_finally == true }} uses: actions/upload-artifact@v3 with: name: final_project_testing_coverage_report @@ -75,7 +75,7 @@ jobs: if-no-files-found: error - name: Upload testing coverage report - if: inputs.generate_xml_report_finally == 'false' + if: ${{ inputs.generate_xml_report_finally == false }} uses: actions/upload-artifact@v3 with: name: project_testing_coverage_report From 35410cd9d81aa2b309b7f61bfbc9afdd6d2c2d42 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sat, 20 Aug 2022 17:42:44 +0800 Subject: [PATCH 15/31] [Bug Fix] (config) Fix the issue about incorrect usage at if-condition. --- ...sting_coverage_reports_with_different_os_and_py_version.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 0db60ad2..0d20c52f 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 @@ -24,8 +24,8 @@ on: 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 + required: true jobs: From 9c44a07b89ae4ef8290a36da0dbe37d086a267b6 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sat, 20 Aug 2022 17:46:20 +0800 Subject: [PATCH 16/31] [Bug Fix] (config) Fix the issue about incorrect usage at if-condition. --- ...ting_coverage_reports_with_different_os_and_py_version.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 0d20c52f..72bdfbfa 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 @@ -25,7 +25,8 @@ on: 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." type: boolean - required: true + required: false + default: false jobs: From 6682cf55bf4bc74528cb19af6317ea2124ff7ea2 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sat, 20 Aug 2022 17:56:35 +0800 Subject: [PATCH 17/31] [Bug Fix] (config) Fix the issue about incorrect usage at if-condition. --- ...age_reports_with_different_os_and_py_version.yaml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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 72bdfbfa..a616b0de 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 @@ -60,15 +60,18 @@ jobs: run: coverage report -m - name: General testing coverage report as XML format - if: ${{ inputs.generate_xml_report_finally == true }} +# if: ${{ inputs.generate_xml_report_finally == true }} + 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 }} +# if: ${{ inputs.generate_xml_report_finally == false }} + 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 }} +# if: ${{ inputs.generate_xml_report_finally == true }} + if: inputs.generate_xml_report_finally == 'true' uses: actions/upload-artifact@v3 with: name: final_project_testing_coverage_report @@ -76,7 +79,8 @@ jobs: if-no-files-found: error - name: Upload testing coverage report - if: ${{ inputs.generate_xml_report_finally == false }} +# if: ${{ inputs.generate_xml_report_finally == false }} + if: inputs.generate_xml_report_finally == 'false' uses: actions/upload-artifact@v3 with: name: project_testing_coverage_report From 07fffed05b3a2b6b247800bf8eaea1c0df008554 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sun, 21 Aug 2022 13:20:10 +0800 Subject: [PATCH 18/31] [Bug Fix + Test] (config) Modify the if-condition usage to job level. --- ...orts_with_different_os_and_py_version.yaml | 47 ++++++++++++++----- 1 file changed, 35 insertions(+), 12 deletions(-) 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 a616b0de..b4b6ff33 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 @@ -30,7 +30,7 @@ on: jobs: - organize_and_generate_test_report: + organize_test_reports: runs-on: ubuntu-latest steps: - name: Checkout @@ -59,28 +59,51 @@ jobs: - name: Report testing coverage of project code run: coverage report -m + - name: Upload testing coverage report + uses: actions/upload-artifact@v3 + with: + name: project_testing_coverage_report_with_test_type + path: .coverage + if-no-files-found: error + + generate_final_test_report: + if: ${{ inputs.generate_xml_report_finally == true }} +# if: inputs.generate_xml_report_finally == 'true' + needs: organize_test_reports + runs-on: ubuntu-latest + steps: + - name: Download code coverage result file + uses: actions/download-artifact@v3 + with: + name: project_testing_coverage_report_with_test_type + path: .coverage + - name: General testing coverage report as XML format -# if: ${{ inputs.generate_xml_report_finally == true }} - 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 }} - 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 }} - 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 + generate_test_type_report: + if: ${{ inputs.generate_xml_report_finally == false }} +# if: inputs.generate_xml_report_finally == 'false' + needs: organize_test_reports + runs-on: ubuntu-latest + steps: + - name: Download code coverage result file + uses: actions/download-artifact@v3 + with: + name: project_testing_coverage_report_with_test_type + path: .coverage + + - name: Rename the testing coverage report with test type + run: mv .coverage .coverage-${{ inputs.test_type }} + - name: Upload testing coverage report -# if: ${{ inputs.generate_xml_report_finally == false }} - if: inputs.generate_xml_report_finally == 'false' uses: actions/upload-artifact@v3 with: name: project_testing_coverage_report From ab69975733c96829a4fc427c10e39a97be6384a8 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sun, 21 Aug 2022 13:25:50 +0800 Subject: [PATCH 19/31] [Bug Fix] (config) Bug the issue about it only call the reusable workflows from git branch 'master' in CI testing process. --- .github/workflows/test-reusable-workflows.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test-reusable-workflows.yaml b/.github/workflows/test-reusable-workflows.yaml index 9b840dad..356f8267 100644 --- a/.github/workflows/test-reusable-workflows.yaml +++ b/.github/workflows/test-reusable-workflows.yaml @@ -28,7 +28,7 @@ jobs: prep-testbed_unit-test: # name: Prepare all unit test items - uses: Chisanan232/GitHub-Action-Template-Python/.github/workflows/prepare_test_items.yaml@master + uses: ./.github/workflows/prepare_test_items.yaml@master with: shell_path: scripts/ci/get-unit-test-paths.sh shell_arg: unix @@ -36,7 +36,7 @@ jobs: prep-testbed_integration-test: # name: Prepare all integration test items - uses: Chisanan232/GitHub-Action-Template-Python/.github/workflows/prepare_test_items.yaml@master + uses: ./.github/workflows/prepare_test_items.yaml@master with: shell_path: scripts/ci/get-integration-test-paths.sh shell_arg: unix @@ -45,7 +45,7 @@ jobs: run_unit-test: # name: Run all unit test items needs: prep-testbed_unit-test - uses: Chisanan232/GitHub-Action-Template-Python/.github/workflows/run_test_items_via_pytest.yaml@master + uses: ./.github/workflows/run_test_items_via_pytest.yaml@master with: test_type: unit-test all_test_items_paths: ${{needs.prep-testbed_unit-test.outputs.all_test_items}} @@ -54,7 +54,7 @@ jobs: run_integration-test: # name: Run all integration test items. This testing would test the code with other resource or system to ensure the features work finely. needs: prep-testbed_integration-test - uses: Chisanan232/GitHub-Action-Template-Python/.github/workflows/run_test_items_via_pytest.yaml@master + uses: ./.github/workflows/run_test_items_via_pytest.yaml@master with: test_type: integration-test all_test_items_paths: ${{needs.prep-testbed_integration-test.outputs.all_test_items}} @@ -63,7 +63,7 @@ jobs: unit-test_codecov: # name: Organize and generate the testing report and upload it to Codecov needs: run_unit-test - uses: Chisanan232/GitHub-Action-Template-Python/.github/workflows/organize_all_testing_coverage_reports_with_different_os_and_py_version.yaml@master + uses: ./.github/workflows/organize_all_testing_coverage_reports_with_different_os_and_py_version.yaml@master with: test_type: unit-test generate_xml_report_finally: false @@ -72,7 +72,7 @@ jobs: integration-test_codecov: # name: Organize and generate the testing report and upload it to Codecov needs: run_integration-test - uses: Chisanan232/GitHub-Action-Template-Python/.github/workflows/organize_all_testing_coverage_reports_with_different_os_and_py_version.yaml@master + uses: ./.github/workflows/organize_all_testing_coverage_reports_with_different_os_and_py_version.yaml@master with: test_type: integration-test generate_xml_report_finally: false @@ -81,14 +81,14 @@ jobs: organize_all-test_codecov_and_generate_report: # name: Organize and generate the testing report and upload it to Codecov needs: [unit-test_codecov, integration-test_codecov] - uses: Chisanan232/GitHub-Action-Template-Python/.github/workflows/organize_all_testing_reports_with_different_test_type.yaml@master + uses: ./.github/workflows/organize_all_testing_reports_with_different_test_type.yaml@master codecov_finish: # name: Organize and generate the testing report and upload it to Codecov if: github.ref_name == 'release' || github.ref_name == 'master' needs: organize_all-test_codecov_and_generate_report - uses: Chisanan232/GitHub-Action-Template-Python/.github/workflows/upload_test_report_to_codecov.yaml@master + uses: ./.github/workflows/upload_test_report_to_codecov.yaml@master secrets: codecov_token: ${{ secrets.CODECOV_TOKEN }} with: @@ -100,7 +100,7 @@ jobs: codacy_finish: # name: Upload test report to Codacy to analyse and record code quality needs: [codecov_finish] - uses: Chisanan232/GitHub-Action-Template-Python/.github/workflows/upload_code_report_to_codacy.yaml@master + uses: ./.github/workflows/upload_code_report_to_codacy.yaml@master secrets: codacy_token: ${{ secrets.CODACY_PROJECT_TOKEN }} with: From 9ede387b884ebac1dafbdf31f1e27a3e007b968e Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sun, 21 Aug 2022 13:27:55 +0800 Subject: [PATCH 20/31] [Bug Fix] (config) Fix the issue about call reusable workflows in local, it does not need to send git branch info. --- .github/workflows/test-reusable-workflows.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test-reusable-workflows.yaml b/.github/workflows/test-reusable-workflows.yaml index 356f8267..c658c95c 100644 --- a/.github/workflows/test-reusable-workflows.yaml +++ b/.github/workflows/test-reusable-workflows.yaml @@ -28,7 +28,7 @@ jobs: prep-testbed_unit-test: # name: Prepare all unit test items - uses: ./.github/workflows/prepare_test_items.yaml@master + uses: ./.github/workflows/prepare_test_items.yaml with: shell_path: scripts/ci/get-unit-test-paths.sh shell_arg: unix @@ -36,7 +36,7 @@ jobs: prep-testbed_integration-test: # name: Prepare all integration test items - uses: ./.github/workflows/prepare_test_items.yaml@master + uses: ./.github/workflows/prepare_test_items.yaml with: shell_path: scripts/ci/get-integration-test-paths.sh shell_arg: unix @@ -45,7 +45,7 @@ jobs: run_unit-test: # name: Run all unit test items needs: prep-testbed_unit-test - uses: ./.github/workflows/run_test_items_via_pytest.yaml@master + uses: ./.github/workflows/run_test_items_via_pytest.yaml with: test_type: unit-test all_test_items_paths: ${{needs.prep-testbed_unit-test.outputs.all_test_items}} @@ -54,7 +54,7 @@ jobs: run_integration-test: # name: Run all integration test items. This testing would test the code with other resource or system to ensure the features work finely. needs: prep-testbed_integration-test - uses: ./.github/workflows/run_test_items_via_pytest.yaml@master + uses: ./.github/workflows/run_test_items_via_pytest.yaml with: test_type: integration-test all_test_items_paths: ${{needs.prep-testbed_integration-test.outputs.all_test_items}} @@ -63,7 +63,7 @@ jobs: unit-test_codecov: # name: Organize and generate the testing report and upload it to Codecov needs: run_unit-test - uses: ./.github/workflows/organize_all_testing_coverage_reports_with_different_os_and_py_version.yaml@master + uses: ./.github/workflows/organize_all_testing_coverage_reports_with_different_os_and_py_version.yaml with: test_type: unit-test generate_xml_report_finally: false @@ -72,7 +72,7 @@ jobs: integration-test_codecov: # name: Organize and generate the testing report and upload it to Codecov needs: run_integration-test - uses: ./.github/workflows/organize_all_testing_coverage_reports_with_different_os_and_py_version.yaml@master + uses: ./.github/workflows/organize_all_testing_coverage_reports_with_different_os_and_py_version.yaml with: test_type: integration-test generate_xml_report_finally: false @@ -81,14 +81,14 @@ jobs: organize_all-test_codecov_and_generate_report: # name: Organize and generate the testing report and upload it to Codecov needs: [unit-test_codecov, integration-test_codecov] - uses: ./.github/workflows/organize_all_testing_reports_with_different_test_type.yaml@master + uses: ./.github/workflows/organize_all_testing_reports_with_different_test_type.yaml codecov_finish: # name: Organize and generate the testing report and upload it to Codecov if: github.ref_name == 'release' || github.ref_name == 'master' needs: organize_all-test_codecov_and_generate_report - uses: ./.github/workflows/upload_test_report_to_codecov.yaml@master + uses: ./.github/workflows/upload_test_report_to_codecov.yaml secrets: codecov_token: ${{ secrets.CODECOV_TOKEN }} with: @@ -100,7 +100,7 @@ jobs: codacy_finish: # name: Upload test report to Codacy to analyse and record code quality needs: [codecov_finish] - uses: ./.github/workflows/upload_code_report_to_codacy.yaml@master + uses: ./.github/workflows/upload_code_report_to_codacy.yaml secrets: codacy_token: ${{ secrets.CODACY_PROJECT_TOKEN }} with: From 30e6e2be62221708a5d79e497c5794ba583633db Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sun, 21 Aug 2022 13:38:51 +0800 Subject: [PATCH 21/31] [Bug Fix + Test] (config) Modify the uploading file name. --- ...g_coverage_reports_with_different_os_and_py_version.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 b4b6ff33..a09fedfd 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 @@ -62,7 +62,7 @@ jobs: - name: Upload testing coverage report uses: actions/upload-artifact@v3 with: - name: project_testing_coverage_report_with_test_type + name: project_testing_coverage_report_${{ inputs.test_type }} path: .coverage if-no-files-found: error @@ -75,7 +75,7 @@ jobs: - name: Download code coverage result file uses: actions/download-artifact@v3 with: - name: project_testing_coverage_report_with_test_type + name: project_testing_coverage_report_${{ inputs.test_type }} path: .coverage - name: General testing coverage report as XML format @@ -97,7 +97,7 @@ jobs: - name: Download code coverage result file uses: actions/download-artifact@v3 with: - name: project_testing_coverage_report_with_test_type + name: project_testing_coverage_report_${{ inputs.test_type }} path: .coverage - name: Rename the testing coverage report with test type From 921b6553721824c0e7d0b59539888fbb88b942bf Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sun, 21 Aug 2022 13:47:15 +0800 Subject: [PATCH 22/31] [Bug Fix + Test] (config) Rename the uploading option 'name' and file path. --- ...erage_reports_with_different_os_and_py_version.yaml | 2 +- ...e_all_testing_reports_with_different_test_type.yaml | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) 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 a09fedfd..d7c75b94 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 @@ -106,6 +106,6 @@ jobs: - name: Upload testing coverage report uses: actions/upload-artifact@v3 with: - name: project_testing_coverage_report + name: new_project_testing_coverage_report_${{ inputs.test_type }} path: .coverage-${{ inputs.test_type }} if-no-files-found: error 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 index bdd51fc2..6d2645ba 100644 --- a/.github/workflows/organize_all_testing_reports_with_different_test_type.yaml +++ b/.github/workflows/organize_all_testing_reports_with_different_test_type.yaml @@ -27,8 +27,14 @@ jobs: - name: Download code coverage result file uses: actions/download-artifact@v3 with: - name: project_testing_coverage_report - path: .coverage-* + name: new_project_testing_coverage_report_unit-test + path: .coverage-unit-test + + - name: Download code coverage result file + uses: actions/download-artifact@v3 + with: + name: new_project_testing_coverage_report_integration-test + path: .coverage-integration-test - name: Setup Python 3.10 in Ubuntu OS uses: actions/setup-python@v2 From e5085525e61d388b60d1dfa0323ef795a9fef234 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sun, 21 Aug 2022 20:34:46 +0800 Subject: [PATCH 23/31] [Bug Fix + Test] (config) Modify the downloading option 'path'. --- ...ganize_all_testing_reports_with_different_test_type.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 index 6d2645ba..6cd5cd08 100644 --- a/.github/workflows/organize_all_testing_reports_with_different_test_type.yaml +++ b/.github/workflows/organize_all_testing_reports_with_different_test_type.yaml @@ -28,13 +28,15 @@ jobs: uses: actions/download-artifact@v3 with: name: new_project_testing_coverage_report_unit-test - path: .coverage-unit-test +# path: .coverage-unit-test + path: ./ - name: Download code coverage result file uses: actions/download-artifact@v3 with: name: new_project_testing_coverage_report_integration-test - path: .coverage-integration-test +# path: .coverage-integration-test + path: ./ - name: Setup Python 3.10 in Ubuntu OS uses: actions/setup-python@v2 From b2b6d421aeaaefcd874ce0cb8d91326928c954cd Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sun, 21 Aug 2022 21:01:39 +0800 Subject: [PATCH 24/31] [Bug Fix + Test] (config) Modify the file path value for combining testing coverage reports. --- .../organize_all_testing_reports_with_different_test_type.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 6cd5cd08..d4e5631a 100644 --- a/.github/workflows/organize_all_testing_reports_with_different_test_type.yaml +++ b/.github/workflows/organize_all_testing_reports_with_different_test_type.yaml @@ -50,7 +50,7 @@ jobs: 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 From 780d03f3a82b0300d203d3d9ebbc171c3f7f149d Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sun, 21 Aug 2022 21:17:42 +0800 Subject: [PATCH 25/31] [Bug Fix + Test] (config) Modify the file path value for combining testing coverage reports. --- ..._all_testing_reports_with_different_test_type.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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 index d4e5631a..2ad15f59 100644 --- a/.github/workflows/organize_all_testing_reports_with_different_test_type.yaml +++ b/.github/workflows/organize_all_testing_reports_with_different_test_type.yaml @@ -29,14 +29,16 @@ jobs: with: name: new_project_testing_coverage_report_unit-test # path: .coverage-unit-test - path: ./ + path: .coverage-* +# path: ./ - name: Download code coverage result file uses: actions/download-artifact@v3 with: name: new_project_testing_coverage_report_integration-test # path: .coverage-integration-test - path: ./ + path: .coverage-* +# path: ./ - name: Setup Python 3.10 in Ubuntu OS uses: actions/setup-python@v2 @@ -49,8 +51,11 @@ jobs: pip install -U pip pip install coverage + - name: List files and directories + run: ls -la + - 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 From d815659dbc741ae130fe3ac9d436640253ef9f93 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sun, 21 Aug 2022 21:24:14 +0800 Subject: [PATCH 26/31] [Bug Fix + Test] (config) Modify the file path value for combining testing coverage reports. --- ..._all_testing_reports_with_different_test_type.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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 index 2ad15f59..3bb8307f 100644 --- a/.github/workflows/organize_all_testing_reports_with_different_test_type.yaml +++ b/.github/workflows/organize_all_testing_reports_with_different_test_type.yaml @@ -29,16 +29,16 @@ jobs: with: name: new_project_testing_coverage_report_unit-test # path: .coverage-unit-test - path: .coverage-* -# path: ./ +# path: .coverage-* + path: ./ - name: Download code coverage result file uses: actions/download-artifact@v3 with: name: new_project_testing_coverage_report_integration-test # path: .coverage-integration-test - path: .coverage-* -# path: ./ +# path: .coverage-* + path: ./ - name: Setup Python 3.10 in Ubuntu OS uses: actions/setup-python@v2 @@ -55,7 +55,8 @@ jobs: run: ls -la - name: Combine all code coverage result files - run: coverage combine .coverage-* +# run: coverage combine .coverage-* + run: coverage combine .coverage-unit-test .coverage-integration-test - name: Report testing coverage of project code run: coverage report -m From 899b63fe2dac9d3bcf1d4852ce6aed0d1ecfae6a Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sun, 21 Aug 2022 21:31:16 +0800 Subject: [PATCH 27/31] [Bug Fix + Test] (config) Modify the file path value for combining testing coverage reports. --- ...ll_testing_reports_with_different_test_type.yaml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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 index 3bb8307f..5c3f6160 100644 --- a/.github/workflows/organize_all_testing_reports_with_different_test_type.yaml +++ b/.github/workflows/organize_all_testing_reports_with_different_test_type.yaml @@ -29,16 +29,16 @@ jobs: with: name: new_project_testing_coverage_report_unit-test # path: .coverage-unit-test -# path: .coverage-* - path: ./ + path: .coverage-* +# path: ./ - name: Download code coverage result file uses: actions/download-artifact@v3 with: name: new_project_testing_coverage_report_integration-test # path: .coverage-integration-test -# path: .coverage-* - path: ./ + path: .coverage-* +# path: ./ - name: Setup Python 3.10 in Ubuntu OS uses: actions/setup-python@v2 @@ -54,9 +54,12 @@ jobs: - name: List files and directories run: ls -la + - name: List files and directories + run: ls -la .coverage-* + - name: Combine all code coverage result files # run: coverage combine .coverage-* - run: coverage combine .coverage-unit-test .coverage-integration-test + run: coverage combine .coverage-*/* - name: Report testing coverage of project code run: coverage report -m From ce93130c2aad75e5aea10314a69b5162f8e5404e Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sun, 21 Aug 2022 22:03:15 +0800 Subject: [PATCH 28/31] [Bug Fix + Test] (config) Modify the file path value for combining testing coverage reports. --- ...ing_coverage_reports_with_different_os_and_py_version.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 d7c75b94..c51dc1e1 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 @@ -76,7 +76,7 @@ jobs: uses: actions/download-artifact@v3 with: name: project_testing_coverage_report_${{ inputs.test_type }} - path: .coverage + path: ./ - name: General testing coverage report as XML format run: coverage xml @@ -98,7 +98,7 @@ jobs: uses: actions/download-artifact@v3 with: name: project_testing_coverage_report_${{ inputs.test_type }} - path: .coverage + path: ./ - name: Rename the testing coverage report with test type run: mv .coverage .coverage-${{ inputs.test_type }} From bcd12b62d2562d694ab737fb0a3c08244e34bfef Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sun, 21 Aug 2022 22:13:19 +0800 Subject: [PATCH 29/31] [Bug Fix + Test] (config) Modify the file path value for combining testing coverage reports. --- ...organize_all_testing_reports_with_different_test_type.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 index 5c3f6160..ff8716ea 100644 --- a/.github/workflows/organize_all_testing_reports_with_different_test_type.yaml +++ b/.github/workflows/organize_all_testing_reports_with_different_test_type.yaml @@ -58,8 +58,8 @@ jobs: run: ls -la .coverage-* - name: Combine all code coverage result files -# run: coverage combine .coverage-* - run: coverage combine .coverage-*/* + run: coverage combine .coverage-* +# run: coverage combine .coverage-*/* - name: Report testing coverage of project code run: coverage report -m From 6ac31e2339ec3db8ca1846cff70942b2568c3b76 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sun, 21 Aug 2022 22:20:42 +0800 Subject: [PATCH 30/31] [Bug Fix + Test] (config) Modify the file path value for combining testing coverage reports. --- ...nize_all_testing_reports_with_different_test_type.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 index ff8716ea..fb3edb65 100644 --- a/.github/workflows/organize_all_testing_reports_with_different_test_type.yaml +++ b/.github/workflows/organize_all_testing_reports_with_different_test_type.yaml @@ -29,16 +29,16 @@ jobs: with: name: new_project_testing_coverage_report_unit-test # path: .coverage-unit-test - path: .coverage-* -# path: ./ +# path: .coverage-* + path: ./ - name: Download code coverage result file uses: actions/download-artifact@v3 with: name: new_project_testing_coverage_report_integration-test # path: .coverage-integration-test - path: .coverage-* -# path: ./ +# path: .coverage-* + path: ./ - name: Setup Python 3.10 in Ubuntu OS uses: actions/setup-python@v2 From 756b48e15a6a32b9a849b34a037f08ad25604534 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Sun, 21 Aug 2022 22:36:10 +0800 Subject: [PATCH 31/31] [Breaking Change] (config) Remove the steps for testing and troubleshooting, and modify some options value. --- ...rage_reports_with_different_os_and_py_version.yaml | 2 +- ..._all_testing_reports_with_different_test_type.yaml | 11 ----------- .github/workflows/test-reusable-workflows.yaml | 2 +- 3 files changed, 2 insertions(+), 13 deletions(-) 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 c51dc1e1..506004f9 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 @@ -40,7 +40,7 @@ jobs: uses: actions/download-artifact@v3 with: name: coverage - path: .coverage.${{ inputs.test_type }}* + path: ./ - name: Setup Python 3.10 in Ubuntu OS uses: actions/setup-python@v2 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 index fb3edb65..b2a84ef8 100644 --- a/.github/workflows/organize_all_testing_reports_with_different_test_type.yaml +++ b/.github/workflows/organize_all_testing_reports_with_different_test_type.yaml @@ -28,16 +28,12 @@ jobs: uses: actions/download-artifact@v3 with: name: new_project_testing_coverage_report_unit-test -# path: .coverage-unit-test -# path: .coverage-* path: ./ - name: Download code coverage result file uses: actions/download-artifact@v3 with: name: new_project_testing_coverage_report_integration-test -# path: .coverage-integration-test -# path: .coverage-* path: ./ - name: Setup Python 3.10 in Ubuntu OS @@ -51,15 +47,8 @@ jobs: pip install -U pip pip install coverage - - name: List files and directories - run: ls -la - - - name: List files and directories - run: ls -la .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 diff --git a/.github/workflows/test-reusable-workflows.yaml b/.github/workflows/test-reusable-workflows.yaml index c658c95c..9531dd4d 100644 --- a/.github/workflows/test-reusable-workflows.yaml +++ b/.github/workflows/test-reusable-workflows.yaml @@ -104,7 +104,7 @@ jobs: secrets: codacy_token: ${{ secrets.CODACY_PROJECT_TOKEN }} with: - download_path: ./coverage.xml + download_path: ./ # pre-building_check: