-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (122 loc) · 5.46 KB
/
ci.yaml
File metadata and controls
137 lines (122 loc) · 5.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: CI
on:
# No matter for push or pull request events, it would trigger CI for safely saving the source code.
# For the push event, it only runs building and testing.
push:
branches:
- "master"
paths:
# For GitHub Action
- ".github/workflows/**ci.yaml"
- ".github/workflows/rw_build_and_test.yaml"
- ".github/workflows/rw_poetry_run_test_with_multi_py_versions.yaml"
# For source code and test
- "fake_api_server/**/*.py"
- "!**/__pkg_info__.py"
- "test/**/*.py"
# For shell script for CI
- "scripts/run_all_tests.sh"
# For configurations for test or CI
- ".coveragerc"
- "codecov.yml"
- "pytest.ini"
- "sonar-project.properties"
# For Python project configuration
- "pyproject.toml"
- "poetry.lock"
# For the push event, in addition to build and test would be run, it would trigger other service to keep the reports
# or other checking, i.e., record the test report by CodeCov and check the code quality by SonarQube.
pull_request:
branches:
- "master"
paths:
# For GitHub Action
- ".github/workflows/**ci.yaml"
- ".github/workflows/rw_build_and_test.yaml"
- ".github/workflows/rw_poetry_run_test_with_multi_py_versions.yaml"
# For source code and test
- "fake_api_server/**/*.py"
- "!**/__pkg_info__.py"
- "test/**/*.py"
# For shell script for CI
- "scripts/run_all_tests.sh"
# For configurations for test or CI
- ".coveragerc"
- "codecov.yml"
- "pytest.ini"
- "sonar-project.properties"
# For Python project configuration
- "pyproject.toml"
- "poetry.lock"
jobs:
build-and-test:
# name: Run all tests and organize all test reports
if: ${{ !contains(github.event.pull_request.labels.*.name, 'dependencies') }}
uses: ./.github/workflows/rw_build_and_test.yaml
unit-test_codecov_finish:
# name: Organize and generate the testing report and upload it to Codecov
if: ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref_name == 'master') }}
needs: build-and-test
uses: Chisanan232/GitHub-Action_Reusable_Workflows-Python/.github/workflows/rw_upload_test_cov_report.yaml@v7.3
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
with:
test_type: unit-test
upload-to-codecov: true
codecov_flags: unit-test # Required if 'upload-to-codecov' is true
codecov_name: pyfake-api-server # Required if 'upload-to-codecov' is true
integration-test_codecov_finish:
# name: Organize and generate the testing report and upload it to Codecov
if: ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref_name == 'master') }}
needs: build-and-test
uses: Chisanan232/GitHub-Action_Reusable_Workflows-Python/.github/workflows/rw_upload_test_cov_report.yaml@v7.3
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
with:
test_type: integration-test
upload-to-codecov: true
codecov_flags: integration-test # Required if 'upload-to-codecov' is true
codecov_name: pyfake-api-server # Required if 'upload-to-codecov' is true
system-test_codecov_finish:
# name: Organize and generate the testing report and upload it to Codecov
if: ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref_name == 'master') }}
needs: build-and-test
uses: Chisanan232/GitHub-Action_Reusable_Workflows-Python/.github/workflows/rw_upload_test_cov_report.yaml@v7.3
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
with:
test_type: system-test
upload-to-codecov: true
codecov_flags: system-test # Required if 'upload-to-codecov' is true
codecov_name: pyfake-api-server # Required if 'upload-to-codecov' is true
all-test_codecov_finish:
# name: Organize and generate the testing report and upload it to Codecov
if: ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref_name == 'master') }}
needs: build-and-test
uses: Chisanan232/GitHub-Action_Reusable_Workflows-Python/.github/workflows/rw_upload_test_cov_report.yaml@v7.3
secrets:
codecov_token: ${{ secrets.CODECOV_TOKEN }}
with:
test_type: all-test
upload-to-codecov: true
codecov_flags: all-test # Required if 'upload-to-codecov' is true
codecov_name: pyfake-api-server # Required if 'upload-to-codecov' is true
sonarcloud_finish:
# name: SonarCloud Scan
if: ${{ github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref_name == 'master') }}
needs: build-and-test
uses: Chisanan232/GitHub-Action_Reusable_Workflows-Python/.github/workflows/rw_sonarqube_scan.yaml@v7.3
secrets:
sonar_token: ${{ secrets.SONAR_TOKEN }}
with:
download_path: ${{ inputs.download_path }}
pre-building_test:
# name: Check about it could work finely by installing the Python package with setup.py file
needs: [unit-test_codecov_finish, integration-test_codecov_finish, system-test_codecov_finish, all-test_codecov_finish, sonarcloud_finish]
if: ${{ github.ref_name == 'release' || github.ref_name == 'master' }}
uses: Chisanan232/GitHub-Action_Reusable_Workflows-Python/.github/workflows/rw_pre-building_test.yaml@v7.3
with:
build-type: poetry
python_package_name: fake-api-server
test_shell_in_python: from fake_api_server.runner import run
test_shell: fake rest-server run --help