Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
780201f
[Breaking Change] (config) Modify the strategy-matrix settings.
Chisanan232 Nov 25, 2022
4bd2c7f
[Breaking Change] (config) Remove debug mode for testing.
Chisanan232 Nov 25, 2022
d8b9ee6
Merge branch 'master' into develop
Chisanan232 Nov 26, 2022
cc28790
[Debug] (config) Print log message about file tree.
Chisanan232 Nov 26, 2022
839fc83
[Debug] (config) Print log message about file tree.
Chisanan232 Nov 26, 2022
4dd3b8c
[Debug] (config) Print log message about file tree.
Chisanan232 Nov 26, 2022
a0ebf9b
[Test] (config) Modify coverage setting to use relative path.
Chisanan232 Nov 26, 2022
c6105c5
[Test] (config) Modify the running commands.
Chisanan232 Nov 26, 2022
d1e19a8
[Test] (config) Back to original setting.
Chisanan232 Nov 26, 2022
72c3a7c
Merge pull request #30 from Chisanan232/develop
Chisanan232 Nov 26, 2022
1f64e8a
[Test] (config) Comment out the running command 'coverage report'.
Chisanan232 Nov 27, 2022
10d5b84
[New Feature] (script) Add new shell script for combining testing cov…
Chisanan232 Nov 28, 2022
ce28f45
[New Feature] (script) Add new processing of converting final testing…
Chisanan232 Nov 28, 2022
c754504
[Breaking Change] (script) Add log messages.
Chisanan232 Nov 28, 2022
5c19566
[Breaking Change] (config) Add new option 'test_os' of reusable workf…
Chisanan232 Nov 28, 2022
34413e7
[Bug Fix] (script) Remove incorrect shell.
Chisanan232 Nov 28, 2022
0554716
[New Feature] (script) Combine all test coverage data files and conve…
Chisanan232 Nov 28, 2022
0cb658e
[Breaking Change] (config) 3 changes:
Chisanan232 Nov 28, 2022
bb25d36
[Breaking Change] (config) Add new option 'test_os' of reusable workf…
Chisanan232 Nov 28, 2022
8e00f23
[Breaking Change] (config) 2 changes:
Chisanan232 Nov 28, 2022
657bb38
[Breaking Change] (config) Adjust settings of test coverage report.
Chisanan232 Nov 28, 2022
9321609
[Test] (config) Test the uploading feature of Codecov.
Chisanan232 Nov 28, 2022
f758425
[Bug Fix] (config) Fix command line issue.
Chisanan232 Nov 28, 2022
6303b52
[Test] (config) Test the uploading feature of Codecov.
Chisanan232 Nov 28, 2022
9395847
[Test] (config) Remove some options to test the uploading feature of …
Chisanan232 Nov 28, 2022
ac11cc0
[Test] (code) Add testing code for testing of codecov.
Chisanan232 Nov 28, 2022
8e6e172
[Breaking Change] (config) Modify the dependency 'coverage' version b…
Chisanan232 Nov 28, 2022
75a0fc0
[Breaking Change] (config) Modify the pip installation version of dep…
Chisanan232 Nov 28, 2022
8b11ace
[Test] (code) Add testing code for testing of codecov.
Chisanan232 Nov 28, 2022
0ef428e
[Test] (code) Remove unused config.
Chisanan232 Nov 28, 2022
8ba2989
[Test] (code) Remove the new setting of dependency 'coverage' setting.
Chisanan232 Nov 28, 2022
bc3b3f1
[Test] (code) Remove log message.
Chisanan232 Nov 28, 2022
3768667
[Test] (script) Remove argument 'os' about runtime OS.
Chisanan232 Nov 28, 2022
865976c
[Test] (config) Remove argument 'test_os' about runtime OS.
Chisanan232 Nov 28, 2022
cd0b476
[Breaking Change + Test] (config) Clean the config.
Chisanan232 Nov 28, 2022
4ae3c42
[Test] (config) Remove argument 'test_os' about runtime OS of all reu…
Chisanan232 Nov 28, 2022
51d1f13
[Bug Fix] (script) Fix to use variable in command running.
Chisanan232 Nov 28, 2022
732b03f
[Breaking Change + Test] (config) Add new option 'relative_files' to …
Chisanan232 Nov 28, 2022
1be07a1
[Breaking Change + Test] (config) Modify the workflow with latest des…
Chisanan232 Nov 29, 2022
db5c96d
[Breaking Change] (script) Remove all unused shell.
Chisanan232 Nov 29, 2022
549b31f
[Breaking Change] (config) Add processing about downloading needed sh…
Chisanan232 Nov 29, 2022
992ae38
Merge pull request #31 from Chisanan232/develop
Chisanan232 Nov 29, 2022
a296b88
[Breaking Change] (config) Add option 'if-no-files-found' of action '…
Chisanan232 Nov 29, 2022
ff6f9a0
[Test] (code) Add setup.py for testing.
Chisanan232 Nov 30, 2022
5126338
[Test] (script) Add Python script for testing.
Chisanan232 Nov 30, 2022
5b326cf
[New Feature] (config) Add new GitHub Action reusable workflow about …
Chisanan232 Nov 30, 2022
8089354
[New Feature] (config) Import new reusable workflow setting.
Chisanan232 Nov 30, 2022
5bee5e6
[Bug Fix] (config) Remove invalid argument of action.
Chisanan232 Nov 30, 2022
5bd43f6
[Breaking Change] (config) Add usage description and modify step name.
Chisanan232 Nov 30, 2022
cddd995
[Docs] (docs) Add section of new reusable workflow 'pre-building_test…
Chisanan232 Nov 30, 2022
185439e
[Docs] (docs) Modify the order of reusable workflows agenda.
Chisanan232 Nov 30, 2022
2a1c513
[Breaking Change] (config) Modify the workflow description.
Chisanan232 Nov 30, 2022
d300baf
Merge pull request #32 from Chisanan232/develop
Chisanan232 Nov 30, 2022
1c0f31b
[Breaking Change] (config) Modify the GitHub repository name.
Chisanan232 Nov 30, 2022
4bb7446
[New Feature] (config) Add new GitHub Action reusable workflow about …
Chisanan232 Nov 30, 2022
bf17a1d
[Breaking Change] (config) Modify to use new reusable workflow.
Chisanan232 Nov 30, 2022
c19fb91
[Docs] (docs) Add section of new reusable workflow 'push_pkg_to_pypi.…
Chisanan232 Nov 30, 2022
c3fe3ba
[Test] (code) Modify the version for testing.
Chisanan232 Nov 30, 2022
79c5629
Merge pull request #33 from Chisanan232/develop
Chisanan232 Dec 1, 2022
2d8a802
[Bug Fix] (config) Add step 'actions/checkout'.
Chisanan232 Dec 1, 2022
9a584fd
Merge pull request #34 from Chisanan232/develop
Chisanan232 Dec 1, 2022
0803454
[Bug Fix] (config) Remove step about running shell to check release t…
Chisanan232 Dec 1, 2022
bcfb067
Merge pull request #35 from Chisanan232/develop
Chisanan232 Dec 1, 2022
4c4620f
[Breaking Change] (code) Modify the package version back to pre-relea…
Chisanan232 Dec 1, 2022
2e1c65d
[Breaking Change] (config) Add more files or directories to ignore by…
Chisanan232 Dec 1, 2022
89782a9
[Breaking Change] (docs) Add v4.0.0 GitHub release title.
Chisanan232 Dec 1, 2022
fd6284a
[Breaking Change] (docs) Add v4.0.0 GitHub release content.
Chisanan232 Dec 1, 2022
6f2e125
Merge pull request #36 from Chisanan232/develop
Chisanan232 Dec 1, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
branch = True
parallel = True
source=./test_gh_workflow
relative_files = True

omit =
*/__init__.py
50 changes: 24 additions & 26 deletions .github/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,40 @@
[//]: # (### 🎉🎊🍾 New feature)

[//]: # (<hr>)
### 🎉🎊🍾 New feature
<hr>

[//]: # ()
[//]: # (1. Add new options about set up and run a sample HTTP server for testing if it needs in some testing scenario &#40;_run_test_items_via_pytest.yaml_&#41;.)
1. Add new reusable workflows.
* _pre-building_test.yaml_: Running pre-testing by simple way with running _setup.py_ script.
* _push_pkg_to_pypi.yaml_: Compile Python source code and push the Python package to PyPI.

[//]: # ()
### 🛠⚙️🔩 **Breaking Change**
<hr>

1. Clear the under testing environments or settings to reduce resource.

1-1. Deprecate and remove some runtime OS versions.

* Deprecated settings: _ubuntu-18.04_, _ubuntu-20.04_, _ubuntu-22.04_, _macos-10.15_, _macos-11_, _macos-12_
* New settings: _ubuntu-latest_, _macos-latest_
1. Modify the workflows detail about testing coverage report processing.
* All report types, e.g., .coverage format data file or XML format report, would be handled and generated in workflow _organize_and_generate_test_cov_reports.yaml_.
* It only processes uploading testing reports in workflow _upload_test_cov_report.yaml_.

1-2. Add more Python version for testing

* New version: _Python 3.11_
### 🛠🐛💣 **Bug Fix**
<hr>

[//]: # (### ⚒⚒💣 **Bug Fix** )
1. Fix issue of setup processing would fail with Python version 3.6 in runtime OS Ubuntu 22.04.
* Modify to test code with Python 3.6 version in Ubuntu 20.04.

[//]: # (### 🔬🧪🧬 **Refactor**)
[//]: # (<hr>)

[//]: # ()
[//]: # (1. Fix the issue about uploading test coverage report cannot work at all.)
[//]: # (1. Upgrade the GitHub Action syntax usage about set-output commands.)

### 🔬🧪🧬 **Refactor**
<hr>
[//]: # ()
[//]: # ( * Change to use environment variable _GITHUB_OUTPUT_.)

1. Upgrade the GitHub Action syntax usage about set-output commands.
[//]: # ( * Refer: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/)

* Change to use environment variable _GITHUB_OUTPUT_.
* Refer: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
[//]: # ()
[//]: # (2. Upgrade the actions which depends on Node.JS version 12 to newer version.)

[//]: # ()
[//]: # ( * Upgrade _actions/checkout_ to version 3.)

2. Upgrade the actions which depends on Node.JS version 12 to newer version.
[//]: # ( * Upgrade _actions/setup-python_ to version 4.)

* Upgrade _actions/checkout_ to version 3.
* Upgrade _actions/setup-python_ to version 4.
* Refer: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/
[//]: # ( * Refer: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/)
2 changes: 1 addition & 1 deletion .github/release-title.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v3.0.0 - Modify under testing OS & Python versions and upgrade dependencies actions 🍻
v4.0.0 🍻🍾 - Add new reusable workflows and fix setup issue with the latest version Ubuntu OS.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
uses: actions/checkout@v3

- name: Download shell script for checking input parameters
run: curl https://raw.githubusercontent.com/Chisanan232/GitHub-Action_Workflow-Template-Python/develop/scripts/ci/build_git-tag_or_create_github-release.sh --output ./scripts/ci/build_git-tag_or_create_github-release.sh
run: curl https://raw.githubusercontent.com/Chisanan232/GitHub-Action_Reusable_Workflows-Python/develop/scripts/ci/build_git-tag_or_create_github-release.sh --output ./scripts/ci/build_git-tag_or_create_github-release.sh

# This flow for the project type is Python project
- name: Build git tag and create GitHub release for Python project
Expand Down
27 changes: 8 additions & 19 deletions .github/workflows/organize_and_generate_test_cov_reports.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ on:
inputs:
test_type:
description: "The testing type. In generally, it only has 2 options: 'unit-test' and 'integration-test'."
required: true
type: string
required: true


jobs:
Expand All @@ -49,33 +49,22 @@ jobs:
python3 -m pip install --upgrade pip
pip3 install -U pip
pip3 install coverage
pip3 install codecov
pip3 install coveralls

- name: Combine all testing code coverage result files with one specific test type
if: ${{ inputs.test_type == 'unit-test' || inputs.test_type == 'integration-test' }}
run: coverage combine --data-file=.coverage.${{ inputs.test_type }} .coverage.${{ inputs.test_type }}.*

- name: Combine all testing code coverage result files with all test types
if: ${{ inputs.test_type == 'all-test' }}
run: coverage combine --data-file=.coverage.${{ inputs.test_type }} .coverage.*

- name: Report testing coverage of project code
run: coverage report -m --data-file=.coverage.${{ inputs.test_type }}

- name: General testing coverage report as XML format with ${{ inputs.test_type }}
run: coverage xml --data-file=.coverage.${{ inputs.test_type }} -o coverage_${{ inputs.test_type }}.xml
- name: Combine all testing coverage data files with test type and runtime OS, and convert to XML format file finally
run: |
curl https://raw.githubusercontent.com/Chisanan232/GitHub-Action_Reusable_Workflows-Python/develop/scripts/ci/combine_coverage_reports.sh --output ./scripts/ci/combine_coverage_reports.sh
bash ./scripts/ci/combine_coverage_reports.sh ${{ inputs.test_type }}

- name: Upload testing coverage report (.coverage)
uses: actions/upload-artifact@v3
with:
name: test_coverage_report
path: .coverage.${{ inputs.test_type }}
name: test_coverage_data_file
path: .coverage
if-no-files-found: error

- name: Upload testing coverage report (.xml)
uses: actions/upload-artifact@v3
with:
name: test_coverage_xml_report
path: coverage_${{ inputs.test_type }}.xml
path: coverage**xml
if-no-files-found: error
81 changes: 81 additions & 0 deletions .github/workflows/pre-building_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
###################################################################################################################
#
# Workflow Description:
# Test Python package by simple way, i.e., import modules, after running setup.py script to install package.
#
# Workflow input parameters:
# * General arguments:
# * python_package_name: The Python package name.
# * test_import_package_code_1: Test for importing the Python package.
# * test_import_package_code_2: Test for importing the Python package.
# * test_import_package_code_3: Run a Python script for testing the Python package.
# * test_python_script: Test for importing the Python package.
#
# Workflow running output:
# No and do nothing.
#
###################################################################################################################

name: Running pre-testing before building with running setup.py script

on:
workflow_call:
inputs:
python_package_name:
description: "The Python package name."
required: true
type: string
test_import_package_code_1:
description: "Test for importing the Python package."
required: true
type: string
test_import_package_code_2:
description: "Test for importing the Python package."
required: false
type: string
test_import_package_code_3:
description: "Test for importing the Python package."
required: false
type: string
test_python_script:
description: "Run a Python script for testing the Python package."
required: false
type: string


jobs:
pre-building_check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

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

- name: Install Python dependencies
run: |
python3 -m pip install --upgrade pip
pip3 install -U pip
pip3 install -U setuptools
pip3 install wheel
pip install -U -r ./requirements/requirements-test.txt

- name: Install Python package by setup.py
run: python3 setup.py install --user || exit 1

- name: Show the Python package information
run: pip3 show ${{ inputs.python_package_name }}

- name: Test to run script with package '${{ inputs.python_package_name }}' in command lines
run: |
${{ inputs.test_import_package_code_1 }}
${{ inputs.test_import_package_code_2 }}
${{ inputs.test_import_package_code_3 }}
shell: python

- name: Test to run script with package '${{ inputs.python_package_name }}' with Python file
run: python3 ${{ inputs.test_python_script }}

82 changes: 82 additions & 0 deletions .github/workflows/push_pkg_to_pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#########################################################################################################################
#
# Workflow Description:
# Push the Python package to PyPI. (Official release the Python package)
#
# Workflow input parameters:
# * General arguments:
# * release-type: The type of release processing. It has 2 type options: 'Official-Release' or 'Pre-Release'.
# It won't push the package to PyPI if it's 'Pre-Release'.
# * push-to-PyPI: Push Python package to official PyPI or test PyPI. It has 2 type options: 'official' or 'test'.
#
# * Secret arguments:
# * PyPI_user: The username of PyPI.
# * PyPI_token: The password token of PyPI.
#
# Workflow running output:
# No and do nothing.
#
#########################################################################################################################

name: Push the Python package to PyPI

on:
workflow_call:
inputs:
release-type:
description: "The type of release processing. It has 2 type options: 'Official-Release' or 'Pre-Release'. It won't
push the package to PyPI if it's 'Pre-Release'."
type: string
required: true
push-to-PyPI:
description: "Push Python package to official PyPI or test PyPI. It has 2 type options: 'official' or 'test'."
type: string
required: false
default: 'test'

secrets:
PyPI_user:
description: "The username of PyPI."
required: true
PyPI_token:
description: "The password token of PyPI."
required: true


jobs:
push_to_PyPI:
if: ${{ inputs.release-type == 'Official-Release' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

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

- name: Install Python dependencies
run: |
python3 -m pip install --upgrade pip
pip3 install -U pip
pip3 install -U setuptools
pip3 install wheel
pip3 install twine

- name: Compile and package the code as Python package formatter
run: python3 setup.py sdist bdist_wheel

- name: Push Python package to test PyPI
if: ${{ inputs.push-to-PyPI == 'test' }}
run: python3 -m twine upload --repository testpypi ./dist/*
env:
TWINE_USERNAME: ${{ secrets.PyPI_user }}
TWINE_PASSWORD: ${{ secrets.PyPI_token }}

- name: Push Python package to official PyPI
if: ${{ inputs.push-to-PyPI == 'official' }}
run: python3 -m twine upload ./dist/*
env:
TWINE_USERNAME: ${{ secrets.PyPI_user }}
TWINE_PASSWORD: ${{ secrets.PyPI_token }}
27 changes: 9 additions & 18 deletions .github/workflows/run_test_items_via_pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,32 +76,23 @@ jobs:
strategy:
matrix:
python-version: [3.6,3.7,3.8,3.9,'3.10','3.11']
os: [ubuntu-latest,macos-latest]
os: [ubuntu-20.04,ubuntu-latest,macos-latest]
exclude:
- os: ubuntu-18.04
- os: ubuntu-latest
python-version: 3.6
- os: ubuntu-18.04
python-version: 3.9
- os: ubuntu-18.04
python-version: '3.10'
- os: ubuntu-20.04
python-version: 3.8
python-version: 3.7
- os: ubuntu-20.04
python-version: 3.9
- os: ubuntu-22.04
python-version: 3.6
- os: macos-10.15
python-version: 3.6
- os: macos-10.15
python-version: 3.8
- os: macos-11
python-version: 3.6
- os: macos-11
- os: ubuntu-20.04
python-version: 3.9
- os: macos-12
python-version: 3.6
- os: ubuntu-20.04
python-version: '3.10'
- os: ubuntu-20.04
python-version: 3.11
test-path: ${{fromJson(inputs.all_test_items_paths)}}


steps:
- uses: actions/checkout@v3

Expand Down
Loading