From fc67c11981bd10dcbc55735f70e108ee59754918 Mon Sep 17 00:00:00 2001 From: Jan Date: Sun, 7 Dec 2025 11:16:06 +0100 Subject: [PATCH] .gitea/workflows/gradle-ci.yml aktualisiert --- .gitea/workflows/gradle-ci.yml | 63 ++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 21 deletions(-) diff --git a/.gitea/workflows/gradle-ci.yml b/.gitea/workflows/gradle-ci.yml index 77709b1..6083fc0 100644 --- a/.gitea/workflows/gradle-ci.yml +++ b/.gitea/workflows/gradle-ci.yml @@ -1,35 +1,68 @@ -name: Gradle CI with Jacoco +name: Gradle CI with MySQL and 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 JDK 17 + - name: Set up Java 17 uses: actions/setup-java@v3 with: distribution: temurin java-version: 17 cache: gradle - - name: Cache Gradle Wrapper Distributions + - name: Cache Gradle Wrapper uses: actions/cache@v3 with: path: ~/.gradle/wrapper/dists key: gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }} - - name: Build & Test with Jacoco + - 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 run: ./gradlew --no-daemon test jacocoTestReport - name: Upload Jacoco HTML Report @@ -37,15 +70,3 @@ 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