Skip to content

Commit 0580dac

Browse files
committed
fix: startup time.
1 parent e51309c commit 0580dac

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

.github/workflows/test.yml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,16 @@ jobs:
3131
run: docker compose up -d
3232

3333
- name: Wait for container to be ready
34+
id: container-startup
3435
run: |
36+
START_TIME=$(date +%s%3N)
3537
for i in {1..30}; do
3638
if curl -f http://localhost:3000/v1/health > /dev/null 2>&1; then
37-
echo "Container is ready!"
39+
END_TIME=$(date +%s%3N)
40+
STARTUP_TIME_MS=$((END_TIME - START_TIME))
41+
STARTUP_TIME=$(echo "scale=2; $STARTUP_TIME_MS / 1000" | bc)
42+
echo "startup_time=$STARTUP_TIME" >> $GITHUB_OUTPUT
43+
echo "Container is ready in ${STARTUP_TIME}s!"
3844
exit 0
3945
fi
4046
echo "Waiting for container... ($i/30)"
@@ -72,23 +78,9 @@ jobs:
7278
SCREENSHOT_AVG_MS=$((TOTAL / 3))
7379
SCREENSHOT_AVG=$(echo "scale=2; $SCREENSHOT_AVG_MS / 1000" | bc)
7480
75-
# Measure fresh startup time
76-
START_TIME=$(date +%s%3N)
77-
docker compose restart appwrite-browser
78-
for i in {1..30}; do
79-
if curl -f http://localhost:3000/v1/health > /dev/null 2>&1; then
80-
END_TIME=$(date +%s%3N)
81-
STARTUP_TIME_MS=$((END_TIME - START_TIME))
82-
break
83-
fi
84-
sleep 0.1
85-
done
86-
STARTUP_TIME=$(echo "scale=2; $STARTUP_TIME_MS / 1000" | bc)
87-
8881
# Store in GitHub output
8982
echo "image_size=$IMAGE_SIZE" >> $GITHUB_OUTPUT
9083
echo "memory_usage=$MEMORY_USAGE" >> $GITHUB_OUTPUT
91-
echo "startup_time=$STARTUP_TIME" >> $GITHUB_OUTPUT
9284
echo "screenshot_time=$SCREENSHOT_AVG" >> $GITHUB_OUTPUT
9385
9486
- name: Comment PR with stats
@@ -105,7 +97,7 @@ jobs:
10597
|--------|-------|
10698
| Image Size | ${{ steps.docker-stats.outputs.image_size }} |
10799
| Memory Usage | ${{ steps.docker-stats.outputs.memory_usage }} |
108-
| Startup Time | ${{ steps.docker-stats.outputs.startup_time }}s |
100+
| Cold Start Time | ${{ steps.container-startup.outputs.startup_time }}s |
109101
| Screenshot Time | ${{ steps.docker-stats.outputs.screenshot_time }}s |
110102
111103
<sub>Screenshot benchmark: Average of 3 runs on https://appwrite.io</sub>

0 commit comments

Comments
 (0)