diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 1ba51aa..7ba0aab 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -9,6 +9,9 @@ jobs:
tests:
name: "Unit and E2E Tests"
runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@v4
@@ -42,6 +45,71 @@ jobs:
docker compose logs
exit 1
+ - name: Collect Docker stats
+ if: github.event_name == 'pull_request'
+ continue-on-error: true
+ id: docker-stats
+ run: |
+ # Get image size
+ IMAGE_SIZE=$(docker images appwrite/browser:local --format "{{.Size}}")
+
+ # Get container stats
+ CONTAINER_ID=$(docker compose ps -q appwrite-browser)
+ MEMORY_USAGE=$(docker stats $CONTAINER_ID --no-stream --format "{{.MemUsage}}" | cut -d'/' -f1 | xargs)
+
+ # Quick screenshot benchmark (3 runs, average)
+ TOTAL=0
+ for i in {1..3}; do
+ START=$(date +%s%3N)
+ curl -s -X POST http://localhost:3000/v1/screenshots \
+ -H "Content-Type: application/json" \
+ -d '{"url":"https://appwrite.io"}' \
+ -o /dev/null
+ END=$(date +%s%3N)
+ DURATION=$((END - START))
+ TOTAL=$((TOTAL + DURATION))
+ done
+ SCREENSHOT_AVG_MS=$((TOTAL / 3))
+ SCREENSHOT_AVG=$(echo "scale=2; $SCREENSHOT_AVG_MS / 1000" | bc)
+
+ # Measure fresh startup time
+ START_TIME=$(date +%s%3N)
+ docker compose restart appwrite-browser
+ for i in {1..30}; do
+ if curl -f http://localhost:3000/v1/health > /dev/null 2>&1; then
+ END_TIME=$(date +%s%3N)
+ STARTUP_TIME_MS=$((END_TIME - START_TIME))
+ break
+ fi
+ sleep 0.1
+ done
+ STARTUP_TIME=$(echo "scale=2; $STARTUP_TIME_MS / 1000" | bc)
+
+ # Store in GitHub output
+ echo "image_size=$IMAGE_SIZE" >> $GITHUB_OUTPUT
+ echo "memory_usage=$MEMORY_USAGE" >> $GITHUB_OUTPUT
+ echo "startup_time=$STARTUP_TIME" >> $GITHUB_OUTPUT
+ echo "screenshot_time=$SCREENSHOT_AVG" >> $GITHUB_OUTPUT
+
+ - name: Comment PR with stats
+ if: github.event_name == 'pull_request' && steps.docker-stats.outcome == 'success'
+ continue-on-error: true
+ uses: marocchino/sticky-pull-request-comment@v2
+ with:
+ header: docker-image-stats
+ skip_unchanged: true
+ message: |
+ ## Docker Image Stats
+
+ | Metric | Value |
+ |--------|-------|
+ | Image Size | ${{ steps.docker-stats.outputs.image_size }} |
+ | Memory Usage | ${{ steps.docker-stats.outputs.memory_usage }} |
+ | Startup Time | ${{ steps.docker-stats.outputs.startup_time }}s |
+ | Screenshot Time | ${{ steps.docker-stats.outputs.screenshot_time }}s |
+
+ Screenshot benchmark: Average of 3 runs on https://appwrite.io
+
- name: Run e2e tests
run: bun test:e2e
diff --git a/src/utils/clean-modules.ts b/src/utils/clean-modules.ts
index 36e14e2..76b14d5 100644
--- a/src/utils/clean-modules.ts
+++ b/src/utils/clean-modules.ts
@@ -170,6 +170,7 @@ async function removeUnnecessaryFiles(): Promise {
);
await deletePath(`${NODE_MODULES}/@sentry`);
await deletePath(`${NODE_MODULES}/@opentelemetry`);
+ await deletePath(`${NODE_MODULES}/axe-core/axe.js`);
await deletePath(`${NODE_MODULES}/lighthouse/cli`);
await deletePath(`${NODE_MODULES}/lighthouse/build-tracker.config.js`);
await deletePath(`${NODE_MODULES}/lighthouse/commitlint.config.js`);