|
39 | 39 |
|
40 | 40 | # Run Notebook Tests |
41 | 41 | - 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 |
43 | 43 | env: |
44 | 44 | # to disable a warning in Jupyter notebooks |
45 | 45 | JUPYTER_PLATFORM_DIRS: "1" |
|
50 | 50 | # Passing environment information |
51 | 51 | CLASSIQ_IDE: "https://nightly.platform.classiq.io" |
52 | 52 | 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