Skip to content

Commit 2d7786d

Browse files
!
1 parent ec824c8 commit 2d7786d

File tree

1 file changed

+67
-3
lines changed

1 file changed

+67
-3
lines changed

.github/workflows/Test-CI-daily-notebooks-applications.yml

Lines changed: 67 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
4040
# Run Notebook Tests
4141
- name: Run Notebooks
42-
run: python -m pytest --durations=0 tests/notebooks
42+
run: python -m pytest --durations=0 --junitxml=pytest-results/test-results-applications.xml tests/notebooks
4343
env:
4444
# to disable a warning in Jupyter notebooks
4545
JUPYTER_PLATFORM_DIRS: "1"
@@ -50,5 +50,69 @@ jobs:
5050
# Passing environment information
5151
CLASSIQ_IDE: "https://nightly.platform.classiq.io"
5252
CLASSIQ_HOST: "https://nightly.platform.classiq.io"
53-
# Altering test behavior
54-
QMOD_COMPARISON_FIRST: "true"
53+
54+
- name: Print failing tests
55+
run: |
56+
if [ -z "$(find ./pytest-results -name "*.xml")" ]; then
57+
# Don't do anything if we don't have any results
58+
exit 0
59+
fi
60+
{
61+
echo "# Failing tests"
62+
echo "| Test | Message |"
63+
echo "| ---- | ------- |"
64+
yq -o json -I 0 -p xml '
65+
.testsuites[].testcase[] | select(.failure // .error) |
66+
select((.failure // .error)["+@message"] | test("^((AssertionError: Qmod file)|(AssertionError: Found uncommitted Qmod)).*")) |
67+
{
68+
"name": (.["+@classname"] + "::" + .["+@name"]),
69+
"message": (.failure // .error)["+@message"]
70+
}
71+
' ./pytest-results/*.xml | \
72+
jq -r -s '
73+
sort_by(.name) | .[] |
74+
"| " + .name + " | " + (.message | @html | split("\n") | .[0]) + " |"
75+
'
76+
}>>"$GITHUB_STEP_SUMMARY"
77+
78+
- name: Send JSON to slack workflow
79+
id: slack
80+
uses: slackapi/slack-github-action@v2.1
81+
with:
82+
method: chat.postMessage
83+
token: ${{ secrets.SLACK_BOT_TOKEN }}
84+
payload: |
85+
{
86+
"channel": "ci-notebooks-alerts",
87+
"blocks": [
88+
{
89+
"type": "header",
90+
"text": {
91+
"type": "plain_text",
92+
"text": "Notification - Classiq library tests failed on branch ${{ github.ref_name }}",
93+
"emoji": true
94+
}
95+
},
96+
{
97+
"type": "section",
98+
"text": {
99+
"type": "mrkdwn",
100+
"text": "Some Classiq library demos failed.\n*Make sure to take a look*"
101+
}
102+
},
103+
{
104+
"type": "section",
105+
"text": {
106+
"type": "mrkdwn",
107+
"text": $GITHUB_STEP_SUMMARY
108+
}
109+
},
110+
{
111+
"type": "section",
112+
"text": {
113+
"type": "mrkdwn",
114+
"text": "<https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|Failed action URL>"
115+
}
116+
}
117+
]
118+
}

0 commit comments

Comments
 (0)