-
Notifications
You must be signed in to change notification settings - Fork 0
198 lines (174 loc) · 6.46 KB
/
action-e2e-test.yaml
File metadata and controls
198 lines (174 loc) · 6.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: E2E test
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:
# End-to-End test
- ".github/workflows/action-e2e-test.yaml"
- "scripts/ci/verify_fake_api_server_state.sh"
# Source code and config
- "fake_api_server/**/*.py"
- "!**/__pkg_info__.py"
- "action.yaml"
- "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:
# End-to-End test
- ".github/workflows/action-e2e-test.yaml"
- "scripts/ci/verify_fake_api_server_state.sh"
# Source code and config
- "fake_api_server/**/*.py"
- "!**/__pkg_info__.py"
- "action.yaml"
- "pyproject.toml"
- "poetry.lock"
jobs:
use_latest_run_rest-server:
runs-on: ubuntu-latest
steps:
- name: Clone project
uses: actions/checkout@v6
- name: Run Fake-API-Server with RestFUL server & subcommand line *run*
uses: ./
with:
server-type: 'rest-server'
operation: run
operation-options: --app-type fastapi -c ./test/data/divide_test_pull/divide_api+has_tag/expect_config/api.yaml -b 0.0.0.0:9672 -D
apply-version: 'latest'
- name: Validate the feature by trying to send API request
shell: bash
run: |
echo "Wait 3 seconds for setup fake API server ..."
sleep 3
echo "========== check log file =========="
ls -la
cat ./fake-api-server.log
echo "========== check feature by request API to fake server =========="
bash ./scripts/ci/verify_fake_api_server_state.sh -a '127.0.0.1:9672' -p '/api/v1/test/foo?date=2025-03-29T00:00:00.000Z&fooType=ENUM1'
run_rest-server_subcmd_run:
runs-on: ubuntu-latest
steps:
- name: Clone project
uses: actions/checkout@v6
- name: Run Fake-API-Server with RestFUL server & subcommand line *run*
uses: ./
with:
server-type: 'rest-server'
operation: run
operation-options: --app-type fastapi -c ./test/data/divide_test_pull/divide_api+has_tag/expect_config/api.yaml -b 0.0.0.0:9672 -D
- name: Validate the feature by trying to send API request
shell: bash
run: |
echo "Wait 3 seconds for setup fake API server ..."
sleep 3
echo "========== check log file =========="
ls -la
cat ./fake-api-server.log
echo "========== check feature by request API to fake server =========="
bash ./scripts/ci/verify_fake_api_server_state.sh -a '127.0.0.1:9672' -p '/api/v1/test/foo?date=2025-03-29T00:00:00.000Z&fooType=ENUM1'
run_rest-server_subcmd_run_by_entire_cmd:
runs-on: ubuntu-latest
steps:
- name: Clone project
uses: actions/checkout@v6
- name: Run Fake-API-Server with RestFUL server & subcommand line *run*
uses: ./
with:
directly-command-line: 'rest-server run --app-type fastapi -c ./test/data/divide_test_pull/divide_api+has_tag/expect_config/api.yaml -b 127.0.0.1:9672 -D'
- name: Validate the feature by trying to send API request
shell: bash
run: |
echo "Wait 3 seconds for setup fake API server ..."
sleep 3
echo "========== check log file =========="
ls -la
cat ./fake-api-server.log
echo "========== check feature by request API to fake server =========="
bash ./scripts/ci/verify_fake_api_server_state.sh -a '127.0.0.1:9672' -p '/api/v1/test/foo?date=2025-03-29T00:00:00.000Z&fooType=ENUM1'
run_rest-server_subcmd_get:
runs-on: ubuntu-latest
steps:
- name: Clone project
uses: actions/checkout@v6
- name: Run Fake-API-Server with RestFUL server & subcommand line *get*
uses: ./
with:
server-type: 'rest-server'
operation: get
operation-options: -p ./test/data/divide_test_pull/divide_api+has_tag/expect_config/api.yaml -s -a /foo
run_rest-server_subcmd_add:
runs-on: ubuntu-latest
steps:
- name: Clone project
uses: actions/checkout@v6
- name: Run Fake-API-Server with RestFUL server & subcommand line *add*
uses: ./
with:
server-type: 'rest-server'
operation: add
operation-options: --help
run_rest-server_subcmd_sample:
runs-on: ubuntu-latest
steps:
- name: Clone project
uses: actions/checkout@v6
- name: Run Fake-API-Server with RestFUL server & subcommand line *sample*
uses: ./
with:
server-type: 'rest-server'
operation: sample
operation-options: -p
run_rest-server_subcmd_check:
runs-on: ubuntu-latest
steps:
- name: Clone project
uses: actions/checkout@v6
- name: Run Fake-API-Server with RestFUL server & subcommand line *check*
uses: ./
with:
server-type: 'rest-server'
operation: check
operation-options: -p ./test/data/divide_test_pull/divide_api+has_tag/expect_config/api.yaml
run_rest-server_subcmd_pull:
runs-on: ubuntu-latest
steps:
- name: Clone project
uses: actions/checkout@v6
- name: Run Fake-API-Server with RestFUL server & subcommand line *pull*
uses: ./
with:
server-type: 'rest-server'
operation: pull
operation-options: --help
with-invalid-os:
runs-on: windows-latest
steps:
- name: Clone project
uses: actions/checkout@v6
- name: Run Fake-API-Server with invalid OS
id: e2e-test-invalid-case
uses: ./
with:
config-path: ./test/config/e2e_test/with_invalid_os.yaml
continue-on-error: true
- name: Check on failures
run: |
echo "[DEBUG] running state: ${{ steps.e2e-test-invalid-case.outcome }}"
if ( "${{ steps.e2e-test-invalid-case.outcome }}" -eq "failure" )
{
echo "It runs fail as expect. Test PASS."
exit 0
}
else
{
echo "It runs success as unexpect. Test FAIL."
exit 1
}