Update .gitea/workflows/test.yml
This commit is contained in:
+26
-26
@@ -192,18 +192,16 @@ jobs:
|
||||
run: |
|
||||
short_sha=$(git rev-parse --short HEAD)
|
||||
commit_msg=$(git log -1 --pretty=%B)
|
||||
commit_num=$(echo "$commit_msg" | grep -oE '#[0-9]+' | head -n1 || echo "")
|
||||
|
||||
echo "🔍 Commit SHA: $short_sha"
|
||||
echo "🔍 Commit message: $commit_msg"
|
||||
echo "🔍 Commit PR #: $commit_num"
|
||||
|
||||
echo "short_sha=$short_sha" >> $GITHUB_OUTPUT
|
||||
echo "commit_num=$commit_num" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Clone Gitea Wiki
|
||||
run: |
|
||||
echo "📚 Cloning wiki repo"
|
||||
echo "📚 Cloning wiki repo: https://gitea.psi.ch/tligui_y/slic.wiki.git"
|
||||
git clone https://ci-token:${{ secrets.CI_TOKEN }}@gitea.psi.ch/tligui_y/slic.wiki.git wiki > wiki_clone.log 2>&1 || {
|
||||
echo "❌ Wiki clone failed"
|
||||
cat wiki_clone.log | grep -i 'error\|fatal'
|
||||
@@ -211,7 +209,7 @@ jobs:
|
||||
}
|
||||
echo "✅ Wiki cloned to ./wiki"
|
||||
|
||||
- name: Create and copy reports into wiki
|
||||
- name: Copy reports into wiki
|
||||
run: |
|
||||
echo "📝 Creating wiki markdown files..."
|
||||
|
||||
@@ -222,43 +220,45 @@ jobs:
|
||||
|
||||
SAFE_TITLE=$(echo "$COMMIT_MSG" | tr ' /\\:*?"<>|' '-' | tr -cd '[:alnum:] -' | sed 's/ */ /g' | sed 's/ *$//')
|
||||
|
||||
TEST_MD_PATH="wiki/run-${GITHUB_RUN_NUMBER}-TEST-REPORT-commit-${SHORT_SHA}-message-${SAFE_TITLE}.md"
|
||||
COVERAGE_MD_PATH="wiki/run-${GITHUB_RUN_NUMBER}-COVERAGE-REPORT-commit-${SHORT_SHA}-message-${SAFE_TITLE}.md"
|
||||
TEST_MD_PATH="wiki/run-${GITHUB_RUN_NUMBER}-TEST-REPORT----commit:-${SHORT_SHA}--with-message:-${SAFE_TITLE}.md"
|
||||
COVERAGE_MD_PATH="wiki/run-${GITHUB_RUN_NUMBER}-COVERAGE-FILE----commit:-${SHORT_SHA}--with-message:-${SAFE_TITLE}.md"
|
||||
|
||||
echo "🕒 Source TEST-REPORT.md last modified:"
|
||||
stat ci-reports/markdown/TEST-REPORT.md
|
||||
echo "🔍 Source TEST-REPORT.md preview:"
|
||||
head -n 10 ci-reports/markdown/TEST-REPORT.md
|
||||
echo "📄 Wiki files will be:"
|
||||
echo " - $TEST_MD_PATH"
|
||||
echo " - $COVERAGE_MD_PATH"
|
||||
|
||||
cp -f ci-reports/markdown/TEST-REPORT.md "$TEST_MD_PATH"
|
||||
cp -f ci-reports/markdown/coverage-summary.md "$COVERAGE_MD_PATH"
|
||||
{
|
||||
echo "**🔗 View CI run logs for commit \`${SHORT_SHA}\` - run [#${GITHUB_RUN_NUMBER}](${RUN_LINK})**"
|
||||
echo "**📝 Commit:** \`$COMMIT_MSG\`"
|
||||
echo ""
|
||||
cat ci-reports/markdown/TEST-REPORT.md
|
||||
} > "$TEST_MD_PATH"
|
||||
|
||||
touch "$TEST_MD_PATH" "$COVERAGE_MD_PATH"
|
||||
|
||||
echo "🕒 Wiki TEST-REPORT.md last modified:"
|
||||
stat "$TEST_MD_PATH"
|
||||
echo "🔍 Wiki TEST-REPORT.md preview:"
|
||||
head -n 10 "$TEST_MD_PATH"
|
||||
{
|
||||
echo "**🔗 View CI run logs for commit \`${SHORT_SHA}\` - run [#${GITHUB_RUN_NUMBER}](${RUN_LINK})**"
|
||||
echo "**📝 Commit:** \`$COMMIT_MSG\`"
|
||||
echo ""
|
||||
cat ci-reports/markdown/coverage-summary.md
|
||||
} > "$COVERAGE_MD_PATH"
|
||||
|
||||
echo "✅ Wiki files created:"
|
||||
echo " - $TEST_MD_PATH"
|
||||
echo " - $COVERAGE_MD_PATH"
|
||||
|
||||
|
||||
|
||||
- name: Commit and push to wiki
|
||||
run: |
|
||||
echo "📤 Preparing to commit and push wiki reports..."
|
||||
echo "📤 Committing and pushing wiki reports..."
|
||||
cd wiki
|
||||
git config user.name "ci-bot"
|
||||
git config user.email "ci-bot@example.com"
|
||||
|
||||
git status
|
||||
|
||||
git add "$TEST_MD_PATH" "$COVERAGE_MD_PATH"
|
||||
git add .
|
||||
|
||||
COMMIT_MSG="Add wiki reports for ${{ steps.info.outputs.short_sha }} ${{ steps.info.outputs.commit_num }}"
|
||||
git commit -m "$COMMIT_MSG" || echo "⚠️ Nothing to commit"
|
||||
|
||||
echo "🚀 Pushing wiki to https://gitea.psi.ch/tligui_y/slic.wiki.git"
|
||||
echo "🚀 Pushing to wiki: https://gitea.psi.ch/tligui_y/slic.wiki.git"
|
||||
git push https://ci-token:${{ secrets.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'
|
||||
@@ -266,8 +266,8 @@ jobs:
|
||||
}
|
||||
|
||||
echo "✅ Wiki reports pushed"
|
||||
echo "🔗 Wiki URLs:"
|
||||
echo "🔗 View in Wiki:"
|
||||
echo " - $REPO_URL/wiki/${TEST_MD_PATH#wiki/}"
|
||||
echo " - $REPO_URL/wiki/${COVERAGE_MD_PATH#wiki/}"
|
||||
env:
|
||||
CI_TOKEN: ${{ secrets.CI_TOKEN }}
|
||||
CI_TOKEN: ${{ secrets.CI_TOKEN }}
|
||||
Reference in New Issue
Block a user