SlackNotifications #58
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Playwright Github Actions | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install node js v20 | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "20" | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Chrome browser for Playwright | |
run: npx playwright install chrome | |
- name: Run tests | |
run: npm run test:serial | |
env: | |
npm_config_ENV: "qa" | |
- name: Wait for job completion | |
run: sleep 30s | |
if: always() | |
- name: Zip HTML report | |
run: zip -r html-report.zip html-report | |
if: always() | |
- name: Upload HTML report as artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: html-report | |
path: html-report.zip | |
- name: Send Slack notification with artifact link | |
uses: "https://github.com/marketplace/actions/slack-action" | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} | |
with: | |
args: | | |
{"text": "Playwright tests have completed successfully. HTML report is attached as an artifact. You can download it [here](${{ github.server_url }}/${{ github.repository }}/actions/artifacts/html-report)"} |