f
This commit is contained in:
@@ -30,7 +30,7 @@ jobs:
|
|||||||
run: dotnet build --no-restore --verbosity normal
|
run: dotnet build --no-restore --verbosity normal
|
||||||
|
|
||||||
- name: Run unit tests
|
- name: Run unit tests
|
||||||
run: dotnet test --no-build --verbosity normal --logger "trx;LogFileName=test-results.trx" --results-directory ./TestResults
|
run: dotnet test --no-build --verbosity minimal --logger "trx;LogFileName=test-results.trx" --results-directory ./TestResults --collect:"XPlat Code Coverage" --settings coverlet.runsettings
|
||||||
|
|
||||||
- name: Generate test report
|
- name: Generate test report
|
||||||
if: always()
|
if: always()
|
||||||
@@ -40,49 +40,85 @@ jobs:
|
|||||||
echo "File sizes:"
|
echo "File sizes:"
|
||||||
find ./TestResults -name "*.trx" -exec ls -lh {} \;
|
find ./TestResults -name "*.trx" -exec ls -lh {} \;
|
||||||
|
|
||||||
- name: Prepare test results for upload
|
- name: Compress test results
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
if [ -d "./TestResults" ] && [ "$(ls -A ./TestResults)" ]; then
|
if [ -d "./TestResults" ] && [ "$(ls -A ./TestResults)" ]; then
|
||||||
echo "Preparing test results for upload..."
|
echo "Compressing test results to reduce upload size..."
|
||||||
echo "Original file sizes:"
|
echo "Original file sizes:"
|
||||||
find ./TestResults -type f -exec ls -lh {} \;
|
find ./TestResults -type f -exec ls -lh {} \;
|
||||||
echo "Total directory size:"
|
echo "Total directory size:"
|
||||||
du -sh ./TestResults
|
du -sh ./TestResults
|
||||||
|
|
||||||
|
# Create compressed archive
|
||||||
|
tar -czf test-results-compressed.tar.gz -C ./TestResults .
|
||||||
|
echo "Compressed file size:"
|
||||||
|
ls -lh test-results-compressed.tar.gz
|
||||||
|
|
||||||
|
# Create a minimal summary file
|
||||||
|
echo "Test Results Summary" > test-summary.txt
|
||||||
|
echo "===================" >> test-summary.txt
|
||||||
|
echo "Generated: $(date)" >> test-summary.txt
|
||||||
|
echo "Files:" >> test-summary.txt
|
||||||
|
find ./TestResults -type f -exec basename {} \; >> test-summary.txt
|
||||||
|
echo "Summary file created:"
|
||||||
|
ls -lh test-summary.txt
|
||||||
else
|
else
|
||||||
echo "No test results found to upload"
|
echo "No test results found to compress"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Upload test results (attempt 1)
|
- name: Upload compressed test results (attempt 1)
|
||||||
id: upload1
|
id: upload1
|
||||||
if: always()
|
if: always()
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
with:
|
with:
|
||||||
name: test-results
|
name: test-results-compressed
|
||||||
path: ./TestResults/
|
path: |
|
||||||
|
./test-results-compressed.tar.gz
|
||||||
|
./test-summary.txt
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
if-no-files-found: warn
|
if-no-files-found: warn
|
||||||
|
|
||||||
- name: Upload test results (attempt 2)
|
- name: Upload original test results (attempt 2)
|
||||||
id: upload2
|
id: upload2
|
||||||
if: always() && failure()
|
if: always() && failure()
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
with:
|
with:
|
||||||
name: test-results-retry
|
name: test-results-original
|
||||||
path: ./TestResults/
|
path: ./TestResults/
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
if-no-files-found: warn
|
if-no-files-found: warn
|
||||||
|
|
||||||
|
- name: Upload summary only (attempt 3)
|
||||||
|
id: upload3
|
||||||
|
if: always() && failure()
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
continue-on-error: true
|
||||||
|
with:
|
||||||
|
name: test-results-summary
|
||||||
|
path: ./test-summary.txt
|
||||||
|
retention-days: 30
|
||||||
|
if-no-files-found: warn
|
||||||
|
|
||||||
- name: Check upload status
|
- name: Check upload status
|
||||||
if: always()
|
if: always()
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ steps.upload1.outcome }}" == "success" ] || [ "${{ steps.upload2.outcome }}" == "success" ]; then
|
if [ "${{ steps.upload1.outcome }}" == "success" ]; then
|
||||||
echo "✅ Test results uploaded successfully"
|
echo "✅ Compressed test results uploaded successfully"
|
||||||
|
elif [ "${{ steps.upload2.outcome }}" == "success" ]; then
|
||||||
|
echo "✅ Original test results uploaded successfully"
|
||||||
|
elif [ "${{ steps.upload3.outcome }}" == "success" ]; then
|
||||||
|
echo "✅ Test summary uploaded successfully (full results failed)"
|
||||||
else
|
else
|
||||||
echo "❌ Failed to upload test results after 2 attempts"
|
echo "❌ Failed to upload test results after 3 attempts"
|
||||||
echo "This may be due to network issues or Gitea server problems"
|
echo "This may be due to persistent network issues or Gitea server problems"
|
||||||
exit 1
|
echo "Consider checking:"
|
||||||
|
echo " - Gitea server status"
|
||||||
|
echo " - Network connectivity"
|
||||||
|
echo " - Artifact storage configuration"
|
||||||
|
# Don't fail the workflow - tests passed, just upload failed
|
||||||
|
echo "⚠️ Workflow will continue despite upload failure"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user