-
Notifications
You must be signed in to change notification settings - Fork 147
139 lines (123 loc) · 4.37 KB
/
nightly.yaml
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
name: "Nightly"
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
Run-Unit-TEST-In-Cython:
runs-on: ubuntu-latest
services:
mysql:
image: dongtai/dongtai-mysql-unittest:latest
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping --silent"
--health-interval 10s
--health-timeout 180s
--health-retries 10
redis:
image: dongtai/dongtai-redis:latest
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
max-parallel: 4
matrix:
python-version: ["3.10"]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python
uses: ./.github/actions/setup-python
- name: Install dependencies
run: pip install coverage
- name: Django Unit Testing
run: |
export CELERY_EAGER_TEST=TRUE
cp dongtai_conf/conf/config.ini.test dongtai_conf/conf/config.ini
mkdir -p /tmp/logstash/report/{img,word,pdf,excel} && mkdir -p /tmp/iast_cache/package && mkdir -p /tmp/logstash/batchagent
python3 ./deploy/docker/version_update.py || true
python3 manage.py migrate
pip install Cython==3.0.0
python setup.py build_ext --inplace
find . -name "*.so" | grep test | xargs rm
coverage run --source='.' manage.py test
coverage report
Run-API-TEST-With-Cython:
runs-on: ubuntu-latest
services:
mysql:
image: dongtai/dongtai-mysql-unittest:latest
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping --silent"
--health-interval 10s
--health-timeout 180s
--health-retries 10
redis:
image: dongtai/dongtai-redis:latest
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
strategy:
max-parallel: 4
matrix:
python-version: ["3.10"]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python
uses: ./.github/actions/setup-python
- name: Install dependencies
run: |
pip install schemathesis
pip install httpx
- name: Django Api Testing
run: |
mysql --host=127.0.0.1 -uroot -p'dongtai-iast' -D dongtai_webapi < /home/runner/work/DongTai/DongTai/test/init.sql
cp dongtai_conf/conf/config.ini.test dongtai_conf/conf/config.ini
export DOC=TRUE
mkdir -p /tmp/logstash/report/{img,word,pdf,excel} && mkdir -p /tmp/iast_cache/package && mkdir -p /tmp/logstash/batchagent
python3 ./deploy/docker/version_update.py || true
python3 manage.py migrate
pip install Cython==3.0.0
python setup.py build_ext --inplace
python setup.py build_ext --inplace
python3 manage.py runserver 0.0.0.0:8000 > webapi.log &
sleep 15
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 --validate-schema=false --hypothesis-verbosity normal
Run-BuildCheck:
if: ${{ github.repository_owner == 'HXSecurity' }}
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: ["3.10"]
arch: ["linux/amd64", "linux/arm64"]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup QEMU
uses: docker/setup-qemu-action@v1
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build and push ${{ matrix.arch }}
uses: docker/build-push-action@v2
with:
file: Dockerfile
context: .
# push: True
platforms: ${{ matrix.arch }}
tags: |
registry.cn-hongkong.aliyuncs.com/secnium/dongtai-server-test:latest
registry.cn-hongkong.aliyuncs.com/secnium/dongtai-server-test:1.0.${{github.run_number}}