-
Notifications
You must be signed in to change notification settings - Fork 5
83 lines (72 loc) · 2.23 KB
/
codspeed.yml
File metadata and controls
83 lines (72 loc) · 2.23 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
name: CodSpeed
on:
push:
branches:
- "main"
- "master"
pull_request:
workflow_dispatch:
permissions:
contents: read
id-token: write
jobs:
benchmarks:
name: Run benchmarks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Start infrastructure
run: |
docker compose -f docker-compose-test.yml up -d
- name: Wait for MySQL
run: |
for i in $(seq 1 30); do
if docker compose -f docker-compose-test.yml exec -T mysql_tests mysqladmin ping -h localhost -ucqrs -pcqrs --silent 2>/dev/null; then
echo "MySQL is ready"
exit 0
fi
echo "Waiting for MySQL... ($i/30)"
sleep 2
done
echo "MySQL did not become ready in time"
exit 1
- name: Wait for PostgreSQL
run: |
for i in $(seq 1 30); do
if docker compose -f docker-compose-test.yml exec -T postgres_tests pg_isready -h localhost -U cqrs -q 2>/dev/null; then
echo "PostgreSQL is ready"
exit 0
fi
echo "Waiting for PostgreSQL... ($i/30)"
sleep 2
done
echo "PostgreSQL did not become ready in time"
exit 1
- name: Wait for Redis
run: |
for i in $(seq 1 15); do
if docker compose -f docker-compose-test.yml exec -T redis_tests redis-cli ping 2>/dev/null | grep -q PONG; then
echo "Redis is ready"
exit 0
fi
echo "Waiting for Redis... ($i/15)"
sleep 1
done
echo "Redis did not become ready in time"
exit 1
- name: Run benchmarks
uses: CodSpeedHQ/action@v4
with:
mode: simulation
run: pytest -c ./tests/pytest-config.ini tests/benchmarks/ --codspeed
- name: Stop infrastructure
if: always()
run: docker compose -f docker-compose-test.yml down -v