Plan/.github/workflows/gradle.yml
2021-07-24 14:04:48 +03:00

64 lines
1.7 KiB
YAML

name: Java CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:latest
ports:
- 3306
env:
MYSQL_USER: user
MYSQL_PASSWORD: password
MYSQL_DATABASE: test
MYSQL_ROOT_PASSWORD: password
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up JDK 1.16
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '16'
- name: Verify MariaDB connection
env:
PORT: ${{ job.services.mariadb.ports[3306] }}
run: |
while ! mysqladmin ping -h"127.0.0.1" -P"$PORT" --silent; do
sleep 1
done
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build with Gradle
env:
MYSQL_DB: test
MYSQL_USER: user
MYSQL_PASS: password
MYSQL_PORT: ${{ job.services.mariadb.ports[3306] }}
run: |
cd Plan
./gradlew build
- name: SonarCloud
run: |
cd Plan
./gradlew sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=player-analytics-plan
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}