103 lines
3.1 KiB
YAML
103 lines
3.1 KiB
YAML
name: Gradle CI with Full Reports
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
# -----------------------
|
|
# 1. Checkout Repository
|
|
# -----------------------
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v3
|
|
|
|
# -----------------------
|
|
# 2. Set up Java 17
|
|
# -----------------------
|
|
- name: Set up Java 17
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
distribution: temurin
|
|
java-version: 17
|
|
cache: gradle
|
|
|
|
# -----------------------
|
|
# 3. Cache Gradle Wrapper
|
|
# -----------------------
|
|
- name: Cache Gradle Wrapper
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.gradle/wrapper/dists
|
|
key: gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
|
|
|
|
# -----------------------
|
|
# 4. Build & Test mit Logging
|
|
# -----------------------
|
|
- name: Build & Test with Jacoco
|
|
run: ./gradlew --daemon test jacocoTestReport --stacktrace --warning-mode all
|
|
|
|
# -----------------------
|
|
# 5. Build Error HTML aus Log erzeugen
|
|
# -----------------------
|
|
- name: Convert Build Log to HTML
|
|
run: |
|
|
mkdir -p build/reports/build-errors
|
|
echo "<html><body><pre>" > build/reports/build-errors/build-error-report.html
|
|
cat build/logs/build.log >> build/reports/build-errors/build-error-report.html
|
|
echo "</pre></body></html>" >> build/reports/build-errors/build-error-report.html
|
|
|
|
# -----------------------
|
|
# 6. Upload Test Report (HTML + XML) automatisch
|
|
# -----------------------
|
|
- name: Upload Test HTML Report
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: test-html-report
|
|
path: build/reports/tests/test
|
|
|
|
# -----------------------
|
|
# 7. Upload Jacoco Reports
|
|
# -----------------------
|
|
- name: Upload Jacoco HTML Report
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: jacoco-html-report
|
|
path: build/jacocoHtml
|
|
|
|
- name: Upload Jacoco XML Report
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: jacoco-xml-report
|
|
path: build/customJacocoReportDir/*.xml
|
|
|
|
- name: Upload Jacoco CSV Report
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: jacoco-csv-report
|
|
path: build/reports/jacoco/jacoco.csv
|
|
|
|
# -----------------------
|
|
# 8. Upload Problems Report
|
|
# -----------------------
|
|
- name: Upload Gradle Problems Report
|
|
if: always()
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: problems-report
|
|
path: build/reports/problems/problems-report.html
|
|
|
|
# -----------------------
|
|
# 9. Upload Build Error HTML Report
|
|
# -----------------------
|
|
- name: Upload Build Error HTML Report
|
|
if: always()
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: build-error-report
|
|
path: build/reports/build-errors/build-error-report.html |