Skip to content

Commit 7ad27dc

Browse files
committed
build: clean e2e tests
1 parent 42dfca1 commit 7ad27dc

1 file changed

Lines changed: 63 additions & 63 deletions

File tree

.github/workflows/ci.yml

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
fi
5252
id: coverage_report
5353
- if: always() && github.event_name == 'pull_request'
54-
uses: peter-evans/create-or-update-comment@v4
54+
uses: peter-evans/create-or-update-comment@v5
5555
with:
5656
issue-number: ${{ github.event.pull_request.number }}
5757
body: |
@@ -127,7 +127,7 @@ jobs:
127127
echo "EOF" >> $GITHUB_OUTPUT
128128
id: lighthouse_results
129129
- if: always() && github.event_name == 'pull_request'
130-
uses: peter-evans/create-or-update-comment@v4
130+
uses: peter-evans/create-or-update-comment@v5
131131
with:
132132
issue-number: ${{ github.event.pull_request.number }}
133133
body: ${{ steps.lighthouse_results.outputs.BODY }}
@@ -138,64 +138,64 @@ jobs:
138138
runs-on: ubuntu-latest
139139
timeout-minutes: 20
140140
steps:
141-
- uses: actions/checkout@v6
142-
- uses: cachix/install-nix-action@v31
143-
with:
144-
github_access_token: ${{ secrets.GITHUB_TOKEN }}
145-
extra_nix_config: |
146-
extra-substituters = https://cache.garnix.io
147-
extra-trusted-public-keys = cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=
148-
- uses: DeterminateSystems/magic-nix-cache-action@v13
149-
- name: Wait for Garnix web package
150-
uses: lewagon/wait-on-check-action@v1
151-
continue-on-error: true
152-
with:
153-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
154-
check-regexp: 'package pages.*'
155-
repo-token: ${{ secrets.GITHUB_TOKEN }}
156-
- name: Build and Serve
157-
run: ./scripts/web-test.sh
158-
- name: Run Maestro Web Tests
159-
run: |
160-
set -o pipefail
161-
nix develop -c maestro test --headless maestro/web |& tee maestro_console.log
162-
- name: Upload Maestro Screenshots to Cloudinary
163-
if: failure() && github.event_name == 'pull_request'
164-
id: upload_screenshots
165-
env:
166-
CLOUD_NAME: ${{ secrets.CLOUDINARY_CLOUD_NAME }}
167-
UPLOAD_PRESET: ${{ secrets.CLOUDINARY_UPLOAD_PRESET }}
168-
run: |
169-
REPORT_BODY="### ❌ Maestro Web E2E Failures\n"
170-
if [ -f maestro_console.log ]; then
171-
# Use sed to strip ANSI escape codes for cleaner markdown
172-
CLEAN_LOG=$(sed 's/\x1b\[[0-9;]*[mG]//g' maestro_console.log | tail -n 100)
173-
REPORT_BODY="${REPORT_BODY}\n<details>\n<summary>📜 Maestro Console Output (Last 100 lines)</summary>\n\n\`\`\`text\n${CLEAN_LOG}\n\`\`\`\n</details>\n"
174-
fi
175-
if [ -n "$CLOUD_NAME" ] && [ -n "$UPLOAD_PRESET" ]; then
176-
REPORT_BODY="${REPORT_BODY}\n#### 📸 Screenshots\n"
177-
find ~/.maestro/tests/ -name "*.png" | while read -r img; do
178-
echo "Uploading $img to Cloudinary (unsigned)..."
179-
UPLOAD_URL="https://api.cloudinary.com/v1_1/${CLOUD_NAME}/image/upload"
180-
RESULT=$(curl -s -X POST "$UPLOAD_URL" -F "file=@$img" -F "upload_preset=$UPLOAD_PRESET")
181-
IMG_URL=$(echo "$RESULT" | jq -r '.secure_url')
182-
if [ "$IMG_URL" != "null" ]; then
183-
REPORT_BODY="${REPORT_BODY}\n- ![Screenshot]($IMG_URL)"
184-
fi
185-
done
186-
fi
187-
echo "REPORT_BODY<<EOF" >> $GITHUB_OUTPUT
188-
echo -e "$REPORT_BODY" >> $GITHUB_OUTPUT
189-
echo "EOF" >> $GITHUB_OUTPUT
190-
- name: Post E2E Failure Comment
191-
if: failure() && github.event_name == 'pull_request' && steps.upload_screenshots.outputs.REPORT_BODY != ''
192-
uses: peter-evans/create-or-update-comment@v4
193-
with:
194-
issue-number: ${{ github.event.pull_request.number }}
195-
body: ${{ steps.upload_screenshots.outputs.REPORT_BODY }}
196-
- name: Upload Maestro Reports
197-
if: failure()
198-
uses: actions/upload-artifact@v7
199-
with:
200-
name: maestro-web-report
201-
path: ~/.maestro/tests/
141+
- uses: actions/checkout@v6
142+
- run: sleep 30 # Sleep hoping Garnix evaluation will start after
143+
- uses: lewagon/wait-on-check-action@v1
144+
with:
145+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
146+
check-regexp: 'Evaluate flake.nix'
147+
repo-token: ${{ secrets.GITHUB_TOKEN }}
148+
- uses: lewagon/wait-on-check-action@v1
149+
with:
150+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
151+
check-regexp: 'package pages.*'
152+
repo-token: ${{ secrets.GITHUB_TOKEN }}
153+
fail-on-no-checks: false
154+
- uses: cachix/install-nix-action@v31
155+
with:
156+
github_access_token: ${{ secrets.GITHUB_TOKEN }}
157+
extra_nix_config: |
158+
extra-substituters = https://cache.garnix.io
159+
extra-trusted-public-keys = cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=
160+
- uses: DeterminateSystems/magic-nix-cache-action@v13
161+
- run: ./scripts/web-test.sh # Build & Serve
162+
- run: |
163+
set -o pipefail
164+
nix develop -c maestro test --headless maestro/web |& tee maestro_console.log
165+
- if: failure() && github.event_name == 'pull_request'
166+
env:
167+
CLOUD_NAME: ${{ secrets.CLOUDINARY_CLOUD_NAME }}
168+
UPLOAD_PRESET: ${{ secrets.CLOUDINARY_UPLOAD_PRESET }}
169+
run: |
170+
REPORT_BODY="### ❌ Maestro Web E2E Failures\n"
171+
if [ -f maestro_console.log ]; then
172+
# Use sed to strip ANSI escape codes for cleaner markdown
173+
CLEAN_LOG=$(sed 's/\x1b\[[0-9;]*[mG]//g' maestro_console.log | tail -n 100)
174+
REPORT_BODY="${REPORT_BODY}\n<details>\n<summary>📜 Maestro Console Output (Last 100 lines)</summary>\n\n\`\`\`text\n${CLEAN_LOG}\n\`\`\`\n</details>\n"
175+
fi
176+
if [ -n "$CLOUD_NAME" ] && [ -n "$UPLOAD_PRESET" ]; then
177+
REPORT_BODY="${REPORT_BODY}\n#### 📸 Screenshots\n"
178+
find ~/.maestro/tests/ -name "*.png" | while read -r img; do
179+
echo "Uploading $img to Cloudinary (unsigned)..."
180+
UPLOAD_URL="https://api.cloudinary.com/v1_1/${CLOUD_NAME}/image/upload"
181+
RESULT=$(curl -s -X POST "$UPLOAD_URL" -F "file=@$img" -F "upload_preset=$UPLOAD_PRESET")
182+
IMG_URL=$(echo "$RESULT" | jq -r '.secure_url')
183+
if [ "$IMG_URL" != "null" ]; then
184+
REPORT_BODY="${REPORT_BODY}\n- ![Screenshot]($IMG_URL)"
185+
fi
186+
done
187+
fi
188+
echo "REPORT_BODY<<EOF" >> $GITHUB_OUTPUT
189+
echo -e "$REPORT_BODY" >> $GITHUB_OUTPUT
190+
echo "EOF" >> $GITHUB_OUTPUT
191+
id: upload_screenshots
192+
- if: failure() && github.event_name == 'pull_request' && steps.upload_screenshots.outputs.REPORT_BODY != ''
193+
uses: peter-evans/create-or-update-comment@v5
194+
with:
195+
issue-number: ${{ github.event.pull_request.number }}
196+
body: ${{ steps.upload_screenshots.outputs.REPORT_BODY }}
197+
- if: failure()
198+
uses: actions/upload-artifact@v7
199+
with:
200+
name: maestro-web-report
201+
path: ~/.maestro/tests/

0 commit comments

Comments
 (0)