Skip to content

Commit 6fe3a42

Browse files
committed
[Breaking Change] (config) Update the document about adding some new info and remove deprecated settings.
1 parent 0957562 commit 6fe3a42

File tree

1 file changed

+44
-76
lines changed

1 file changed

+44
-76
lines changed

README.md

Lines changed: 44 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# GitHub Action - Workflow template for Python library
22

33
[![github-action reusable workflows test](https://github.com/Chisanan232/GitHub-Action-Template-Python/actions/workflows/test-reusable-workflows.yaml/badge.svg)](https://github.com/Chisanan232/GitHub-Action-Template-Python/actions/workflows/test-reusable-workflows.yaml)
4+
[![Release](https://img.shields.io/github/release/Chisanan232/GitHub-Action-Template-Python.svg?label=Release&logo=github)](https://github.com/Chisanan232/GitHub-Action-Template-Python/releases)
45
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?logo=apache)](https://opensource.org/licenses/Apache-2.0)
56

67

@@ -25,8 +26,7 @@ The usage of each workflow template.
2526

2627
* [_prepare_test_items.yaml_](#prepare_test_itemsyaml)
2728
* [_run_test_items_via_pytest.yaml_](#run_test_items_via_pytestyaml)
28-
* [_organize_all_testing_coverage_reports_with_different_os_and_py_version.yaml_](#organize_all_testing_coverage_reports_with_different_os_and_py_versionyaml)
29-
* [_organize_all_testing_reports_with_different_test_type.yaml_](#organize_all_testing_reports_with_different_test_typeyaml)
29+
* [_organize_and_generate_testing_coverage_reports.yaml_](#organize_and_generate_testing_coverage_reportsyaml)
3030
* [_upload_test_report_to_codecov.yaml_](#upload_test_report_to_codecovyaml)
3131
* [_upload_code_report_to_codacy.yaml_](#upload_code_report_to_codacyyaml)
3232

@@ -36,10 +36,10 @@ The usage of each workflow template.
3636
* Description: Prepare the test items.
3737
* Options:
3838

39-
| option name | function content |
40-
|-------------|------------------------------------------------------|
41-
| shell_path | The path shell script for getting the testing items. |
42-
| shell_arg | Input arguments of the shell script. |
39+
| option name | option is optional or required | function content |
40+
|-------------|--------------------------------|------------------------------------------------------|
41+
| shell_path | Required | The path shell script for getting the testing items. |
42+
| shell_arg | Required | Input arguments of the shell script. |
4343

4444
* Output:
4545
* all_test_items: All the test items it would run.
@@ -66,10 +66,15 @@ And we could get this workflow output result via keyword _all_test_items_.
6666
* 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_).
6767
* Options:
6868
69-
| option name | function content |
70-
|----------------------|--------------------------------------------------------------------------------------------|
71-
| test_type | The testing type. In generally, it only has 2 options: _unit-test_ and _integration-test_. |
72-
| all_test_items_paths | The target paths of test items under test. |
69+
| option name | option is optional or required | function content |
70+
|-------------------------|--------------------------------------|--------------------------------------------------------------------------------------------|
71+
| test_type | Required | The testing type. In generally, it only has 2 options: _unit-test_ and _integration-test_. |
72+
| all_test_items_paths | Required | The target paths of test items under test. |
73+
| setup_http_server | Optional, Default value is _false_ | If it's true, it would set up and run HTTP server for testing. |
74+
| http_server_host | Optional, Default value is _0.0.0.0_ | The host IPv4 address of HTTP server. |
75+
| http_server_port | Optional, Default value is _12345_ | The port number of HTTP server. |
76+
| http_server_app_module | Optional, Default value is _app_ | The module path of HTTP server. |
77+
| http_server_enter_point | Optional, Default value is _app_ | The object about the web application. |
7378
7479
* Output:
7580
@@ -85,6 +90,11 @@ No, but it would save the testing coverage reports to provide after-process to o
8590
with:
8691
test_type: unit-test
8792
all_test_items_paths: ${{needs.prepare-testing-items_unit-test.outputs.all_test_items}}
93+
setup_http_server: true
94+
http_server_host: 0.0.0.0
95+
http_server_port: 30303
96+
http_server_app_module: test._http_server.app
97+
http_server_enter_point: app
8898
```
8999
90100
Please take a look of option _all_test_items_paths_. You could find that it get the input result of
@@ -99,79 +109,34 @@ is provided by previous workflow? That is all testing items.
99109
100110
<hr>
101111
102-
#### _organize_all_testing_coverage_reports_with_different_os_and_py_version.yaml_
112+
#### _organize_and_generate_testing_coverage_reports.yaml_
103113
104-
* Description: Organize all the testing coverage reports. (it would save reports by _actions/upload-artifact@v3_).
114+
* 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_).
105115
* Options:
106116
107-
| option name | function content |
108-
|-----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
109-
| test_type | The testing type. In generally, it only has 2 options: _unit-test_ and _integration-test_. |
110-
| generate_xml_report_finally | Something, it only has 1 test type currently. So it could let this option to be 'true' than it would generate XML report finally to let uploading process to use it directly. |
117+
| option name | option is optional or required | function content |
118+
|-----------------------------|--------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
119+
| test_type | Required | The testing type. In generally, it only has 2 options: _unit-test_ and _integration-test_. |
111120
112121
* Output:
113122
114-
No, but it would save the testing coverage reports (coverage.xml) to provide after-process to organize and record.
123+
No, but it would save the testing coverage reports (coverage_<test_type>.xml) to provide after-process to organize and record.
115124
116125
* How to use it?
117126
118127
```yaml
119128
unit-test_codecov:
120129
# name: Organize and generate the testing report and upload it to Codecov
121130
needs: run_unit-test
122-
uses: Chisanan232/GitHub-Action-Template-Python/.github/workflows/organize_all_testing_coverage_reports_with_different_os_and_py_version.yaml@master
131+
uses: Chisanan232/GitHub-Action-Template-Python/.github/workflows/organize_and_generate_testing_coverage_reports.yaml@master
123132
with:
124133
test_type: unit-test
125-
generate_xml_report_finally: true
126134
```
127135
128136
It would upload the organized report via _actions/upload-artifact@v3_. And it doesn't support customize options of _actions/upload-artifact@v3_ currently.
129137
130138
<hr>
131139
132-
#### _organize_all_testing_reports_with_different_test_type.yaml_
133-
134-
* Description: Organize all the testing coverage reports. (it would save reports by _actions/upload-artifact@v3_).
135-
* Options:
136-
137-
It has no input parameter.
138-
139-
* Output:
140-
141-
No, but it would save the testing coverage reports (coverage.xml) to provide after-process to organize and record.
142-
143-
* How to use it?
144-
145-
```yaml
146-
organize_all-test_codecov_and_generate_report:
147-
# name: Organize and generate the testing report and upload it to Codecov
148-
needs: [unit-test_codecov, integration-test_codecov]
149-
uses: Chisanan232/GitHub-Action-Template-Python/.github/workflows/organize_all_testing_reports_with_different_test_type.yaml@master
150-
```
151-
152-
This workflow is very close with another workflow _organize_all_testing_coverage_reports_with_different_os_and_py_version.yaml_.
153-
But they're different. In a software test, it may have one or more test types it would run to check the software quality.
154-
So let us consider below 2 scenarios:
155-
156-
First scenario, it has only one test. So the CI workflow would be like below:
157-
158-
get test items -> run test -> organize and generate testing report
159-
160-
Second one, it has 2 tests: _Unit test_ and _Integration test_:
161-
162-
get unit test items -> run unit test -> organize unit test report ------------------------
163-
|-> organize and generate final test report
164-
get integration test items -> run integration test -> organize integration test report ---
165-
166-
So it should organize testing coverage reports twice, first time is organizing report with one specific test type,
167-
another one time is organizing these 2 test types reports.
168-
Hence, the different is:
169-
* _organize_all_testing_coverage_reports_with_different_os_and_py_version.yaml_ is the first process to organize testing coverage reports.
170-
And it could set option _generate_xml_report_finally_ as _true_ to let the CI workflow be more clear and simpler if it has only one test type.
171-
* _organize_all_testing_reports_with_different_test_type.yaml_ is the second organizing process if it has 2 more test types in CI workflow.
172-
173-
<hr>
174-
175140
#### _upload_test_report_to_codecov.yaml_
176141
177142
* Description: Upload the testing coverage reports to Codecov.
@@ -181,17 +146,18 @@ It has 2 different types option could use:
181146
182147
_General option_:
183148
184-
| option name | function content |
185-
|---------------|-----------------------------------------------------------------------------------|
186-
| download_path | The path to download testing coverage reports via _actions/download-artifact@v3_. |
187-
| codecov_flags | The flags of the testing coverage report for Codecov. |
188-
| codecov_name | The name of the testing coverage report for Codecov. |
149+
| option name | option is optional or required | function content |
150+
|---------------|--------------------------------|--------------------------------------------------------------------------------------------|
151+
| download_path | Required | The path to download testing coverage reports via _actions/download-artifact@v3_. |
152+
| test_type | Required | The testing type. In generally, it only has 2 options: _unit-test_ and _integration-test_. |
153+
| codecov_flags | Required | The flags of the testing coverage report for Codecov. |
154+
| codecov_name | Required | The name of the testing coverage report for Codecov. |
189155
190156
_Secret option_:
191157
192-
| option name | function content |
193-
|---------------|-----------------------------------------------------------------|
194-
| codecov_token | The API token for uploading testing coverage report to Codecov. |
158+
| option name | option is optional or required | function content |
159+
|---------------|--------------------------------|-----------------------------------------------------------------|
160+
| codecov_token | Required | The API token for uploading testing coverage report to Codecov. |
195161
196162
* Output:
197163
@@ -229,15 +195,16 @@ It has 2 different types option could use:
229195
230196
_General option_:
231197
232-
| option name | function content |
233-
|---------------|-----------------------------------------------------------------------------------|
234-
| download_path | The path to download testing coverage reports via _actions/download-artifact@v3_. |
198+
| option name | option is optional or required | function content |
199+
|---------------|--------------------------------|--------------------------------------------------------------------------------------------|
200+
| download_path | Optional | The path to download testing coverage reports via _actions/download-artifact@v3_. |
201+
| test_type | Required | The testing type. In generally, it only has 2 options: _unit-test_ and _integration-test_. |
235202
236203
_Secret option_:
237204
238-
| option name | function content |
239-
|--------------|----------------------------------------------------------------|
240-
| codacy_token | The API token for uploading testing coverage report to Codacy. |
205+
| option name | option is optional or required | function content |
206+
|--------------|--------------------------------|----------------------------------------------------------------|
207+
| codacy_token | Required | The API token for uploading testing coverage report to Codacy. |
241208
242209
* Output:
243210
@@ -256,6 +223,7 @@ Before run this workflow, please make sure testing coverage report is ready.
256223
codacy_token: ${{ secrets.CODACY_PROJECT_TOKEN }}
257224
with:
258225
download_path: ./
226+
test_type: all-test
259227
```
260228
261229
* The badges would be generated after this workflow done:

0 commit comments

Comments
 (0)