From 5a8cf8591e2b53aaaaf73f1e83bd1924c6e2c7dc Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Mon, 8 Apr 2024 22:18:33 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=F0=9F=9A=AE=20Remove=20parameter=20&debu?= =?UTF-8?q?g=5Fmode*=20of=20reusable=20workflow=20about=20running=20tests.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/rw_poetry_run_test.yaml | 1 - .github/workflows/rw_run_test.yaml | 55 ------------------- .../test_python_project_ci_multi-tests.yaml | 2 - .../test_python_project_ci_one-test.yaml | 1 - 4 files changed, 59 deletions(-) diff --git a/.github/workflows/rw_poetry_run_test.yaml b/.github/workflows/rw_poetry_run_test.yaml index 00e44314..44fa891f 100644 --- a/.github/workflows/rw_poetry_run_test.yaml +++ b/.github/workflows/rw_poetry_run_test.yaml @@ -68,7 +68,6 @@ on: jobs: run_test_items: - if: ${{ inputs.debug_mode == false }} runs-on: ${{ matrix.os }} strategy: diff --git a/.github/workflows/rw_run_test.yaml b/.github/workflows/rw_run_test.yaml index 1dc79daa..aace2171 100644 --- a/.github/workflows/rw_run_test.yaml +++ b/.github/workflows/rw_run_test.yaml @@ -12,7 +12,6 @@ # * http_server_port: The port number of HTTP server. # * http_server_app_module: The module path of HTTP server. # * http_server_enter_point: The object about the web application. -# * debug_mode: For debug, so it's matrix would one has os: ubuntu-22.04 & python-version: '3.10'. # # Workflow running output: # No, but it would save the testing coverage reports to provide after-process to organize and record. @@ -61,16 +60,10 @@ on: type: string required: false default: app - debug_mode: - description: "For debug, so it's matrix would one has os: ubuntu-22.04 & python-version: '3.10'." - type: boolean - required: false - default: false jobs: run_test_items: - if: ${{ inputs.debug_mode == false }} runs-on: ${{ matrix.os }} strategy: @@ -129,51 +122,3 @@ jobs: name: coverage path: .coverage.${{ inputs.test_type }}.${{ matrix.os }}-${{ matrix.python-version }} if-no-files-found: error - - - run_test_items_with_debug_mode: - if: ${{ inputs.debug_mode == true }} - runs-on: ${{ matrix.os }} - - strategy: - matrix: - python-version: ['3.10'] - os: [ubuntu-22.04] - test-path: ${{fromJson(inputs.all_test_items_paths)}} - - steps: - - uses: actions/checkout@v3 - - - name: Install Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - - name: Install Python dependencies - run: | - python -m pip install --upgrade pip - pip install -U pip - pip install -U -r ./requirements/requirements.txt - pip install -U -r ./requirements/requirements-test.txt - - - name: Setup and run HTTP server for testing - if: ${{ inputs.setup_http_server == true }} - run: gunicorn --bind ${{ inputs.http_server_host }}:${{ inputs.http_server_port }} '${{ inputs.http_server_app_module }}:${{ inputs.http_server_enter_point }}' --daemon - - - name: Test to send HTTP request to sample HTTP server - if: ${{ inputs.setup_http_server == true }} - run: curl "http://${{ inputs.http_server_host }}:${{ inputs.http_server_port }}/exchangeReport/STOCK_DAY?response=json&date=20170101&stockNo=2331" - - - name: Run tests with pytest - run: pytest ${{ matrix.test-path }} - continue-on-error: true - - - name: Rename the code coverage result file - run: mv ./.coverage ./.coverage.${{ inputs.test_type }}.${{ matrix.os }}-${{ matrix.python-version }} - - - name: Upload code coverage result file - uses: actions/upload-artifact@v3 - with: - name: coverage - path: .coverage.${{ inputs.test_type }}.${{ matrix.os }}-${{ matrix.python-version }} - if-no-files-found: error diff --git a/.github/workflows/test_python_project_ci_multi-tests.yaml b/.github/workflows/test_python_project_ci_multi-tests.yaml index a9a3ab5b..7a2058ea 100644 --- a/.github/workflows/test_python_project_ci_multi-tests.yaml +++ b/.github/workflows/test_python_project_ci_multi-tests.yaml @@ -91,7 +91,6 @@ jobs: with: test_type: unit-test all_test_items_paths: ${{needs.prep-testbed_unit-test.outputs.all_test_items}} - debug_mode: true run_integration-test: @@ -106,7 +105,6 @@ jobs: http_server_port: 30303 http_server_app_module: test._http_server.app http_server_enter_point: app - debug_mode: true all-test_codecov: diff --git a/.github/workflows/test_python_project_ci_one-test.yaml b/.github/workflows/test_python_project_ci_one-test.yaml index 59a0e8ed..4cde5ef1 100644 --- a/.github/workflows/test_python_project_ci_one-test.yaml +++ b/.github/workflows/test_python_project_ci_one-test.yaml @@ -82,7 +82,6 @@ jobs: with: test_type: unit-test all_test_items_paths: ${{needs.prep-testbed_unit-test.outputs.all_test_items}} -# debug_mode: true unit-test_codecov: From adbc5b085a5fd9b9d93256f31140c1df38170a52 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Mon, 8 Apr 2024 22:36:01 +0800 Subject: [PATCH 02/13] =?UTF-8?q?=F0=9F=91=A8=E2=80=8D=F0=9F=92=BB=20Test?= =?UTF-8?q?=20the=20workflow=20with=20new=20setting=20way=20of=20reusable?= =?UTF-8?q?=20workflow=20parameter.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/rw_run_test.yaml | 14 +- .../rw_run_test_with_multi_py_version.yaml | 135 ++++++++++++++++++ .../test_python_project_ci_multi-tests.yaml | 1 + .../test_python_project_ci_one-test.yaml | 2 +- 4 files changed, 149 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/rw_run_test_with_multi_py_version.yaml diff --git a/.github/workflows/rw_run_test.yaml b/.github/workflows/rw_run_test.yaml index aace2171..4f13c86d 100644 --- a/.github/workflows/rw_run_test.yaml +++ b/.github/workflows/rw_run_test.yaml @@ -27,6 +27,16 @@ name: Run test items via PyTest on: workflow_call: inputs: + runtime_os: + description: "The OS to use for runtime environment. In default, it's 'ubuntu-latest'." + required: false + type: string + default: ubuntu-latest + python_version: + description: "The Python version to run the workflow. In default, it's Python version '3.11'." + required: false + type: string + default: 3.11 test_type: description: "The testing type. In generally, it only has 2 options: 'unit-test' and 'integration-test'." required: true @@ -68,8 +78,8 @@ jobs: strategy: matrix: - python-version: [3.6,3.7,3.8,3.9,'3.10','3.11'] - os: [ubuntu-20.04,ubuntu-latest,macos-latest] + python-version: [${{ inputs.python_version }}] + os: [${{ inputs.runtime_os }}] exclude: - os: ubuntu-latest python-version: 3.6 diff --git a/.github/workflows/rw_run_test_with_multi_py_version.yaml b/.github/workflows/rw_run_test_with_multi_py_version.yaml new file mode 100644 index 00000000..ea0c3dab --- /dev/null +++ b/.github/workflows/rw_run_test_with_multi_py_version.yaml @@ -0,0 +1,135 @@ +################################################################################################################################# +# +# Workflow Description: +# Run testing by specific type with all test items via PyTest and generate its testing +# coverage report (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'. +# * all_test_items_paths: The target paths of test items under test. +# * setup_http_server: If it's true, it would set up and run HTTP server for testing. +# * http_server_host: The host IPv4 address of HTTP server. +# * http_server_port: The port number of HTTP server. +# * http_server_app_module: The module path of HTTP server. +# * http_server_enter_point: The object about the web application. +# +# Workflow running output: +# No, but it would save the testing coverage reports to provide after-process to organize and record. +# +# * Upload-Artifact: +# * coverage: The test coverage report which be generated by PyTest, and it's recorded after run test done. +# The file name format would be .coverage..- +# +################################################################################################################################# + +name: Run test items via PyTest + +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 + all_test_items_paths: + description: "The target paths of test items under test." + required: true + type: string + setup_http_server: + description: "If it's true, it would set up and run HTTP server for testing." + type: boolean + required: false + default: false + http_server_host: + description: "The host IPv4 address of HTTP server." + type: string + required: false + default: 0.0.0.0 + http_server_port: + description: "The port number of HTTP server." + type: string + required: false + default: 12345 + http_server_app_module: + description: "The module path of HTTP server." + type: string + required: false + default: app + http_server_enter_point: + description: "The object about the web application." + type: string + required: false + default: app + + +jobs: + run_test_items: +# runs-on: ${{ matrix.os }} + + strategy: + matrix: + python-version: [3.6,3.7,3.8,3.9,'3.10','3.11'] + os: [ubuntu-20.04,ubuntu-latest,macos-latest] + exclude: + - os: ubuntu-latest + python-version: 3.6 + - os: ubuntu-20.04 + python-version: 3.7 + - os: ubuntu-20.04 + python-version: 3.8 + - os: ubuntu-20.04 + python-version: 3.9 + - os: ubuntu-20.04 + python-version: '3.10' + - os: ubuntu-20.04 + python-version: 3.11 + test-path: ${{fromJson(inputs.all_test_items_paths)}} + + uses: ./.github/workflows/rw_run_test.yaml + with: + runtime_os: ${{ matrix.os }} + python_version: ${{ matrix.python-version }} + test_type: ${{ inputs.test_type }} + all_test_items_paths: ${{ inputs.all_test_items_paths }} + setup_http_server: ${{ inputs.setup_http_server }} + http_server_host: ${{ inputs.http_server_host }} + http_server_port: ${{ inputs.http_server_port }} + http_server_app_module: ${{ inputs.http_server_app_module }} + http_server_enter_point: ${{ inputs.http_server_enter_point }} + +# steps: +# - uses: actions/checkout@v3 +# +# - name: Install Python ${{ matrix.python-version }} +# uses: actions/setup-python@v4 +# with: +# python-version: ${{ matrix.python-version }} +# +# - name: Install Python dependencies +# run: | +# python -m pip install --upgrade pip +# pip install -U pip +# pip install -U -r ./requirements/requirements.txt +# pip install -U -r ./requirements/requirements-test.txt +# +# - name: Setup and run HTTP server for testing +# if: ${{ inputs.setup_http_server == true }} +# run: gunicorn --bind ${{ inputs.http_server_host }}:${{ inputs.http_server_port }} '${{ inputs.http_server_app_module }}:${{ inputs.http_server_enter_point }}' --daemon +# +# - name: Test to send HTTP request to sample HTTP server +# if: ${{ inputs.setup_http_server == true }} +# run: curl "http://${{ inputs.http_server_host }}:${{ inputs.http_server_port }}/exchangeReport/STOCK_DAY?response=json&date=20170101&stockNo=2331" +# +# - name: Run tests with pytest +# run: pytest ${{ matrix.test-path }} +# continue-on-error: true +# +# - name: Rename the code coverage result file +# run: mv ./.coverage ./.coverage.${{ inputs.test_type }}.${{ matrix.os }}-${{ matrix.python-version }} +# +# - name: Upload code coverage result file +# uses: actions/upload-artifact@v4 +# with: +# name: coverage +# path: .coverage.${{ inputs.test_type }}.${{ matrix.os }}-${{ matrix.python-version }} +# if-no-files-found: error diff --git a/.github/workflows/test_python_project_ci_multi-tests.yaml b/.github/workflows/test_python_project_ci_multi-tests.yaml index 7a2058ea..931a561d 100644 --- a/.github/workflows/test_python_project_ci_multi-tests.yaml +++ b/.github/workflows/test_python_project_ci_multi-tests.yaml @@ -89,6 +89,7 @@ jobs: needs: prep-testbed_unit-test uses: ./.github/workflows/rw_run_test.yaml with: + python_version: '3.10','3.11' test_type: unit-test all_test_items_paths: ${{needs.prep-testbed_unit-test.outputs.all_test_items}} diff --git a/.github/workflows/test_python_project_ci_one-test.yaml b/.github/workflows/test_python_project_ci_one-test.yaml index 4cde5ef1..636469d9 100644 --- a/.github/workflows/test_python_project_ci_one-test.yaml +++ b/.github/workflows/test_python_project_ci_one-test.yaml @@ -78,7 +78,7 @@ jobs: run_unit-test: # name: Run all unit test items needs: prep-testbed_unit-test - uses: ./.github/workflows/rw_run_test.yaml + uses: ./.github/workflows/rw_run_test_with_multi_py_version.yaml with: test_type: unit-test all_test_items_paths: ${{needs.prep-testbed_unit-test.outputs.all_test_items}} From 5c9c10467d510077eb1530655ba51dfb01bfc80d Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Mon, 8 Apr 2024 22:55:21 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=F0=9F=91=A8=E2=80=8D=F0=9F=92=BB=20Fix?= =?UTF-8?q?=20YAML=20syntax=20issues=20and=20test=20the=20workflow=20again?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/rw_run_test.yaml | 30 +++++++++---------- .../test_python_project_ci_multi-tests.yaml | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/rw_run_test.yaml b/.github/workflows/rw_run_test.yaml index 4f13c86d..928ddb68 100644 --- a/.github/workflows/rw_run_test.yaml +++ b/.github/workflows/rw_run_test.yaml @@ -78,22 +78,22 @@ jobs: strategy: matrix: - python-version: [${{ inputs.python_version }}] - os: [${{ inputs.runtime_os }}] - exclude: - - os: ubuntu-latest - python-version: 3.6 - - os: ubuntu-20.04 - python-version: 3.7 - - os: ubuntu-20.04 - python-version: 3.8 - - os: ubuntu-20.04 - python-version: 3.9 - - os: ubuntu-20.04 - python-version: '3.10' - - os: ubuntu-20.04 - python-version: 3.11 + python-version: ${{ inputs.python_version }} + os: ${{ inputs.runtime_os }} test-path: ${{fromJson(inputs.all_test_items_paths)}} +# exclude: +# - os: ubuntu-latest +# python-version: 3.6 +# - os: ubuntu-20.04 +# python-version: 3.7 +# - os: ubuntu-20.04 +# python-version: 3.8 +# - os: ubuntu-20.04 +# python-version: 3.9 +# - os: ubuntu-20.04 +# python-version: '3.10' +# - os: ubuntu-20.04 +# python-version: 3.11 steps: diff --git a/.github/workflows/test_python_project_ci_multi-tests.yaml b/.github/workflows/test_python_project_ci_multi-tests.yaml index 931a561d..ed176a86 100644 --- a/.github/workflows/test_python_project_ci_multi-tests.yaml +++ b/.github/workflows/test_python_project_ci_multi-tests.yaml @@ -89,7 +89,7 @@ jobs: needs: prep-testbed_unit-test uses: ./.github/workflows/rw_run_test.yaml with: - python_version: '3.10','3.11' + python_version: 3.10,3.11 test_type: unit-test all_test_items_paths: ${{needs.prep-testbed_unit-test.outputs.all_test_items}} From c091d128cb6c8c78972a8b919ca42c57bcb18202 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Mon, 8 Apr 2024 22:57:08 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=F0=9F=91=A8=E2=80=8D=F0=9F=92=BB=20Fix?= =?UTF-8?q?=20YAML=20syntax=20issue=20and=20test=20the=20workflow=20again.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/rw_run_test.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/rw_run_test.yaml b/.github/workflows/rw_run_test.yaml index 928ddb68..3ed2f7a4 100644 --- a/.github/workflows/rw_run_test.yaml +++ b/.github/workflows/rw_run_test.yaml @@ -74,13 +74,13 @@ on: jobs: run_test_items: - runs-on: ${{ matrix.os }} + runs-on: ${{ inputs.runtime_os }} strategy: matrix: - python-version: ${{ inputs.python_version }} - os: ${{ inputs.runtime_os }} test-path: ${{fromJson(inputs.all_test_items_paths)}} +# python-version: ${{ inputs.python_version }} +# os: ${{ inputs.runtime_os }} # exclude: # - os: ubuntu-latest # python-version: 3.6 @@ -99,10 +99,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Install Python ${{ matrix.python-version }} + - name: Install Python ${{ inputs.python_version }} uses: actions/setup-python@v4 with: - python-version: ${{ matrix.python-version }} + python-version: ${{ inputs.python_version }} - name: Install Python dependencies run: | @@ -124,11 +124,11 @@ jobs: continue-on-error: true - name: Rename the code coverage result file - run: mv ./.coverage ./.coverage.${{ inputs.test_type }}.${{ matrix.os }}-${{ matrix.python-version }} + run: mv ./.coverage ./.coverage.${{ inputs.test_type }}.${{ inputs.runtime_os }}-${{ inputs.python_version }} - name: Upload code coverage result file uses: actions/upload-artifact@v3 with: name: coverage - path: .coverage.${{ inputs.test_type }}.${{ matrix.os }}-${{ matrix.python-version }} + path: .coverage.${{ inputs.test_type }}.${{ inputs.runtime_os }}-${{ inputs.python_version }} if-no-files-found: error From 63e73ecb45d15609cdcad10335b8a19ad8a1e8e8 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Mon, 8 Apr 2024 23:00:22 +0800 Subject: [PATCH 05/13] =?UTF-8?q?=F0=9F=91=A8=E2=80=8D=F0=9F=92=BB=20Modif?= =?UTF-8?q?y=20config=20and=20test=20the=20workflow=20again.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test_python_project_ci_one-test.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_python_project_ci_one-test.yaml b/.github/workflows/test_python_project_ci_one-test.yaml index 636469d9..fb6a9799 100644 --- a/.github/workflows/test_python_project_ci_one-test.yaml +++ b/.github/workflows/test_python_project_ci_one-test.yaml @@ -23,7 +23,8 @@ on: - "test/**" # The shell scripts or actions this workflow would use. - ".github/workflows/rw_get_tests.yaml" - - ".github/workflows/rw_poetry_run_test.yaml" + - ".github/workflows/rw_run_test.yaml" + - ".github/workflows/rw_run_test_with_multi_py_version.yaml" - ".github/workflows/rw_organize_test_cov_reports.yaml" - "scripts/ci/combine_coverage_reports.sh" - ".github/workflows/rw_upload_test_cov_report.yaml" @@ -56,7 +57,8 @@ on: - "test/**" # The shell scripts or actions this workflow would use. - ".github/workflows/rw_get_tests.yaml" - - ".github/workflows/rw_poetry_run_test.yaml" + - ".github/workflows/rw_run_test.yaml" + - ".github/workflows/rw_run_test_with_multi_py_version.yaml" - ".github/workflows/rw_organize_test_cov_reports.yaml" - "scripts/ci/combine_coverage_reports.sh" - ".github/workflows/rw_upload_test_cov_report.yaml" From 2826bc64eeca538ff9728087fd6dabc4dc355f87 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Tue, 9 Apr 2024 10:51:34 +0800 Subject: [PATCH 06/13] =?UTF-8?q?=E2=9E=95=20Add=20new=20parameters=20info?= =?UTF-8?q?.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/rw_run_test.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/rw_run_test.yaml b/.github/workflows/rw_run_test.yaml index 3ed2f7a4..122218bc 100644 --- a/.github/workflows/rw_run_test.yaml +++ b/.github/workflows/rw_run_test.yaml @@ -5,6 +5,8 @@ # coverage report (it would save reports by 'actions/upload-artifact@v3'). # # Workflow input parameters: +# * runtime_os: The OS to use for runtime environment. In default, it's 'ubuntu-latest'. +# * python_version: The Python version to run the workflow. In default, it's Python version '3.11'. # * test_type: The testing type. In generally, it only has 2 options: 'unit-test' and 'integration-test'. # * all_test_items_paths: The target paths of test items under test. # * setup_http_server: If it's true, it would set up and run HTTP server for testing. From b65cfc921f877123f40db1824e315d603bd5cc80 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Tue, 9 Apr 2024 10:52:47 +0800 Subject: [PATCH 07/13] =?UTF-8?q?=F0=9F=9A=AE=20Remove=20unused=20config.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/rw_run_test.yaml | 16 -------- .../rw_run_test_with_multi_py_version.yaml | 39 ------------------- 2 files changed, 55 deletions(-) diff --git a/.github/workflows/rw_run_test.yaml b/.github/workflows/rw_run_test.yaml index 122218bc..e9511597 100644 --- a/.github/workflows/rw_run_test.yaml +++ b/.github/workflows/rw_run_test.yaml @@ -81,22 +81,6 @@ jobs: strategy: matrix: test-path: ${{fromJson(inputs.all_test_items_paths)}} -# python-version: ${{ inputs.python_version }} -# os: ${{ inputs.runtime_os }} -# exclude: -# - os: ubuntu-latest -# python-version: 3.6 -# - os: ubuntu-20.04 -# python-version: 3.7 -# - os: ubuntu-20.04 -# python-version: 3.8 -# - os: ubuntu-20.04 -# python-version: 3.9 -# - os: ubuntu-20.04 -# python-version: '3.10' -# - os: ubuntu-20.04 -# python-version: 3.11 - steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/rw_run_test_with_multi_py_version.yaml b/.github/workflows/rw_run_test_with_multi_py_version.yaml index ea0c3dab..7390b781 100644 --- a/.github/workflows/rw_run_test_with_multi_py_version.yaml +++ b/.github/workflows/rw_run_test_with_multi_py_version.yaml @@ -64,8 +64,6 @@ on: jobs: run_test_items: -# runs-on: ${{ matrix.os }} - strategy: matrix: python-version: [3.6,3.7,3.8,3.9,'3.10','3.11'] @@ -96,40 +94,3 @@ jobs: http_server_port: ${{ inputs.http_server_port }} http_server_app_module: ${{ inputs.http_server_app_module }} http_server_enter_point: ${{ inputs.http_server_enter_point }} - -# steps: -# - uses: actions/checkout@v3 -# -# - name: Install Python ${{ matrix.python-version }} -# uses: actions/setup-python@v4 -# with: -# python-version: ${{ matrix.python-version }} -# -# - name: Install Python dependencies -# run: | -# python -m pip install --upgrade pip -# pip install -U pip -# pip install -U -r ./requirements/requirements.txt -# pip install -U -r ./requirements/requirements-test.txt -# -# - name: Setup and run HTTP server for testing -# if: ${{ inputs.setup_http_server == true }} -# run: gunicorn --bind ${{ inputs.http_server_host }}:${{ inputs.http_server_port }} '${{ inputs.http_server_app_module }}:${{ inputs.http_server_enter_point }}' --daemon -# -# - name: Test to send HTTP request to sample HTTP server -# if: ${{ inputs.setup_http_server == true }} -# run: curl "http://${{ inputs.http_server_host }}:${{ inputs.http_server_port }}/exchangeReport/STOCK_DAY?response=json&date=20170101&stockNo=2331" -# -# - name: Run tests with pytest -# run: pytest ${{ matrix.test-path }} -# continue-on-error: true -# -# - name: Rename the code coverage result file -# run: mv ./.coverage ./.coverage.${{ inputs.test_type }}.${{ matrix.os }}-${{ matrix.python-version }} -# -# - name: Upload code coverage result file -# uses: actions/upload-artifact@v4 -# with: -# name: coverage -# path: .coverage.${{ inputs.test_type }}.${{ matrix.os }}-${{ matrix.python-version }} -# if-no-files-found: error From dacf7441a6276b86ffb5b54f854deae7cfa5c46e Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Tue, 9 Apr 2024 11:04:06 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=F0=9F=A7=AC=20Extract=20the=20test=20run?= =?UTF-8?q?ning=20process=20into=20a=20single=20reusable=20workflow=20and?= =?UTF-8?q?=20let=20running=20test=20with=20multiple=20Python=20version=20?= =?UTF-8?q?with=20multiple=20runtime=20OS=20as=20another=20reusable=20work?= =?UTF-8?q?flow.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/rw_poetry_run_test.yaml | 25 ++-- ...oetry_run_test_with_multi_py_versions.yaml | 131 ++++++++++++++++++ ...st_pyproject_ci_multi-tests_by_poetry.yaml | 4 +- 3 files changed, 151 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/rw_poetry_run_test_with_multi_py_versions.yaml diff --git a/.github/workflows/rw_poetry_run_test.yaml b/.github/workflows/rw_poetry_run_test.yaml index 44fa891f..b3d2cd21 100644 --- a/.github/workflows/rw_poetry_run_test.yaml +++ b/.github/workflows/rw_poetry_run_test.yaml @@ -5,6 +5,8 @@ # coverage report (it would save reports by 'actions/upload-artifact@v3'). # # Workflow input parameters: +# * runtime_os: The OS to use for runtime environment. In default, it's 'ubuntu-latest'. +# * python_version: The Python version to run the workflow. In default, it's Python version '3.11'. # * test_type: The testing type. In generally, it only has 2 options: 'unit-test' and 'integration-test'. # * all_test_items_paths: The target paths of test items under test. # * setup_http_server: If it's true, it would set up and run HTTP server for testing. @@ -29,6 +31,16 @@ name: Run test items via PyTest on: workflow_call: inputs: + runtime_os: + description: "The OS to use for runtime environment. In default, it's 'ubuntu-latest'." + required: false + type: string + default: ubuntu-latest + python_version: + description: "The Python version to run the workflow. In default, it's Python version '3.11'." + required: false + type: string + default: 3.11 test_type: description: "The testing type. In generally, it only has 2 options: 'unit-test' and 'integration-test'." required: true @@ -68,22 +80,19 @@ on: jobs: run_test_items: - runs-on: ${{ matrix.os }} + runs-on: ${{ inputs.runtime_os }} strategy: matrix: - python-version: [3.8,3.9,'3.10','3.11'] - os: [ubuntu-20.04,ubuntu-latest,macos-latest] test-path: ${{fromJson(inputs.all_test_items_paths)}} - steps: - uses: actions/checkout@v3 - - name: Install Python ${{ matrix.python-version }} + - name: Install Python ${{ inputs.python_version }} uses: actions/setup-python@v4 with: - python-version: ${{ matrix.python-version }} + python-version: ${{ inputs.python_version }} - name: Install Python dependencies run: | @@ -111,11 +120,11 @@ jobs: continue-on-error: true - name: Rename the code coverage result file - run: mv ./.coverage ./.coverage.${{ inputs.test_type }}.${{ matrix.os }}-${{ matrix.python-version }} + run: mv ./.coverage ./.coverage.${{ inputs.test_type }}.${{ inputs.runtime_os }}-${{ inputs.python_version }} - name: Upload code coverage result file uses: actions/upload-artifact@v3 with: name: coverage - path: .coverage.${{ inputs.test_type }}.${{ matrix.os }}-${{ matrix.python-version }} + path: .coverage.${{ inputs.test_type }}.${{ inputs.runtime_os }}-${{ inputs.python_version }} if-no-files-found: error diff --git a/.github/workflows/rw_poetry_run_test_with_multi_py_versions.yaml b/.github/workflows/rw_poetry_run_test_with_multi_py_versions.yaml new file mode 100644 index 00000000..0012dd97 --- /dev/null +++ b/.github/workflows/rw_poetry_run_test_with_multi_py_versions.yaml @@ -0,0 +1,131 @@ +################################################################################################################################# +# +# Workflow Description: +# Use Poetry to run testing by specific type with all test items via PyTest and generate its testing +# coverage report (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'. +# * all_test_items_paths: The target paths of test items under test. +# * setup_http_server: If it's true, it would set up and run HTTP server for testing. +# * http_server_host: The host IPv4 address of HTTP server. +# * http_server_port: The port number of HTTP server. +# * http_server_app_module: The module path of HTTP server. +# * http_server_enter_point: The object about the web application. +# +# Workflow running output: +# No, but it would save the testing coverage reports to provide after-process to organize and record. +# +# * Upload-Artifact: +# * coverage: The test coverage report which be generated by PyTest, and it's recorded after run test done. +# The file name format would be .coverage..- +# +################################################################################################################################# + +name: Run test items via PyTest + +# TODO: Run Python package test via Poetry. + +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 + all_test_items_paths: + description: "The target paths of test items under test." + required: true + type: string + setup_http_server: + description: "If it's true, it would set up and run HTTP server for testing." + type: boolean + required: false + default: false + http_server_host: + description: "The host IPv4 address of HTTP server." + type: string + required: false + default: 0.0.0.0 + http_server_port: + description: "The port number of HTTP server." + type: string + required: false + default: 12345 + http_server_app_module: + description: "The module path of HTTP server." + type: string + required: false + default: app + http_server_enter_point: + description: "The object about the web application." + type: string + required: false + default: app + +# TODO: Add a reusable workflow about running test via Poetry +# TODO: https://github.com/marketplace/actions/python-poetry-action + +jobs: + run_test_items: + strategy: + matrix: + python-version: [3.8,3.9,'3.10','3.11'] + os: [ubuntu-20.04,ubuntu-latest,macos-latest] + test-path: ${{fromJson(inputs.all_test_items_paths)}} + + uses: ./.github/workflows/rw_poetry_run_test.yaml + with: + runtime_os: ${{ matrix.os }} + python_version: ${{ matrix.python-version }} + test_type: ${{ inputs.test_type }} + all_test_items_paths: ${{ inputs.all_test_items_paths }} + setup_http_server: ${{ inputs.setup_http_server }} + http_server_host: ${{ inputs.http_server_host }} + http_server_port: ${{ inputs.http_server_port }} + http_server_app_module: ${{ inputs.http_server_app_module }} + http_server_enter_point: ${{ inputs.http_server_enter_point }} + + +# steps: +# - uses: actions/checkout@v3 +# +# - name: Install Python ${{ matrix.python-version }} +# uses: actions/setup-python@v4 +# with: +# python-version: ${{ matrix.python-version }} +# +# - name: Install Python dependencies +# run: | +# python -m pip install --upgrade pip +# pip install -U pip +# pip install -U flask +# pip install -U gunicorn +# pip install -U poetry +# +# - name: Build Python runtime environment by Poetry +# run: | +# poetry --version +# poetry install +# +# - name: Setup and run HTTP server for testing +# if: ${{ inputs.setup_http_server == true }} +# run: gunicorn --bind ${{ inputs.http_server_host }}:${{ inputs.http_server_port }} '${{ inputs.http_server_app_module }}:${{ inputs.http_server_enter_point }}' --daemon +# +# - name: Test to send HTTP request to sample HTTP server +# if: ${{ inputs.setup_http_server == true }} +# run: curl "http://${{ inputs.http_server_host }}:${{ inputs.http_server_port }}/exchangeReport/STOCK_DAY?response=json&date=20170101&stockNo=2331" +# +# - name: Run tests with pytest +# run: poetry run pytest ${{ matrix.test-path }} +# continue-on-error: true +# +# - name: Rename the code coverage result file +# run: mv ./.coverage ./.coverage.${{ inputs.test_type }}.${{ matrix.os }}-${{ matrix.python-version }} +# +# - name: Upload code coverage result file +# uses: actions/upload-artifact@v3 +# with: +# name: coverage +# path: .coverage.${{ inputs.test_type }}.${{ matrix.os }}-${{ matrix.python-version }} +# if-no-files-found: error diff --git a/.github/workflows/test_pyproject_ci_multi-tests_by_poetry.yaml b/.github/workflows/test_pyproject_ci_multi-tests_by_poetry.yaml index 88bb8b50..a5998293 100644 --- a/.github/workflows/test_pyproject_ci_multi-tests_by_poetry.yaml +++ b/.github/workflows/test_pyproject_ci_multi-tests_by_poetry.yaml @@ -23,6 +23,7 @@ on: # The shell scripts or actions this workflow would use. - ".github/workflows/rw_get_tests.yaml" - ".github/workflows/rw_poetry_run_test.yaml" + - ".github/workflows/rw_poetry_run_test_with_multi_py_versions.yaml" - ".github/workflows/rw_organize_test_cov_reports.yaml" - "scripts/ci/combine_coverage_reports.sh" - ".github/workflows/rw_upload_test_cov_report.yaml" @@ -55,6 +56,7 @@ on: # The shell scripts or actions this workflow would use. - ".github/workflows/rw_get_tests.yaml" - ".github/workflows/rw_poetry_run_test.yaml" + - ".github/workflows/rw_poetry_run_test_with_multi_py_versions.yaml" - ".github/workflows/rw_organize_test_cov_reports.yaml" - "scripts/ci/combine_coverage_reports.sh" - ".github/workflows/rw_upload_test_cov_report.yaml" @@ -94,7 +96,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/rw_poetry_run_test.yaml + uses: ./.github/workflows/rw_poetry_run_test_with_multi_py_versions.yaml with: test_type: integration-test all_test_items_paths: ${{needs.prep-testbed_integration-test.outputs.all_test_items}} From f3b41571e8975c695ae360697c25928db57cd700 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Tue, 9 Apr 2024 11:04:45 +0800 Subject: [PATCH 09/13] =?UTF-8?q?=E2=9A=99=EF=B8=8F=20Modify=20the=20setti?= =?UTF-8?q?ngs=20and=20fix=20the=20syntx=20issue.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test_python_project_ci_multi-tests.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_python_project_ci_multi-tests.yaml b/.github/workflows/test_python_project_ci_multi-tests.yaml index ed176a86..9669538a 100644 --- a/.github/workflows/test_python_project_ci_multi-tests.yaml +++ b/.github/workflows/test_python_project_ci_multi-tests.yaml @@ -23,7 +23,8 @@ on: - "test/**" # The shell scripts or actions this workflow would use. - ".github/workflows/rw_get_tests.yaml" - - ".github/workflows/rw_poetry_run_test.yaml" + - ".github/workflows/rw_run_test.yaml" + - ".github/workflows/rw_run_test_with_multi_py_version.yaml" - ".github/workflows/rw_organize_test_cov_reports.yaml" - "scripts/ci/combine_coverage_reports.sh" - ".github/workflows/rw_upload_test_cov_report.yaml" @@ -56,7 +57,8 @@ on: - "test/**" # The shell scripts or actions this workflow would use. - ".github/workflows/rw_get_tests.yaml" - - ".github/workflows/rw_poetry_run_test.yaml" + - ".github/workflows/rw_run_test.yaml" + - ".github/workflows/rw_run_test_with_multi_py_version.yaml" - ".github/workflows/rw_organize_test_cov_reports.yaml" - "scripts/ci/combine_coverage_reports.sh" - ".github/workflows/rw_upload_test_cov_report.yaml" @@ -89,7 +91,7 @@ jobs: needs: prep-testbed_unit-test uses: ./.github/workflows/rw_run_test.yaml with: - python_version: 3.10,3.11 + python_version: 3.10 test_type: unit-test all_test_items_paths: ${{needs.prep-testbed_unit-test.outputs.all_test_items}} From 1ea44f07b6e72c364584ca72ce7f32e96dda04a1 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Tue, 9 Apr 2024 11:09:46 +0800 Subject: [PATCH 10/13] =?UTF-8?q?=E2=9A=99=EF=B8=8F=20Fix=20the=20broken?= =?UTF-8?q?=20CI=20because=20of=20parameter=20value=20setting=20of=20reusa?= =?UTF-8?q?ble=20workflow.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test_python_project_ci_multi-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_python_project_ci_multi-tests.yaml b/.github/workflows/test_python_project_ci_multi-tests.yaml index 9669538a..4beb8f6f 100644 --- a/.github/workflows/test_python_project_ci_multi-tests.yaml +++ b/.github/workflows/test_python_project_ci_multi-tests.yaml @@ -91,7 +91,7 @@ jobs: needs: prep-testbed_unit-test uses: ./.github/workflows/rw_run_test.yaml with: - python_version: 3.10 + python_version: '3.10' test_type: unit-test all_test_items_paths: ${{needs.prep-testbed_unit-test.outputs.all_test_items}} From 7890c6ab46de7f13246138b3cc7eb67cb93c98e7 Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Tue, 9 Apr 2024 14:25:57 +0800 Subject: [PATCH 11/13] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20=20Update=20document?= =?UTF-8?q?=20content=20with=20the=20new=20features=20and=20changes.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 72 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 034322a4..373617fe 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,8 @@ The usage of each workflow template. * [_rw_get_tests.yaml_](#rw_get_testsyaml) * [_rw_run_test.yaml_](#rw_run_testyaml) * [_rw_poetry_run_test.yaml_](#rw_poetry_run_testyaml) +* [_rw_run_test_with_multi_py_versions.yaml_](#rw_run_test_with_multi_py_versionsyaml) +* [_rw_poetry_run_test_with_multi_py_versions.yaml_](#rw_poetry_run_test_with_multi_py_versionsyaml) * [_rw_organize_test_cov_reports.yaml_](#rw_organize_test_cov_reportsyaml) * [_rw_upload_test_cov_report.yaml_](#rw_upload_test_cov_reportyaml) * [_rw_pre-building_test.yaml_](#rw_pre-building_testyaml) @@ -95,19 +97,21 @@ The usage of each workflow template. ### _rw_run_test.yaml_ -* Description: Run testing by specific type with all test items via PyTest and generate its testing coverage report (it would save reports by _actions/upload-artifact@v3_). +* Description: Run testing by specific type with all test items via PyTest and generate its testing coverage report (it would save reports by _actions/upload-artifact_). * Options: -| option name | data type | optional or required | function content | -|-------------------------|-----------|--------------------------------------|--------------------------------------------------------------------------------------------| -| test_type | string | Required | The testing type. In generally, it only has 2 options: _unit-test_ and _integration-test_. | -| all_test_items_paths | string | Required | The target paths of test items under test. | -| setup_http_server | string | Optional, Default value is _false_ | If it's true, it would set up and run HTTP server for testing. | -| http_server_host | string | Optional, Default value is _0.0.0.0_ | The host IPv4 address of HTTP server. | -| http_server_port | string | Optional, Default value is _12345_ | The port number of HTTP server. | -| http_server_app_module | string | Optional, Default value is _app_ | The module path of HTTP server. | -| http_server_enter_point | string | Optional, Default value is _app_ | The object about the web application. | -| debug_mode | boolean | Optional, Default value is _false_ | For debug, so it's matrix would only has one os: ubuntu-22.04 & one python-version: 3.10. | +| option name | data type | optional or required | function content | +|-------------------------|-----------|--------------------------------------------|--------------------------------------------------------------------------------------------| +| runtime_os | string | Optional, Default value is _ubuntu-latest_ | The OS to use for runtime environment. | +| python_version | string | Optional, Default value is _3.11_ | The Python version to run the test in workflow. | +| test_type | string | Required | The testing type. In generally, it only has 2 options: _unit-test_ and _integration-test_. | +| all_test_items_paths | string | Required | The target paths of test items under test. | +| setup_http_server | string | Optional, Default value is _false_ | If it's true, it would set up and run HTTP server for testing. | +| http_server_host | string | Optional, Default value is _0.0.0.0_ | The host IPv4 address of HTTP server. | +| http_server_port | string | Optional, Default value is _12345_ | The port number of HTTP server. | +| http_server_app_module | string | Optional, Default value is _app_ | The module path of HTTP server. | +| http_server_enter_point | string | Optional, Default value is _app_ | The object about the web application. | +| debug_mode | boolean | Optional, Default value is _false_ | For debug, so it's matrix would only has one os: ubuntu-22.04 & one python-version: 3.10. | * Output: @@ -125,6 +129,7 @@ No, but it would save the testing coverage reports to provide after-process to o needs: prepare-testing-items_unit-test uses: Chisanan232/GitHub-Action-Template-Python/.github/workflows/rw_run_test.yaml@master with: + python_version: '3.10' test_type: unit-test all_test_items_paths: ${{needs.prepare-testing-items_unit-test.outputs.all_test_items}} setup_http_server: true @@ -149,14 +154,7 @@ is provided by previous workflow? That is all testing items. > It also has another reusable workflow names _poetry_run_test_via_pytest.yaml_. If your Python project manages by **Poetry**, > it recommends you to use this one replaces _rw_run_test.yaml_. The usage and running details are mostly same > as _rw_run_test.yaml_. But, workflow _poetry_run_test_via_pytest.yaml_ only supports Python version 3.8 up. -> - -* Difference between workflows _rw_run_test.yaml_ and _poetry_run_test_via_pytest.yaml_ - -| Workflow | Running way | Support Python version | -|-----------------------------------|---------------------------------------------------|------------------------| -| _rw_run_test.yaml_ | Command lines like ``pip``, ``python``, etc | 3.6 - 3.11 | -| _poetry_run_test_via_pytest.yaml_ | Use ``poetry`` feature or run command lines in it | 3.8 - 3.11 | +>
@@ -165,12 +163,42 @@ is provided by previous workflow? That is all testing items. * Description: Same working with workflow _rw_run_test.yaml_, but this workflow would run test via **_Poetry_**. +* Difference between workflows _rw_run_test.yaml_ and _poetry_run_test_via_pytest.yaml_: + +| Workflow | Running way | +|-----------------------------------|---------------------------------------------------| +| _rw_run_test.yaml_ | Command lines like ``pip``, ``python``, etc | +| _poetry_run_test_via_pytest.yaml_ | Use ``poetry`` feature or run command lines in it | + + +
+ +### _rw_run_test_with_multi_py_versions.yaml_ + +* Description: Almost same working with workflow _rw_run_test.yaml_, but it would run test with multiple Python versions +with multiple runtime environment OS. + + +
+ +### _rw_poetry_run_test_with_multi_py_versions.yaml_ + +* Description: Almost same working with workflow _rw_poetry_run_test.yaml_, but it would run test with multiple Python versions +with multiple runtime environment OS. + +* Difference between workflows _rw_run_test_with_multi_py_version.yaml_ and _rw_poetry_run_test_with_multi_py_versions.yaml_ + + | Workflow | Running way | Support Python version | + |--------------------------------------------------|---------------------------------------------------|------------------------| + | _rw_run_test_with_multi_py_version.yaml_ | Command lines like ``pip``, ``python``, etc | 3.6 - 3.11 | + | _rw_poetry_run_test_with_multi_py_versions.yaml_ | Use ``poetry`` feature or run command lines in it | 3.8 - 3.11 | +
### _rw_organize_test_cov_reports.yaml_ -* Description: Organize all the testing coverage reports which be generated in different runtime OS with Python version. (it would save reports by _actions/upload-artifact@v3_). +* Description: Organize all the testing coverage reports which be generated in different runtime OS with Python version. (it would save reports by _actions/upload-artifact_). * Options: | option name | data type | optional or required | function content | @@ -197,7 +225,7 @@ No, but it would save the testing coverage reports to provide after-process to o test_type: unit-test ``` -It would upload the organized report via _actions/upload-artifact@v3_. And it doesn't support customize options of _actions/upload-artifact@v3_ currently. +It would upload the organized report via _actions/upload-artifact_. And it doesn't support customize options of _actions/upload-artifact_ currently.
@@ -212,7 +240,7 @@ _General option_: | option name | data type | optional or required | function content | |---------------------|-----------|------------------------------------------|---------------------------------------------------------------------------------------------------------------------| -| download_path | string | Optional. Default value is './'. | The path to download testing coverage reports via _actions/download-artifact@v3_. | +| download_path | string | Optional. Default value is './'. | The path to download testing coverage reports via _actions/download-artifact_. | | test_type | string | Required | The testing type. In generally, it only has 3 options: _unit-test_, _integration-test_ and _all-type_. | | upload-to-codecov | boolean | Optional. Default value is _false_. | If it's true, it would upload testing coverage report for Codecov (https://codecov.io). | | codecov_flags | string | Optional. Default value is empty string. | The flags of the testing coverage report for Codecov. This option would be required if _upload-to-codecov_ is true. | From adeac42397f9e7bd1a2022732d4340b2eaff77df Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Tue, 9 Apr 2024 14:27:44 +0800 Subject: [PATCH 12/13] =?UTF-8?q?=F0=9F=A7=AC=20Rename=20the=20reusable=20?= =?UTF-8?q?workflow=20to=20be=20more=20clear=20its=20target.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...version.yaml => rw_run_test_with_multi_py_versions.yaml} | 0 .github/workflows/test_python_project_ci_multi-tests.yaml | 4 ++-- .github/workflows/test_python_project_ci_one-test.yaml | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) rename .github/workflows/{rw_run_test_with_multi_py_version.yaml => rw_run_test_with_multi_py_versions.yaml} (100%) diff --git a/.github/workflows/rw_run_test_with_multi_py_version.yaml b/.github/workflows/rw_run_test_with_multi_py_versions.yaml similarity index 100% rename from .github/workflows/rw_run_test_with_multi_py_version.yaml rename to .github/workflows/rw_run_test_with_multi_py_versions.yaml diff --git a/.github/workflows/test_python_project_ci_multi-tests.yaml b/.github/workflows/test_python_project_ci_multi-tests.yaml index e93aeb9a..55b83ded 100644 --- a/.github/workflows/test_python_project_ci_multi-tests.yaml +++ b/.github/workflows/test_python_project_ci_multi-tests.yaml @@ -24,7 +24,7 @@ on: # The shell scripts or actions this workflow would use. - ".github/workflows/rw_get_tests.yaml" - ".github/workflows/rw_run_test.yaml" - - ".github/workflows/rw_run_test_with_multi_py_version.yaml" + - ".github/workflows/rw_run_test_with_multi_py_versions.yaml" - ".github/workflows/rw_organize_test_cov_reports.yaml" - "scripts/ci/combine_coverage_reports.sh" - ".github/workflows/rw_upload_test_cov_report.yaml" @@ -58,7 +58,7 @@ on: # The shell scripts or actions this workflow would use. - ".github/workflows/rw_get_tests.yaml" - ".github/workflows/rw_run_test.yaml" - - ".github/workflows/rw_run_test_with_multi_py_version.yaml" + - ".github/workflows/rw_run_test_with_multi_py_versions.yaml" - ".github/workflows/rw_organize_test_cov_reports.yaml" - "scripts/ci/combine_coverage_reports.sh" - ".github/workflows/rw_upload_test_cov_report.yaml" diff --git a/.github/workflows/test_python_project_ci_one-test.yaml b/.github/workflows/test_python_project_ci_one-test.yaml index fb6a9799..89b53768 100644 --- a/.github/workflows/test_python_project_ci_one-test.yaml +++ b/.github/workflows/test_python_project_ci_one-test.yaml @@ -24,7 +24,7 @@ on: # The shell scripts or actions this workflow would use. - ".github/workflows/rw_get_tests.yaml" - ".github/workflows/rw_run_test.yaml" - - ".github/workflows/rw_run_test_with_multi_py_version.yaml" + - ".github/workflows/rw_run_test_with_multi_py_versions.yaml" - ".github/workflows/rw_organize_test_cov_reports.yaml" - "scripts/ci/combine_coverage_reports.sh" - ".github/workflows/rw_upload_test_cov_report.yaml" @@ -58,7 +58,7 @@ on: # The shell scripts or actions this workflow would use. - ".github/workflows/rw_get_tests.yaml" - ".github/workflows/rw_run_test.yaml" - - ".github/workflows/rw_run_test_with_multi_py_version.yaml" + - ".github/workflows/rw_run_test_with_multi_py_versions.yaml" - ".github/workflows/rw_organize_test_cov_reports.yaml" - "scripts/ci/combine_coverage_reports.sh" - ".github/workflows/rw_upload_test_cov_report.yaml" @@ -80,7 +80,7 @@ jobs: run_unit-test: # name: Run all unit test items needs: prep-testbed_unit-test - uses: ./.github/workflows/rw_run_test_with_multi_py_version.yaml + uses: ./.github/workflows/rw_run_test_with_multi_py_versions.yaml with: test_type: unit-test all_test_items_paths: ${{needs.prep-testbed_unit-test.outputs.all_test_items}} From 0590064633ec9c76f83e49299b0b1cb15c63084e Mon Sep 17 00:00:00 2001 From: Chisanan232 Date: Tue, 9 Apr 2024 17:47:09 +0800 Subject: [PATCH 13/13] =?UTF-8?q?=F0=9F=9A=AE=20Remove=20unused=20config.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...oetry_run_test_with_multi_py_versions.yaml | 44 ------------------- 1 file changed, 44 deletions(-) diff --git a/.github/workflows/rw_poetry_run_test_with_multi_py_versions.yaml b/.github/workflows/rw_poetry_run_test_with_multi_py_versions.yaml index 0012dd97..92976ade 100644 --- a/.github/workflows/rw_poetry_run_test_with_multi_py_versions.yaml +++ b/.github/workflows/rw_poetry_run_test_with_multi_py_versions.yaml @@ -85,47 +85,3 @@ jobs: http_server_port: ${{ inputs.http_server_port }} http_server_app_module: ${{ inputs.http_server_app_module }} http_server_enter_point: ${{ inputs.http_server_enter_point }} - - -# steps: -# - uses: actions/checkout@v3 -# -# - name: Install Python ${{ matrix.python-version }} -# uses: actions/setup-python@v4 -# with: -# python-version: ${{ matrix.python-version }} -# -# - name: Install Python dependencies -# run: | -# python -m pip install --upgrade pip -# pip install -U pip -# pip install -U flask -# pip install -U gunicorn -# pip install -U poetry -# -# - name: Build Python runtime environment by Poetry -# run: | -# poetry --version -# poetry install -# -# - name: Setup and run HTTP server for testing -# if: ${{ inputs.setup_http_server == true }} -# run: gunicorn --bind ${{ inputs.http_server_host }}:${{ inputs.http_server_port }} '${{ inputs.http_server_app_module }}:${{ inputs.http_server_enter_point }}' --daemon -# -# - name: Test to send HTTP request to sample HTTP server -# if: ${{ inputs.setup_http_server == true }} -# run: curl "http://${{ inputs.http_server_host }}:${{ inputs.http_server_port }}/exchangeReport/STOCK_DAY?response=json&date=20170101&stockNo=2331" -# -# - name: Run tests with pytest -# run: poetry run pytest ${{ matrix.test-path }} -# continue-on-error: true -# -# - name: Rename the code coverage result file -# run: mv ./.coverage ./.coverage.${{ inputs.test_type }}.${{ matrix.os }}-${{ matrix.python-version }} -# -# - name: Upload code coverage result file -# uses: actions/upload-artifact@v3 -# with: -# name: coverage -# path: .coverage.${{ inputs.test_type }}.${{ matrix.os }}-${{ matrix.python-version }} -# if-no-files-found: error