Skip to content

Commit 3603668

Browse files
authored
Initial commit
0 parents  commit 3603668

17 files changed

+1129
-0
lines changed

.github/workflows/check-services.yml

+152
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
name: check-services
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
list-services:
13+
runs-on: ubuntu-latest
14+
outputs:
15+
matrix: ${{ steps.set-matrix.outputs.matrix }}
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- uses: actions/setup-python@v4
20+
with:
21+
python-version: '3.11'
22+
cache: 'pip'
23+
cache-dependency-path: |
24+
requirements.txt
25+
checkers/requirements.txt
26+
27+
- name: install requirements
28+
run: pip install -r requirements.txt
29+
30+
- name: install checkers requirements
31+
run: pip install -r checkers/requirements.txt
32+
33+
- name: list services, set matrix
34+
id: set-matrix
35+
run: ./check.py list
36+
37+
check-single-service:
38+
runs-on: ubuntu-latest
39+
needs: list-services
40+
strategy:
41+
matrix: ${{ fromJson(needs.list-services.outputs.matrix) }}
42+
43+
steps:
44+
- uses: actions/checkout@v3
45+
46+
- uses: actions/setup-python@v4
47+
with:
48+
python-version: '3.11'
49+
cache: 'pip'
50+
cache-dependency-path: |
51+
requirements.txt
52+
checkers/requirements.txt
53+
54+
- name: install requirements
55+
run: pip install -r requirements.txt
56+
57+
- name: install checkers requirements
58+
run: pip install -r checkers/requirements.txt
59+
60+
- name: validate service ${{ matrix.service }}
61+
run: ./check.py validate
62+
env:
63+
SERVICE: ${{ matrix.service }}
64+
65+
- name: up service ${{ matrix.service }}
66+
run: ./check.py up
67+
env:
68+
SERVICE: ${{ matrix.service }}
69+
70+
- name: wait for service ${{ matrix.service }}
71+
run: sleep 30
72+
73+
- name: check service ${{ matrix.service }} small
74+
run: ./check.py check
75+
env:
76+
SERVICE: ${{ matrix.service }}
77+
RUNS: 10
78+
79+
- name: down service ${{ matrix.service }}
80+
run: ./check.py down
81+
env:
82+
SERVICE: ${{ matrix.service }}
83+
84+
- name: up service ${{ matrix.service }}
85+
run: ./check.py up
86+
env:
87+
SERVICE: ${{ matrix.service }}
88+
89+
- name: wait for service ${{ matrix.service }}
90+
run: sleep 30
91+
92+
- name: check service ${{ matrix.service }} big
93+
run: ./check.py check
94+
env:
95+
SERVICE: ${{ matrix.service }}
96+
RUNS: 100
97+
98+
- name: down service ${{ matrix.service }}
99+
run: ./check.py down
100+
env:
101+
SERVICE: ${{ matrix.service }}
102+
if: ${{ always() }}
103+
104+
- name: logs after failure
105+
run: ./check.py logs
106+
if: ${{ failure() }}
107+
108+
check-all-services:
109+
runs-on: ubuntu-latest
110+
111+
needs: check-single-service
112+
113+
steps:
114+
- uses: actions/checkout@v3
115+
116+
- uses: actions/setup-python@v4
117+
with:
118+
python-version: '3.11'
119+
cache: 'pip'
120+
cache-dependency-path: |
121+
requirements.txt
122+
checkers/requirements.txt
123+
124+
- name: install requirements
125+
run: pip install -r requirements.txt
126+
127+
- name: install checkers requirements
128+
run: pip install -r checkers/requirements.txt
129+
130+
- name: up all services
131+
run: ./check.py up
132+
env:
133+
SERVICE: all
134+
135+
- name: wait for services
136+
run: sleep 30
137+
138+
- name: check all services
139+
run: ./check.py check
140+
env:
141+
SERVICE: all
142+
RUNS: 50
143+
144+
- name: down all services
145+
run: ./check.py down
146+
env:
147+
SERVICE: all
148+
if: ${{ always() }}
149+
150+
- name: logs after failure
151+
run: ./check.py logs
152+
if: ${{ failure() }}

.gitignore

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
__pycache__/
2+
*.py[cod]
3+
*$py.class
4+
*.so
5+
.Python
6+
build/
7+
develop-eggs/
8+
dist/
9+
downloads/
10+
eggs/
11+
.eggs/
12+
lib/
13+
lib64/
14+
parts/
15+
sdist/
16+
var/
17+
wheels/
18+
pip-wheel-metadata/
19+
share/python-wheels/
20+
*.egg-info/
21+
.installed.cfg
22+
*.egg
23+
MANIFEST
24+
*.manifest
25+
*.spec
26+
pip-log.txt
27+
pip-delete-this-directory.txt
28+
htmlcov/
29+
.tox/
30+
.nox/
31+
.coverage
32+
.coverage.*
33+
.cache
34+
nosetests.xml
35+
coverage.xml
36+
*.cover
37+
*.py,cover
38+
.hypothesis/
39+
.pytest_cache/
40+
*.mo
41+
*.pot
42+
*.log
43+
local_settings.py
44+
db.sqlite3
45+
db.sqlite3-journal
46+
instance/
47+
.webassets-cache
48+
.scrapy
49+
docs/_build/
50+
target/
51+
.ipynb_checkpoints
52+
profile_default/
53+
ipython_config.py
54+
.python-version
55+
__pypackages__/
56+
celerybeat-schedule
57+
celerybeat.pid
58+
*.sage.py
59+
.env
60+
.venv
61+
env/
62+
venv/
63+
ENV/
64+
env.bak/
65+
venv.bak/
66+
.spyderproject
67+
.spyproject
68+
.ropeproject
69+
/site
70+
.mypy_cache/
71+
.dmypy.json
72+
dmypy.json
73+
.pyre/
74+
.DS_Store
75+
.vscode
76+
.idea
77+

LICENSE.txt

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2+
Version 2, December 2004
3+
4+
Copyright (C) 2004 Sam Hocevar <[email protected]>
5+
6+
Everyone is permitted to copy and distribute verbatim or modified
7+
copies of this license document, and changing it is allowed as long
8+
as the name is changed.
9+
10+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11+
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12+
13+
0. You just DO WHAT THE FUCK YOU WANT TO.

README.md

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# ad-boilerplate
2+
3+
[![check-services](https://github.com/C4T-BuT-S4D/ad-boilerplate/actions/workflows/check-services.yml/badge.svg?branch=master&event=push)](https://github.com/C4T-BuT-S4D/ad-boilerplate/actions/workflows/check-services.yml)
4+
5+
Development workflow:
6+
7+
1. Create branch named `$SERVICE`.
8+
2. Write your code in `services/$SERVICE`, `checkers/$SERVICE`, `sploits/$SERVICE` and `internal/$SERVICE` (if needed).
9+
3. Validate your service with `SERVICE=$SERVICE ./check.py validate`.
10+
4. Up your service with `SERVICE=$SERVICE ./check.py up`.
11+
5. Check your service with `SERVICE=$SERVICE RUNS=200 ./check.py check`.
12+
6. Down your service with `SERVICE=$SERVICE ./check.py down`.
13+
7. Push your code and create pull request to master branch.
14+
15+
Don't forget to:
16+
1. Add your checker requirements to `checkers/requirements.txt`.
17+
2. Use `dedcleaner` container to delete old files if needed. Example can be found in `services/example/docker-compose.yml`.
18+
3. Add info about your checker to `Checker` class. Example can be found in `checkers/example/checker.py`, line 11.

0 commit comments

Comments
 (0)