Skip to content

Commit

Permalink
Report e2e test result to Discord
Browse files Browse the repository at this point in the history
  • Loading branch information
fwang committed Sep 1, 2023
1 parent 58b73b1 commit 60e510f
Showing 1 changed file with 48 additions and 5 deletions.
53 changes: 48 additions & 5 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: E2E Tests

on:
schedule:
- cron: '0 0 * * *'
- cron: "0 0 * * *"
push:
branches:
- main
Expand All @@ -11,6 +11,7 @@ env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
PLAYWRIGHT_BROWSERS_PATH: 0
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}

permissions:
id-token: write # This is required for requesting the JWT
Expand Down Expand Up @@ -48,7 +49,7 @@ jobs:
else
previous_version=""
fi
if [ "$latest_version" != "$previous_version" ]; then
echo "Versions are different. Continuing the pipeline."
else
Expand All @@ -61,14 +62,13 @@ jobs:
previousNextVersion: ${{ steps.get_latest_version.outputs.LATEST_VERSION }}
cacheKey: ${{ steps.cache-previous.outputs.cache-primary-key }}

# If the event is push (merged and pushed into main) or if
# If the event is push (merged and pushed into main) or if
# the latest Nextjs version hasn't been tested, run the Playwright tests
e2e:
needs: check_next_version
if: github.event_name == 'push' || needs.check_next_version.outputs.skip != 'true'
runs-on: ubuntu-latest
steps:

- name: Checkout code
uses: actions/checkout@v3

Expand Down Expand Up @@ -154,9 +154,52 @@ jobs:
- name: Store Latest Version
run: |
echo "${{ needs.check_next_version.outputs.previousNextVersion }}" > previous_version.txt
- name: Cache Previous Version
uses: actions/cache/save@v3
with:
path: previous_version.txt
key: ${{ needs.check_next_version.outputs.cacheKey }}

#############################
# Report status to Discord
#############################
- name: Report success
if: success()
run: |
curl -X POST "$DISCORD_WEBHOOK" \
-H "Content-Type: application/json" \
-d '{
"username": "OpenNext E2E Test",
"avatar_url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
"embeds": [
{
"description": "Test succeeded — [view results](https://github.com/${{ github.repository }}/actions/runs/${{github.run_id}})",
"color": 3061373,
"footer": {
"text": "Woah! So cool!",
"icon_url": "https://i.imgur.com/u2ENxCk.png"
}
}
]
}'
- name: Report failure
if: failure()
run: |
curl -X POST "$DISCORD_WEBHOOK" \
-H "Content-Type: application/json" \
-d '{
"username": "OpenNext E2E Test",
"avatar_url": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
"embeds": [
{
"description": "Test failed — [view results](https://github.com/${{ github.repository }}/actions/runs/${{github.run_id}})",
"color": 14687834,
"footer": {
"text": "Hmmm...",
"icon_url": "https://i.imgur.com/QeXzqIy.png"
}
}
]
}'

1 comment on commit 60e510f

@vercel
Copy link

@vercel vercel bot commented on 60e510f Sep 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

open-next – ./

open-next-sst-dev.vercel.app
open-next-git-main-sst-dev.vercel.app
open-next.vercel.app

Please sign in to comment.