-
Notifications
You must be signed in to change notification settings - Fork 1
81 lines (76 loc) · 2.77 KB
/
stress-test.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
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
name: Run stress tests manually via the GitHub Actions UI
on:
workflow_dispatch:
permissions:
id-token: write
contents: read
env:
AWS_ROLE: arn:aws:iam::724664234782:role/Striveworks-Role-github_runner_npe
AWS_REGION: us-east-1
jobs:
integration-stress-tests:
env:
COVERAGE_FILE: .coverage.integration-stress-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: build postgres
run: |
docker build ./database -t pgvalor
- name: setup back end test env
run: docker compose -p valor -f docker-compose.yml -f docker-compose.cicd-override.yml --env-file ./api/.env.testing up --build -d
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: install api
run: pip install -e ".[test]"
working-directory: ./api
- name: install client
run: pip install -e ".[test]"
working-directory: ./client
- run: coverage run --source="api/valor_api,client/valor" -m pytest -v integration_tests/stress_test.py
- run: coverage report
- name: upload coverage report as artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.COVERAGE_FILE }}
path: ${{ env.COVERAGE_FILE }}
- run: make stop-env
- run: docker compose -p valor -f docker-compose.yml -f docker-compose.cicd-override.yml --env-file ./api/.env.testing up --build -d
env:
VALOR_SECRET_KEY: ${{ vars.SECRET_KEY }}
VALOR_USERNAME: ${{ vars.USERNAME }}
VALOR_PASSWORD: ${{ vars.PASSWORD }}
- name: sleep to give back end time to spin up
run: sleep 15
combine-coverage-report:
needs: [integration-stress-tests]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- run: pip install coverage
- uses: actions/download-artifact@v3
with:
name: .coverage.integration-stress-tests
- run: coverage combine
- run: coverage report
# https://nedbatchelder.com/blog/202209/making_a_coverage_badge.html
- run: |
coverage json
export TOTAL=$(python -c "import json;print(json.load(open('coverage.json'))['totals']['percent_covered_display'])")
echo "total=$TOTAL" >> $GITHUB_ENV
- name: "Make badge"
if: github.ref == 'refs/heads/main'
uses: schneegans/dynamic-badges-action@v1.4.0
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: 501428c92df8d0de6805f40fb78b1363
filename: valor-coverage.json
label: Coverage
message: ${{ env.total }}%
minColorRange: 50
maxColorRange: 90
valColorRange: ${{ env.total }}