diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index 5787a4fa2..059adf136 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -176,115 +176,63 @@ jobs: - name: Copy reports into wiki run: | - echo "📝 Creating wiki markdown files..." - + echo "📝 Creating wiki content..." + REPO_URL="https://gitea.psi.ch/tligui_y/slic" RUN_LINK="${REPO_URL}/actions/runs/${GITHUB_RUN_NUMBER}" SHORT_SHA=$(git rev-parse --short HEAD) - COMMIT_MSG=$(git log -1 --pretty=%s | tr -d '\n' | cut -c1-80) - # Simplifier les noms de fichiers (enlever les caractères spéciaux) - TEST_MD_FILE="run-${GITHUB_RUN_NUMBER}-TEST-REPORT-commit-${SHORT_SHA}.md" - COVERAGE_MD_FILE="run-${GITHUB_RUN_NUMBER}-COVERAGE-FILE-commit-${SHORT_SHA}.md" - - echo "📄 Wiki files will be:" - echo " - $TEST_MD_FILE" - echo " - $COVERAGE_MD_FILE" + TEST_MD_FILE="run-${GITHUB_RUN_NUMBER}-TEST-REPORT-${SHORT_SHA}.md" + COVERAGE_MD_FILE="run-${GITHUB_RUN_NUMBER}-COVERAGE-${SHORT_SHA}.md" { - echo "**🔗 View CI run logs [#${GITHUB_RUN_NUMBER}](${RUN_LINK})**" - echo "** Commit:** [\`${SHORT_SHA}\`](${REPO_URL}/commit/${SHORT_SHA})" + echo "## Test Report #${GITHUB_RUN_NUMBER}" + echo "[View CI run](${RUN_LINK}) | [Commit ${SHORT_SHA}](${REPO_URL}/commit/${SHORT_SHA})" echo "" cat ci-reports/markdown/TEST-REPORT.md } > "wiki/${TEST_MD_FILE}" { - echo "**🔗 View CI run logs [#${GITHUB_RUN_NUMBER}](${RUN_LINK})**" - echo "** Commit:** [\`${SHORT_SHA}\`](${REPO_URL}/commit/${SHORT_SHA})" + echo "## Coverage Report #${GITHUB_RUN_NUMBER}" + echo "[View CI run](${RUN_LINK}) | [Commit ${SHORT_SHA}](${REPO_URL}/commit/${SHORT_SHA})" echo "" cat ci-reports/markdown/coverage-summary.md } > "wiki/${COVERAGE_MD_FILE}" - echo "✅ Wiki files created:" - echo " - $TEST_MD_FILE" - echo " - $COVERAGE_MD_FILE" + HOME_FILE="wiki/Home.md" + { + echo "# Test Reports History" + echo "" + echo "## Latest Run" + echo "- [TEST_MD_FILE]" + echo "- [COVERAGE_MD_FILE]" + echo "" + echo "## Previous Runs" + [ -f "$HOME_FILE" ] && grep -A100 "## Previous Runs" "$HOME_FILE" || echo "No previous runs" + } > "${HOME_FILE}.tmp" && mv "${HOME_FILE}.tmp" "$HOME_FILE" - - name: Commit and push to wiki + echo "✅ Wiki content generated:" + ls -la wiki/ + + - name: Commit and push wiki env: CI_TOKEN: ${{ secrets.CI_TOKEN }} run: | - echo "📤 Committing and pushing wiki reports..." + echo "🚀 Pushing wiki changes..." cd wiki + git config user.name "ci-bot" git config user.email "ci-bot@example.com" - - HOME_FILE="Home.md" - SHORT_SHA=$(git rev-parse --short HEAD) - - # Utiliser les mêmes noms que dans l'étape précédente - TEST_MD_FILE="run-${GITHUB_RUN_NUMBER}-TEST-REPORT-commit-${SHORT_SHA}.md" - COVERAGE_MD_FILE="run-${GITHUB_RUN_NUMBER}-COVERAGE-FILE-commit-${SHORT_SHA}.md" - - # Les liens doivent utiliser le nom exact du fichier - TEST_LINK="* [Test Report #${GITHUB_RUN_NUMBER} (${SHORT_SHA})](${TEST_MD_FILE})" - COVERAGE_LINK="* [Coverage Report #${GITHUB_RUN_NUMBER} (${SHORT_SHA})](${COVERAGE_MD_FILE})" - - TMP_FILE=".Home.tmp" - - if [ ! -f "$HOME_FILE" ]; then - echo "Home.md does not exist. Creating new file." - echo "# 📘 Summary of Test Runs" > "$HOME_FILE" - echo "" >> "$HOME_FILE" + + git add . + + if git commit -m "Update wiki with run ${GITHUB_RUN_NUMBER}"; then + git push https://ci-token:${CI_TOKEN}@gitea.psi.ch/tligui_y/slic.wiki.git HEAD:main + echo "✅ Wiki updated successfully" else - echo "Home.md exists. Reading current contents." + echo "No changes to commit" fi - echo "Prepending new report links to Home.md..." - - { - echo "$TEST_LINK" - echo "$COVERAGE_LINK" - echo "" - cat "$HOME_FILE" - } > "$TMP_FILE" - - if [ $? -ne 0 ]; then - echo "❌ Error writing to temporary Home.md" - exit 1 - fi - - mv "$TMP_FILE" "$HOME_FILE" - - if [ $? -eq 0 ]; then - echo "✅ Home.md updated successfully." - echo "New content:" - cat "$HOME_FILE" - else - echo "❌ Failed to update Home.md" - exit 1 - fi - - echo "Git status before adding files:" - git status - - git add "$HOME_FILE" - git add "$TEST_MD_FILE" "$COVERAGE_MD_FILE" - - echo "Git status after adding files:" - git status - - COMMIT_MSG="Add wiki reports for run ${GITHUB_RUN_NUMBER} (${SHORT_SHA})" - git commit -m "$COMMIT_MSG" || echo "⚠️ Nothing to commit" - - echo "🚀 Pushing to wiki: https://gitea.psi.ch/tligui_y/slic.wiki.git" - git push https://ci-token:${CI_TOKEN}@gitea.psi.ch/tligui_y/slic.wiki.git HEAD:main > push_wiki.log 2>&1 || { - echo "❌ Push to wiki failed" - cat push_wiki.log | grep -i 'error\|fatal\|refused' - exit 1 - } - - echo "✅ Wiki reports pushed" - - name: Log wiki report URLs run: | REPO_URL="https://gitea.psi.ch/tligui_y/slic"