-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (54 loc) · 2.29 KB
/
publish-test-results.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: "Test result summary"
on:
workflow_call:
inputs:
runs-on:
description: "The type of machine to run the job on e.g macOS-latest or ubuntu-latest"
required: true
type: string
junit-results-glob-pattern:
description: "Glob expression to junit report paths"
required: true
type: string
check-name:
description: "Check run name"
required: false
type: string
slack-notification:
description: "Enable slack push notification for test results"
default: false
required: false
type: boolean
secrets:
SLACK_BOT_TOKEN:
description: "Slack bot secret for push notification"
required: false
env:
TEST_RESULTS_PATH: "/tmp/test-results"
jobs:
tests:
runs-on: ${{ inputs.runs-on }}
steps:
- name: Download test artifacts
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
path: ${{ env.TEST_RESULTS_PATH }}
- name: Publish Test Report
id: test-report
uses: mikepenz/action-junit-report@0831a82caad2465c31c6dd929978f640cb42556c # v4.0.3
if: always()
continue-on-error: true
with:
fail_on_failure: true
annotate_only: true # it wont add a build check so we dont want the build to fail if smokes fail
report_paths: ${{ env.TEST_RESULTS_PATH }}/**/${{ inputs.junit-results-glob-pattern }}
- name: Notify slack of test results
uses: archive/github-actions-slack@d9dae40827adf93bddf939db6552d1e392259d7d # v2.7.0
id: slack
if: ${{ steps.test-report.outcome == 'failure' && github.ref == 'refs/heads/main' }}
with:
slack-bot-user-oauth-access-token: ${{ secrets.SLACK_BOT_TOKEN }}
slack-channel: C063ZPPJC5U # tmp-tolerant-failures
slack-text: |
:sad-parrot: The <https://github.com/weaveworks/weave-gitops-enterprise/commit/${{ github.sha }}|latest commit> from ${{ github.actor }} is failing on main. <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}|Click here> and weep. Then fix the underlying issue and ensure main remains green.
slack-optional-icon_url: "https://avatars.githubusercontent.com/u/9976052"