-
-
Notifications
You must be signed in to change notification settings - Fork 250
87 lines (70 loc) · 3.09 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
82
83
84
85
86
87
name: AppFlowy-Cloud Stress Test
on: [ pull_request, push ]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
POSTGRES_HOST: localhost
REDIS_HOST: localhost
POSTGRES_PASSWORD: password
SQLX_OFFLINE: true
RUST_TOOLCHAIN: "1.78"
jobs:
test:
name: Collab Stress Tests
runs-on: self-hosted-appflowy3
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Install Rust Toolchain
uses: dtolnay/rust-toolchain@stable
- name: Cache Rust Dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: "AppFlowy-Cloud"
- name: Copy and Rename deploy.env to .env
run: cp deploy.env .env
- name: Replace Values in .env
run: |
sed -i '' 's|RUST_LOG=.*|RUST_LOG=trace|' .env
#Gotrue config:
sed -i '' 's|GOTRUE_SMTP_USER=.*|GOTRUE_SMTP_USER=${{ secrets.CI_GOTRUE_SMTP_USER }}|' .env
sed -i '' 's|GOTRUE_SMTP_PASS=.*|GOTRUE_SMTP_PASS=${{ secrets.CI_GOTRUE_SMTP_PASS }}|' .env
sed -i '' 's|GOTRUE_SMTP_ADMIN_EMAIL=.*|GOTRUE_SMTP_ADMIN_EMAIL=${{ secrets.CI_GOTRUE_SMTP_ADMIN_EMAIL }}|' .env
sed -i '' 's|GOTRUE_EXTERNAL_GOOGLE_ENABLED=.*|GOTRUE_EXTERNAL_GOOGLE_ENABLED=true|' .env
sed -i '' 's|GOTRUE_MAILER_AUTOCONFIRM=.*|GOTRUE_MAILER_AUTOCONFIRM=true|' .env
sed -i '' 's|GOTRUE_DATABASE_URL=.*|GOTRUE_DATABASE_URL=postgres://supabase_auth_admin:root@postgres:5432/postgres|' .env
sed -i '' 's|GOTRUE_RATE_LIMIT_EMAIL_SENT=.*|GOTRUE_RATE_LIMIT_EMAIL_SENT=1000|' .env
sed -i '' 's|APPFLOWY_GOTRUE_BASE_URL=.*|APPFLOWY_GOTRUE_BASE_URL=http://localhost:9999|' .env
# s3
sed -i '' 's|APPFLOWY_S3_MINIO_URL=.*|APPFLOWY_S3_MINIO_URL=http://localhost:9000|' .env
sed -i '' 's|API_EXTERNAL_URL=.*|API_EXTERNAL_URL=http://localhost:9999|' .env
sed -i '' 's|POSTGRES_PASSWORD=.*|POSTGRES_PASSWORD=password|' .env
sed -i '' 's|APPFLOWY_MAILER_SMTP_USERNAME=.*|APPFLOWY_MAILER_SMTP_USERNAME=${{ secrets.CI_GOTRUE_SMTP_USER }}|' .env
sed -i '' 's|APPFLOWY_MAILER_SMTP_PASSWORD=.*|APPFLOWY_MAILER_SMTP_PASSWORD=${{ secrets.CI_GOTRUE_SMTP_PASS }}|' .env
cat .env
shell: bash
- name: Start Docker Compose Services
run: |
docker compose -f docker-compose-stress-test.yml up -d
docker ps -a
- name: Install Prerequisites
run: |
brew install protobuf
- name: Run Server
run: |
nohup cargo run --package xtask > server.log 2>&1 &
echo "Server is running in the background."
- name: Run Stress Tests
run: |
RUST_LOG="info" DISABLE_CI_TEST_LOG="true" cargo test stress_test
- name: Stop Server (Cleanup)
if: always()
run: |
pkill -f "cargo run --package xtask" || true
echo "Server stopped."
- name: Display Server Logs
if: always()
run: |
echo "Server logs:"
cat server.log