fix: failed test notification #37
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: test-workflow | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ main, master ] | |
pull_request: | |
branches: [ main, master ] | |
jobs: | |
job-1: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Run Step 1 | |
run: | | |
echo "Running Step 1" | |
sleep 30 | |
job-2: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Run Step 2 | |
run: | | |
echo "Running Step 2" | |
sleep 30 | |
e2e-test-1: | |
container: | |
image: mcr.microsoft.com/playwright:v1.50.0-noble | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
- run: npm ci | |
- run: npx playwright test example-1 | |
- name: Save and Upload Artifacts for Slack Notification | |
uses: ./.github/actions/upload-artifacts | |
if: ${{ !cancelled() }} | |
with: | |
job_name: ${{ github.job }} | |
junit_path: 'test-results/junit.xml' | |
report_url: 'http://www.yahoo.com' # replace with link to hosted report url | |
e2e-test-2: | |
container: | |
image: mcr.microsoft.com/playwright:v1.50.0-noble | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
- run: npm ci | |
- run: npx playwright test example-2 | |
- name: Save and Upload Artifacts for Slack Notification | |
uses: ./.github/actions/upload-artifacts | |
if: ${{ !cancelled() }} | |
with: | |
job_name: ${{ github.job }} | |
junit_path: 'test-results/junit.xml' | |
report_url: 'http://www.google.com' # replace with link to hosted report url | |
slack-notify-always: | |
if: always() | |
needs: [job-1, job-2, e2e-test-1, e2e-test-2] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Send Slack Notification | |
uses: midleman/slack-workflow-status@mi/fix-failed # for testing changes, use branch instead of version # | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
slack_token: ${{ secrets.SLACK_TOKEN }} | |
notify_on: "always" | |
channel: "U07KNKY6S5C" | |
# comment_junit_failures: "true" | |
# comment_junit_flakes: "true" | |
slack-notify-never: | |
if: always() | |
needs: [job-1, job-2, e2e-test-1, e2e-test-2] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Send Slack Notification | |
uses: midleman/slack-workflow-status@mi/fix-failed # for testing changes, use branch instead of version # | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
slack_token: ${{ secrets.SLACK_TOKEN }} | |
notify_on: "never" | |
channel: "U07KNKY6S5C" | |
slack-notify-failure: | |
if: always() | |
needs: [job-1, job-2, e2e-test-1, e2e-test-2] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Send Slack Notification | |
uses: midleman/slack-workflow-status@mi/fix-failed # for testing changes, use branch instead of version # | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
slack_token: ${{ secrets.SLACK_TOKEN }} | |
notify_on: "failure" | |
channel: "U07KNKY6S5C" | |