.gitea/workflows/gradle-ci.yml aktualisiert
Some checks are pending
Gradle CI with MySQL and Jacoco / build (push) Has started running
Some checks are pending
Gradle CI with MySQL and Jacoco / build (push) Has started running
This commit is contained in:
@@ -1,35 +1,68 @@
|
|||||||
name: Gradle CI with Jacoco
|
name: Gradle CI with MySQL and Jacoco
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: [ main ]
|
||||||
- main
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches: [ main ]
|
||||||
- main
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
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:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up JDK 17
|
- name: Set up Java 17
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: 17
|
java-version: 17
|
||||||
cache: gradle
|
cache: gradle
|
||||||
|
|
||||||
- name: Cache Gradle Wrapper Distributions
|
- name: Cache Gradle Wrapper
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: ~/.gradle/wrapper/dists
|
path: ~/.gradle/wrapper/dists
|
||||||
key: gradle-wrapper-${{ runner.os }}-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties') }}
|
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
|
run: ./gradlew --no-daemon test jacocoTestReport
|
||||||
|
|
||||||
- name: Upload Jacoco HTML Report
|
- name: Upload Jacoco HTML Report
|
||||||
@@ -37,15 +70,3 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
name: jacoco-html-report
|
name: jacoco-html-report
|
||||||
path: build/jacocoHtml
|
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
|
|
||||||
|
|||||||
Reference in New Issue
Block a user