diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index af66dabc0..cdb5cd3ff 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -1,4 +1,4 @@ -name: Run Pytest with Allure and Coverage Reports +name: Run Pytest with HTML and XML Test Reports on: push: @@ -53,7 +53,7 @@ jobs: exit 1 } - pip install pytest pytest-cov coverage pytest-md-report > pip.log 2>&1 || { + pip install pytest pytest-cov pytest-html pytest-md-report > pip.log 2>&1 || { echo "โŒ Python testing tools install failed" cat pip.log | grep -i 'error\|fatal' exit 1 @@ -66,58 +66,47 @@ jobs: run: | echo "๐Ÿš€ Running tests and generating reports..." source venv/bin/activate - mkdir -p ci-reports/{coverage,markdown} + mkdir -p ci-reports/{markdown,html,xml} - echo "๐Ÿงช Running pytest with coverage and report generation..." + echo "๐Ÿงช Running pytest with HTML, XML, and JSON report generation..." pixi run pytest . \ --continue-on-collection-errors \ - --cov=functions \ - --cov-report=xml:ci-reports/coverage/coverage.xml \ - --cov-report=html:ci-reports/coverage/ \ --json-report \ --json-report-file=ci-reports/markdown/pytest-report.json \ + --html=ci-reports/html/pytest-report.html \ + --junitxml=ci-reports/xml/pytest-report.xml \ --capture=no > ci-reports/markdown/raw-test-output.log 2>&1 && { echo "โœ… Pytest completed" echo "" echo "๐Ÿ“„ Markdown: ci-reports/markdown/test-report.md" - echo "" - echo "๐Ÿ“ฆ JSON: ci-reports/markdown/pytest.json" + echo "๐Ÿ“„ HTML: ci-reports/html/pytest-report.html" + echo "๐Ÿ“„ XML: ci-reports/xml/pytest-report.xml" + echo "๐Ÿ“ฆ JSON: ci-reports/markdown/pytest-report.json" } || { echo "" echo "โš ๏ธ Some tests failed" awk '/=+ short test summary info =+/,/=+.* in .*s =+/' ci-reports/markdown/raw-test-output.log || true - #cat ci-reports/markdown/raw-test-output.log } echo "" - echo "๐Ÿ“ˆ Generating coverage summary..." - coverage report --format=markdown > ci-reports/markdown/coverage-summary.md && { - echo "โœ… Coverage summary generated" + echo "๐Ÿ“Š Generating tests markdown summary..." + python json_to_md.py \ + --input ci-reports/markdown/pytest-report.json \ + --output ci-reports/markdown/TEST-REPORT.md \ + --log ci-reports/markdown/raw-test-output.log \ + --json ci-reports/markdown/pytest-report.json && { + echo "โœ… Tests markdown generated" } || { - echo "โš ๏ธ Coverage generation failed" - } - - { - echo "" - echo "๐Ÿ“Š Generating tests markdown summary..." - python json_to_md.py \ - --input ci-reports/markdown/pytest-report.json \ - --output ci-reports/markdown/TEST-REPORT.md \ - --log ci-reports/markdown/raw-test-output.log \ - --json ci-reports/markdown/pytest-report.json - - echo "โœ… Tests markdown generated" - } || { - echo "โš ๏ธ Tests markdown generation failed" + echo "โš ๏ธ Tests markdown generation failed" } - name: Commit and push reports run: | - echo "๐Ÿ“ค Committing test & coverage reports to slic.git..." + echo "๐Ÿ“ค Committing all test reports to slic.git..." git config user.name "ci-bot" git config user.email "ci-bot@example.com" - git add ci-reports/markdown/TEST-REPORT.md ci-reports/markdown/pytest-report.json ci-reports/markdown/coverage-summary.md - git commit -m "CI: update test and coverage reports" || echo "โš ๏ธ Nothing to commit" + git add ci-reports/ + git commit -m "CI: update all test reports (HTML, XML, JSON, MD)" || echo "โš ๏ธ Nothing to commit" echo "๐Ÿš€ Pushing to branch 'testing_json' on slic.git..." git push https://ci-token:${{ secrets.CI_TOKEN }}@gitea.psi.ch/tligui_y/slic.git HEAD:testing_json > push_main.log 2>&1 || { @@ -127,4 +116,4 @@ jobs: } echo "โœ… Reports pushed to https://gitea.psi.ch/tligui_y/slic/ci-reports/" env: - CI_TOKEN: ${{ secrets.CI_TOKEN }} \ No newline at end of file + CI_TOKEN: ${{ secrets.CI_TOKEN }}