Skip to content

Commit

Permalink
OZ-365: Publish GitHub Actions report for E2E tests status to Slack. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
kdaud authored Oct 19, 2023
1 parent 1b44dfa commit 0fc4951
Showing 1 changed file with 102 additions and 1 deletion.
103 changes: 102 additions & 1 deletion .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ on:

workflow_dispatch:
jobs:
build:
testOnPR:
if: ${{ github.event_name == 'pull_request' }}
timeout-minutes: 45
runs-on: ubuntu-latest
steps:
- name: Checkout repo
Expand Down Expand Up @@ -44,3 +46,102 @@ jobs:
name: playwright-report
path: playwright-report/
retention-days: 30

testOnPush:
if: ${{ github.event_name == 'push' }}
timeout-minutes: 45
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16

- name: Cache dependencies
id: cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}

- name: Install dependencies
run: yarn install

- name: Install Playwright Browsers
run: npx playwright install chromium --with-deps

- name: Run E2E tests
id: jobStatusPretty
run: |
npm run e2eTests
if [[ ${{ job.status }} == "success" ]]; then
jobStatusPretty="✅ Passing"
else
jobStatusPretty="❌ Failing"
fi
echo "jobStatusPretty=$jobStatusPretty" >> "$GITHUB_ENV"
- name: Notify Slack
id: slack
uses: slackapi/[email protected]
with:
payload: |
{
"blocks": [
{
"type": "rich_text",
"elements": [
{
"type": "rich_text_section",
"elements": [
{
"type": "text",
"text": "GitHub Actions report from "
},
{
"type": "link",
"url": "https://github.com/ozone-his/ozone-e2e-pro",
"text": "${{ github.repository }}",
"style": {
"bold": false
}
},
{
"type": "text",
"text": ":\n"
}
]
},
{
"type": "rich_text_quote",
"elements": [
{
"type": "link",
"url": "https://ozone-dev.mekomsolutions.net",
"text": "Ozone Dev"
},
{
"type": "text",
"text": " server QA status: ${{ env.jobStatusPretty }}"
}
]
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

- name: Upload Report
uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30

0 comments on commit 0fc4951

Please sign in to comment.