diff --git a/.gitea/workflows/gradle-ci.yml b/.gitea/workflows/gradle-ci.yml index 6083fc0..77709b1 100644 --- a/.gitea/workflows/gradle-ci.yml +++ b/.gitea/workflows/gradle-ci.yml @@ -1,68 +1,35 @@ -name: Gradle CI with MySQL and Jacoco +name: Gradle CI with Jacoco on: push: - branches: [ main ] + branches: + - main pull_request: - branches: [ main ] + branches: + - main jobs: build: runs-on: ubuntu-latest - services: - mysql: - image: mysql:8.0 - env: - MYSQL_ROOT_PASSWORD: root - MYSQL_DATABASE: hhn - MYSQL_USER: hhn - MYSQL_PASSWORD: "!9oSmhsiwYO.m)_x" - ports: - - 3306:3306 - options: >- - --health-cmd="mysqladmin ping -h localhost -uroot -proot" - --health-interval=10s - --health-timeout=5s - --health-retries=10 - steps: - - name: Checkout repository + - name: Checkout Repository uses: actions/checkout@v3 - - name: Set up Java 17 + - name: Set up JDK 17 uses: actions/setup-java@v3 with: distribution: temurin java-version: 17 cache: gradle - - name: Cache Gradle Wrapper + - name: Cache Gradle Wrapper Distributions uses: actions/cache@v3 with: path: ~/.gradle/wrapper/dists key: gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - - name: Wait for MySQL to be ready - run: | - for i in `seq 1 30`; do - if mysqladmin ping -h 127.0.0.1 -u root -proot --silent; then - echo "MySQL is up!" - exit 0 - fi - echo "Waiting for MySQL..." - sleep 2 - done - echo "MySQL did not start in time" >&2 - exit 1 - - - name: Install MySQL client - run: sudo apt-get update && sudo apt-get install -y mysql-client - - - name: Setup DB schema - run: mysql -h 127.0.0.1 -u root -proot hhn < schema.sql - - - name: Build & Test + - name: Build & Test with Jacoco run: ./gradlew --no-daemon test jacocoTestReport - name: Upload Jacoco HTML Report @@ -70,3 +37,15 @@ jobs: 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