Skip to content

Commit

Permalink
Update deployment step to include testing and validate output differe…
Browse files Browse the repository at this point in the history
…nces
  • Loading branch information
YOUSIKI committed Jan 18, 2025
1 parent d54bd51 commit 2d5c7e8
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
sarif_file: /tmp/lint.sarif
wait-for-processing: true
deploy:
name: Deploy to Cloudflare Workers
name: Deploy to Cloudflare Workers and test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand Down Expand Up @@ -107,5 +107,14 @@ jobs:
run: echo "DEPLOYED_URL=$(echo $CMD_OUTPUT | grep -o 'https://[^ ]*')" >> $GITHUB_ENV
- name: Test the deployed version
run: |
curl -s -I $DEPLOYED_URL/ | grep -q "200 OK" && \
curl -s -I $DEPLOYED_URL/images/favicon.ico | grep -q "200 OK"
curl -s $DEPLOYED_URL > /tmp/deployed.html
curl -s https://mikanani.me > /tmp/expected.html
total_lines=$(wc -l < /tmp/expected.html)
diff_lines=$(diff /tmp/expected.html /tmp/deployed.html | grep -c "^[<>]")
diff_percentage=$(echo "scale=2; $diff_lines * 100 / $total_lines" | bc)
if (( $(echo "$diff_percentage > 5" | bc -l) )); then
echo "Difference is too large: $diff_percentage%"
exit 1
else
echo "Difference is acceptable: $diff_percentage%"
fi

0 comments on commit 2d5c7e8

Please sign in to comment.