Skip to content

Commit e9fc658

Browse files
committed
ci(cython): add cython test in ci.
1 parent e01807c commit e9fc658

File tree

2 files changed

+102
-1
lines changed

2 files changed

+102
-1
lines changed

.github/workflows/teststate.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,107 @@ jobs:
180180
mkdir -p /tmp/logstash/report/{img,word,pdf,excel} && mkdir -p /tmp/iast_cache/package && mkdir -p /tmp/logstash/batchagent
181181
python3 ./deploy/docker/version_update.py || true
182182
python manage.py test
183+
184+
Run-Unit-TEST-In-Cython:
185+
runs-on: ubuntu-latest
186+
services:
187+
mysql:
188+
image: dongtai/dongtai-mysql-unittest:latest
189+
ports:
190+
- 3306:3306
191+
options: >-
192+
--health-cmd "mysqladmin ping --silent"
193+
--health-interval 10s
194+
--health-timeout 180s
195+
--health-retries 10
196+
redis:
197+
image: dongtai/dongtai-redis:latest
198+
ports:
199+
- 6379:6379
200+
options: >-
201+
--health-cmd "redis-cli ping"
202+
--health-interval 10s
203+
--health-timeout 5s
204+
--health-retries 5
205+
strategy:
206+
max-parallel: 4
207+
matrix:
208+
python-version: ["3.10"]
209+
210+
steps:
211+
- name: Checkout
212+
uses: actions/checkout@v2
213+
- uses: actions/setup-python@v4
214+
with:
215+
python-version: "3.10"
216+
217+
- name: Install dependencies
218+
run: |
219+
sudo apt-get install build-essential cmake ninja-build python3-dev cython3 pybind11-dev libre2-dev -y
220+
python -m pip install --upgrade pip
221+
pip install -r requirements.txt
222+
223+
- name: Django Unit Testing
224+
run: |
225+
cp dongtai_conf/conf/config.ini.test dongtai_conf/conf/config.ini
226+
mkdir -p /tmp/logstash/report/{img,word,pdf,excel} && mkdir -p /tmp/iast_cache/package && mkdir -p /tmp/logstash/batchagent
227+
python3 ./deploy/docker/version_update.py || true
228+
python setup.py build_ext --inplace
229+
python manage.py test
230+
231+
Run-API-TEST-With-Cython:
232+
runs-on: ubuntu-latest
233+
services:
234+
mysql:
235+
image: dongtai/dongtai-mysql-unittest:latest
236+
ports:
237+
- 3306:3306
238+
options: >-
239+
--health-cmd "mysqladmin ping --silent"
240+
--health-interval 10s
241+
--health-timeout 180s
242+
--health-retries 10
243+
redis:
244+
image: dongtai/dongtai-redis:latest
245+
ports:
246+
- 6379:6379
247+
options: >-
248+
--health-cmd "redis-cli ping"
249+
--health-interval 10s
250+
--health-timeout 5s
251+
--health-retries 5
252+
strategy:
253+
max-parallel: 4
254+
matrix:
255+
python-version: ["3.10"]
256+
257+
steps:
258+
- name: Checkout
259+
uses: actions/checkout@v2
260+
- uses: actions/setup-python@v4
261+
with:
262+
python-version: "3.10"
263+
264+
- name: Install dependencies
265+
run: |
266+
sudo apt-get install build-essential cmake ninja-build python3-dev cython3 pybind11-dev libre2-dev -y
267+
python -m pip install --upgrade pip
268+
pip install -r requirements.txt
269+
pip install schemathesis
270+
pip install httpx
271+
272+
- name: Django Api Testing
273+
run: |
274+
mysql --host=127.0.0.1 -uroot -p'dongtai-iast' -D dongtai_webapi < /home/runner/work/DongTai/DongTai/test/init.sql
275+
cp dongtai_conf/conf/config.ini.test dongtai_conf/conf/config.ini
276+
export DOC=TRUE
277+
mkdir -p /tmp/logstash/report/{img,word,pdf,excel} && mkdir -p /tmp/iast_cache/package && mkdir -p /tmp/logstash/batchagent
278+
python3 ./deploy/docker/version_update.py || true
279+
python setup.py build_ext --inplace
280+
python3 manage.py runserver 0.0.0.0:8000 > webapi.log &
281+
sleep 15
282+
schemathesis run --base-url "http://localhost:8000/" -H 'Authorization: Token 67aebd78e700ad36a82a152276196b5f49fafeb0' http://localhost:8000/api/XZPcGFKoxYXScwGjQtJx8u/schema/ --hypothesis-suppress-health-check=data_too_large,filter_too_much,too_slow,return_value,large_base_example,not_a_test_method,function_scoped_fixture --validate-schema=false --hypothesis-verbosity normal
283+
183284
analyze:
184285
name: Analyze
185286
runs-on: ubuntu-latest

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ENV LANGUAGE=en_US.UTF-8
77
ENV TZ=Asia/Shanghai
88

99
RUN apt-get update -y \
10-
&& apt install -y gettext gcc make cmake libmariadb-dev curl libc6-dev unzip cron fonts-wqy-microhei vim build-essential ninja-build cython3 pybind11-dev libre2-dev locales \
10+
&& apt install -y --no-install-recommends gettext gcc make cmake libmariadb-dev curl libc6-dev unzip cron fonts-wqy-microhei vim build-essential ninja-build cython3 pybind11-dev libre2-dev locales \
1111
# htop sysstat net-tools iproute2 procps lsof \
1212
openjdk-11-jdk wkhtmltopdf \
1313
&& sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen \

0 commit comments

Comments
 (0)