.gitea/workflows/gradle-ci.yml aktualisiert
Some checks are pending
Gradle CI with MySQL and Jacoco / build (push) Has started running

This commit is contained in:
Jan
2025-12-07 11:16:06 +01:00
parent 59d00796d7
commit fc67c11981

View File

@@ -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