Repository navigation
93 lines (79 loc) · 2.9 KB
/
Copy pathperformance-tests.yml
File metadata and controls
93 lines (79 loc) · 2.9 KB
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
name: Performance Tests
on:
workflow_call:
env:
# Pull and tag images straight from Docker Hub, never through registry.defectdojo.com:
# the images CI built itself are tagged defectdojo/... (= docker.io/defectdojo/...), and CI
# pulls must not count as installs.
DD_IMAGE_REGISTRY: docker.io
jobs:
performance-tests:
name: Performance Tests
runs-on: ubuntu-latest
needs: []
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set-platform
run: |
echo "PLATFORM=linux-amd64" >> $GITHUB_ENV
- name: Load images from artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: built-docker-image
pattern: built-docker-image-django-debian-linux-amd64
merge-multiple: true
- name: Load docker images
timeout-minutes: 10
run: |
docker load -i built-docker-image/django-debian-linux-amd64_img
docker images
- name: Set unit-test mode
run: docker/setEnv.sh unit_tests_cicd
- name: Start Postgres and webhook.endpoint
timeout-minutes: 10
# image pulls from Docker Hub time out every so often, so retry before failing the job
run: |
RETRY=0
until docker compose up --no-deps -d postgres webhook.endpoint
do
if [[ $RETRY -gt 2 ]]; then
echo "ERROR: could not start Postgres and webhook.endpoint after $RETRY retries"
exit 1
fi
RETRY=$((RETRY+1))
echo "Attempt $RETRY to start Postgres and webhook.endpoint"
sleep 15
done
- name: Start uwsgi (idle)
timeout-minutes: 5
run: |
docker compose -f docker-compose.yml -f docker-compose.override.unit_tests_cicd.yml \
-f docker/docker-compose.override.performance_tests_cicd.yml \
up -d --no-deps uwsgi
env:
DJANGO_VERSION: debian
- name: Run performance tests (auto-update counts)
timeout-minutes: 15
run: python3 scripts/update_performance_test_counts.py
- name: Check counts are up to date
run: |
if ! git diff --quiet unittests/test_importers_performance.py; then
echo "Performance test counts are out of date. Fix them by running locally:"
echo ""
echo " python3 scripts/update_performance_test_counts.py"
echo ""
echo "Diff:"
git diff unittests/test_importers_performance.py
exit 1
else
echo "Performance test counts are up to date."
fi
- name: Logs
if: failure()
run: docker compose logs --tail="2500" uwsgi
- name: Shutdown
if: always()
run: docker compose down