Revert "Streamline test report packaging and uploading in test.yml: archive reports, handle missing directories, and upload to Gitea packages."
Auto Publish on Version Change / check-and-publish (push) Successful in 13s
Run Tests on Push and Pull Request / run-tests (push) Successful in 18s

This reverts commit 0d8ee099a0.
This commit is contained in:
CodingPhoenixx
2026-05-28 13:59:41 +02:00
parent 0d8ee099a0
commit f00a1098b4
+7 -50
View File
@@ -30,58 +30,15 @@ jobs:
cd "$GITHUB_WORKSPACE"
./gradlew test --no-daemon --stacktrace
- name: Package and upload test reports
- name: Upload test reports
if: always()
run: |
cd "$GITHUB_WORKSPACE"
if [ ! -d "build/reports/tests/test" ] && [ ! -d "build/test-results/test" ]; then
echo "No test reports produced, skipping upload."
exit 0
if [ -d "build/reports/tests/test" ]; then
echo "Test reports available in build/reports/tests/test"
ls -la build/reports/tests/test || true
fi
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
ARCHIVE="test-reports-${SHORT_SHA}.tar.gz"
tar -czf "$ARCHIVE" \
$( [ -d build/reports/tests/test ] && echo build/reports/tests/test ) \
$( [ -d build/test-results/test ] && echo build/test-results/test )
echo "Archive size: $(du -h "$ARCHIVE" | cut -f1)"
SERVER_URL="${{ github.server_url }}"
OWNER="${{ github.repository_owner }}"
PKG_NAME="nexusweb-test-reports"
VERSION="run-${{ github.run_number }}-${SHORT_SHA}"
UPLOAD_URL="${SERVER_URL}/api/packages/${OWNER}/generic/${PKG_NAME}/${VERSION}/${ARCHIVE}"
echo "Uploading to: ${UPLOAD_URL}"
# Delete any previous package with the same version (e.g. job re-run on same commit),
# ignore failures (404 if it does not exist yet).
curl -s -o /dev/null -w "Delete previous (if any): HTTP %{http_code}\n" \
-X DELETE \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"${UPLOAD_URL}" || true
HTTP_STATUS=$(curl -s -o /tmp/upload-response.txt -w "%{http_code}" \
-X PUT \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
--data-binary @"${ARCHIVE}" \
"${UPLOAD_URL}")
if [ "$HTTP_STATUS" = "201" ] || [ "$HTTP_STATUS" = "200" ] || [ "$HTTP_STATUS" = "204" ]; then
echo "Upload successful (HTTP ${HTTP_STATUS})"
echo ""
echo "Test reports available at:"
echo " ${SERVER_URL}/${OWNER}/-/packages/generic/${PKG_NAME}/${VERSION}"
echo ""
echo "Or via API:"
echo " ${UPLOAD_URL}"
else
echo "Upload failed (HTTP ${HTTP_STATUS})"
cat /tmp/upload-response.txt || true
echo ""
echo "Test reports still present locally in build/reports/tests/test/index.html"
# Do not fail the workflow over the report upload.
if [ -d "build/test-results/test" ]; then
echo "Test result XMLs:"
ls -la build/test-results/test || true
fi