|
51 | 51 | CLASSIQ_IDE: "https://nightly.platform.classiq.io" |
52 | 52 | CLASSIQ_HOST: "https://nightly.platform.classiq.io" |
53 | 53 |
|
54 | | - - name: Print failing tests |
| 54 | + - name: Send Qmods Slack notification |
55 | 55 | if: failure() |
56 | | - run: | |
57 | | - if [ -z "$(find ./pytest-results -name "*.xml")" ]; then |
58 | | - # Don't do anything if we don't have any results |
59 | | - exit 0 |
60 | | - fi |
61 | | - { |
62 | | - echo "# Failing tests" |
63 | | - echo "| Test | Message |" |
64 | | - echo "| ---- | ------- |" |
65 | | - yq -o json -I 0 -p xml ' |
66 | | - .testsuites[].testcase[] | select(.failure // .error) | |
67 | | - select((.failure // .error)["+@message"] | test("^((AssertionError: Qmod file)|(AssertionError: Found uncommitted Qmod)).*")) | |
68 | | - { |
69 | | - "name": (.["+@classname"] + "::" + .["+@name"]), |
70 | | - "message": (.failure // .error)["+@message"] |
71 | | - } |
72 | | - ' ./pytest-results/*.xml | \ |
73 | | - jq -r -s ' |
74 | | - sort_by(.name) | .[] | |
75 | | - "| " + .name + " | " + (.message | @html | split("\n") | .[0]) + " |" |
76 | | - ' |
77 | | - }>>"$GITHUB_STEP_SUMMARY" |
78 | | - echo FAILING_TESTS=$( |
79 | | - yq -o json -I 0 -p xml ' |
80 | | - .testsuites[].testcase[] | select(.failure // .error) | |
81 | | - select((.failure // .error)["+@message"] | test("^((AssertionError: Qmod file)|(AssertionError: Found uncommitted Qmod)).*")) | |
82 | | - { |
83 | | - "name": (.["+@classname"] + "::" + .["+@name"]), |
84 | | - "message": (.failure // .error)["+@message"] |
85 | | - } |
86 | | - ' ./pytest-results/*.xml | \ |
87 | | - jq -r -s ' |
88 | | - sort_by(.name) | .[] | |
89 | | - "• " + .name + ": " + (.message | @html | split("\n") | .[0]) + "\n" |
90 | | - ' |
91 | | - ) >> $GITHUB_ENV |
92 | | -
|
93 | | - - name: Send JSON to slack workflow |
94 | | - id: slack |
95 | | - if: failure() |
96 | | - uses: slackapi/slack-github-action@v2.1 |
| 56 | + uses: ./.github/actions/send_qmods_slack_notification |
97 | 57 | with: |
98 | | - method: chat.postMessage |
99 | | - token: ${{ secrets.SLACK_BOT_TOKEN }} |
100 | | - payload: | |
101 | | - { |
102 | | - "channel": "ci-notebooks-alerts", |
103 | | - "blocks": [ |
104 | | - { |
105 | | - "type": "header", |
106 | | - "text": { |
107 | | - "type": "plain_text", |
108 | | - "text": "Notification - Classiq library tests failed on branch ${{ github.ref_name }}", |
109 | | - "emoji": true |
110 | | - } |
111 | | - }, |
112 | | - { |
113 | | - "type": "section", |
114 | | - "text": { |
115 | | - "type": "mrkdwn", |
116 | | - "text": "Some Classiq library demos failed.\n*Make sure to take a look*" |
117 | | - } |
118 | | - }, |
119 | | - { |
120 | | - "type": "section", |
121 | | - "text": { |
122 | | - "type": "mrkdwn", |
123 | | - "text": "${{ env.FAILING_TESTS }}" |
124 | | - } |
125 | | - }, |
126 | | - { |
127 | | - "type": "section", |
128 | | - "text": { |
129 | | - "type": "mrkdwn", |
130 | | - "text": "<https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|Failed action URL>" |
131 | | - } |
132 | | - } |
133 | | - ] |
134 | | - } |
| 58 | + pytest-output: ./pytest-results/test-results-applications.xml |
0 commit comments