@@ -5,10 +5,10 @@ name: "Nightly"
55on :
66 schedule :
77 - cron : ' 0 0 * * *'
8+ workflow_dispatch :
89
910jobs :
10- # This workflow contains a single job called "build"
11- Run-API-TEST :
11+ Run-Unit-TEST-In-Cython :
1212 runs-on : ubuntu-latest
1313 services :
1414 mysql :
@@ -40,37 +40,87 @@ jobs:
4040 - uses : actions/setup-python@v4
4141 with :
4242 python-version : " 3.10"
43- ref : main
43+ cache : " pip"
44+
4445 - name : Install dependencies
4546 run : |
4647 sudo apt-get install build-essential cmake ninja-build python3-dev cython3 pybind11-dev libre2-dev -y
4748 python -m pip install --upgrade pip
4849 pip install wheel
50+ pip install coverage
4951 pip install -r requirements.txt
50- pip install schemathesis
51- pip install httpx
52-
53- - name : Install dependencies
52+
53+ - name : Django Unit Testing
5454 run : |
55- curl -X GET "https://iast.io/openapi/api/v1/agent/download?url=https://iast.io/openapi&language=python&projectName=WEBAPI${{ github.repository_owner }}.${{github.run_number}}" -H "Authorization: Token a303ab4bedc93f96808335d023d7ac4d2ba00773" -o dongtai-agent-python.tar.gz -k
56- pip install dongtai-agent-python.tar.gz
55+ export CELERY_EAGER_TEST=TRUE
56+ cp dongtai_conf/conf/config.ini.test dongtai_conf/conf/config.ini
57+ mkdir -p /tmp/logstash/report/{img,word,pdf,excel} && mkdir -p /tmp/iast_cache/package && mkdir -p /tmp/logstash/batchagent
58+ python3 ./deploy/docker/version_update.py || true
59+ python3 manage.py migrate
60+ pip install Cython==3.0.0
61+ python setup.py build_ext --inplace
62+ find . -name "*.so" | grep test | xargs rm
63+ coverage run --source='.' manage.py test
64+ coverage report
65+
66+ Run-API-TEST-With-Cython :
67+ runs-on : ubuntu-latest
68+ services :
69+ mysql :
70+ image : dongtai/dongtai-mysql-unittest:latest
71+ ports :
72+ - 3306:3306
73+ options : >-
74+ --health-cmd "mysqladmin ping --silent"
75+ --health-interval 10s
76+ --health-timeout 180s
77+ --health-retries 10
78+ redis :
79+ image : dongtai/dongtai-redis:latest
80+ ports :
81+ - 6379:6379
82+ options : >-
83+ --health-cmd "redis-cli ping"
84+ --health-interval 10s
85+ --health-timeout 5s
86+ --health-retries 5
87+ strategy :
88+ max-parallel : 4
89+ matrix :
90+ python-version : ["3.10"]
5791
92+ steps :
93+ - name : Checkout
94+ uses : actions/checkout@v2
95+ - uses : actions/setup-python@v4
96+ with :
97+ python-version : " 3.10"
98+ cache : " pip"
5899
100+ - name : Install dependencies
101+ run : |
102+ sudo apt-get install build-essential cmake ninja-build python3-dev cython3 pybind11-dev libre2-dev -y
103+ python -m pip install --upgrade pip
104+ pip install wheel
105+ pip install -r requirements.txt
106+ pip install schemathesis
107+ pip install httpx
108+
59109 - name : Django Api Testing
60110 run : |
61111 mysql --host=127.0.0.1 -uroot -p'dongtai-iast' -D dongtai_webapi < /home/runner/work/DongTai/DongTai/test/init.sql
62112 cp dongtai_conf/conf/config.ini.test dongtai_conf/conf/config.ini
63- export PROJECT_NAME=DONGTAI-SERVER.${{ github.repository_owner }}
64- export PROJECT_VERSION=${{github.run_number}}
65113 export DOC=TRUE
66- export PYTHONAGENT=TRUE
67114 mkdir -p /tmp/logstash/report/{img,word,pdf,excel} && mkdir -p /tmp/iast_cache/package && mkdir -p /tmp/logstash/batchagent
68115 python3 ./deploy/docker/version_update.py || true
69- python3 manage.py updatedepartmenttoken
70- python3 manage.py runserver 0.0.0.0:8000 &
71- sleep 60
72- 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,large_base_example,function_scoped_fixture --validate-schema=false --hypothesis-verbosity normal
73-
116+ python3 manage.py migrate
117+ pip install Cython==3.0.0
118+ python setup.py build_ext --inplace
119+ python setup.py build_ext --inplace
120+ python3 manage.py runserver 0.0.0.0:8000 > webapi.log &
121+ sleep 15
122+ schemathesis run --rate-limit=28/s --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,large_base_example,function_scoped_fixture --validate-schema=false --hypothesis-verbosity normal
123+
74124 Run-BuildCheck :
75125 if : ${{ github.repository_owner == 'HXSecurity' }}
76126 runs-on : ubuntu-latest
0 commit comments