test: save pytest warning reports to GHA artifacts

- add pytest_hooks import back in common/lib/conftest.py. This import was removed during refactoring work
This commit is contained in:
Soban Javed
2021-12-07 17:44:52 +05:00
parent cf64f0e198
commit b4ac8d284a
3 changed files with 48 additions and 1 deletions

View File

@@ -63,3 +63,47 @@ jobs:
- name: run tests
run: |
python -Wd -m pytest -p no:randomly --ds=${{ env.settings_path }} ${{ env.unit_test_paths }}
- name: rename warnings json file
if: success()
run: |
cd test_root/log
mv pytest_warnings.json pytest_warnings_${{ matrix.shard_name }}.json
- name: save pytest warnings json file
if: success()
uses: actions/upload-artifact@v2
with:
name: pytest-warnings-json
path: |
test_root/log/pytest_warnings*.json
compile-warnings-report:
runs-on: [ self-hosted ]
needs: [ run-tests ]
steps:
- name: sync directory owner
run: sudo chown runner:runner -R .*
- uses: actions/checkout@v2
- name: collect pytest warnings files
uses: actions/download-artifact@v2
with:
name: pytest-warnings-json
path: test_root/log
- name: display structure of downloaded files
run: ls -la test_root/log
- name: compile warnings report
run: |
python openedx/core/process_warnings.py --dir-path test_root/log --html-path reports/pytest_warnings/warning_report_all.html
- name: save warning report
if: success()
uses: actions/upload-artifact@v2
with:
name: pytest-warning-report-html
path: |
reports/pytest_warnings/warning_report_all.html