-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path.gitlab-ci.yml
38 lines (34 loc) · 1.06 KB
/
.gitlab-ci.yml
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
image: python:3.9
cache:
paths:
- .cache/pip
- .coverage
before_script:
- pip install --cache-dir .cache/pip -r requirements.txt
stages:
- test
test-job:
stage: test
script:
- FASTAPI_ENV=test python3 -m coverage run -m uvicorn src.main:app &
- curl -Lo mapi $MAYHEM_URL/cli/mapi/linux-musl/latest/mapi && chmod +x mapi
- ./mapi login $MAPI_TOKEN
- ./mapi run forallsecure-demo/mapi-action-examples/fastapi auto "http://localhost:8000/openapi.json" --url "http://localhost:8000/" --junit junit.xml --sarif mapi.sarif --html mapi.html
- pgrep python3 | xargs kill || true; sleep 1
- python3 -m coverage report
- python3 -m coverage xml
- python3 -m coverage html -d coverage_html_report
coverage: '/TOTAL.*\s+(\d+\%)$/' # regex to extract coverage percentage
artifacts:
when: always
paths:
- junit.xml
- mapi.html
- mapi.sarif
- coverage.xml
- coverage_html_report/
reports:
junit: junit.xml
coverage_report:
coverage_format: cobertura
path: coverage.xml