Update .gitea/workflows/test.yml
Run Pytest with Allure and Coverage Reports / tests (push) Successful in 40s

This commit is contained in:
2025-07-15 14:09:44 +02:00
parent affc29c5bb
commit fee3d5e76b
+17 -15
View File
@@ -28,13 +28,16 @@ jobs:
cat pixi.log | grep -i 'error\|fatal'
exit 1
}
echo "$HOME/.pixi/bin" >> $GITHUB_PATH
export PATH="$HOME/.pixi/bin:$PATH"
pixi install > pixi-install.log 2>&1 || {
echo "❌ Pixi project dependencies failed"
cat pixi-install.log | grep -i 'error\|fatal'
exit 1
}
echo "✅ Pixi installed"
pixi list
@@ -43,16 +46,19 @@ jobs:
echo "🐍 Setting up Python environment..."
python -m venv venv
source venv/bin/activate
pip install -U pip > pip.log 2>&1 || {
echo "❌ pip upgrade failed"
cat pip.log | grep -i 'error\|fatal'
exit 1
}
pip install pytest pytest-cov coverage pytest-html pytest-json-report pytest-md-report > pip.log 2>&1 || {
pip install pytest pytest-cov coverage pytest-md-report > pip.log 2>&1 || {
echo "❌ Python testing tools install failed"
cat pip.log | grep -i 'error\|fatal'
exit 1
}
echo "✅ Python tools installed"
pip list
@@ -75,6 +81,7 @@ jobs:
cat allure.log | grep -i 'error\|fatal'
exit 1
}
sudo mv allure-2.27.0 /opt/allure
sudo ln -s /opt/allure/bin/allure /usr/local/bin/allure
echo "✅ Allure installed"
@@ -92,26 +99,20 @@ jobs:
--cov=functions \
--cov-report=xml:ci-reports/coverage/coverage.xml \
--cov-report=html:ci-reports/coverage/ \
--junitxml=ci-reports/markdown/pytest-junit.xml \
--result-log=ci-reports/markdown/pytest-result.log \
--alluredir=allure-results \
--json-report \
--json-report-file=ci-reports/markdown/pytest-report.json \
--html=ci-reports/markdown/pytest-report.html \
--alluredir=allure-results \
--capture=no > ci-reports/markdown/raw-test-output.log 2>&1 && {
echo "✅ Pytest completed"
echo ""
echo "📄 Markdown: ci-reports/markdown/test-report.md"
echo "📦 JSON: ci-reports/markdown/pytest-report.json"
echo "📝 JUnit XML: ci-reports/markdown/pytest-junit.xml"
echo "📝 Raw Log: ci-reports/markdown/pytest-result.log"
echo "🌐 HTML Coverage: ci-reports/coverage/index.html"
echo "📄 XML Coverage: ci-reports/coverage/coverage.xml"
echo "🌐 Pytest HTML: ci-reports/markdown/pytest-report.html"
echo ""
echo "📦 JSON: ci-reports/markdown/pytest.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 ""
@@ -146,11 +147,12 @@ jobs:
- name: Commit and push reports
run: |
echo "📤 Committing ALL generated reports to slic.git..."
echo "📤 Committing test & coverage reports to slic.git..."
git config user.name "ci-bot"
git config user.email "ci-bot@example.com"
git add ci-reports/
git commit -m "CI: update all test and coverage reports" || echo "⚠️ Nothing to commit"
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"
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 || {
echo "❌ Push to main repo failed"
@@ -159,4 +161,4 @@ jobs:
}
echo "✅ Reports pushed to https://gitea.psi.ch/tligui_y/slic/ci-reports/"
env:
CI_TOKEN: ${{ secrets.CI_TOKEN }}
CI_TOKEN: ${{ secrets.CI_TOKEN }}