2019-12-10 12:09:08 +01:00
|
|
|
|
2022-07-06 19:45:16 +02:00
|
|
|
name: CI
|
2019-12-10 12:09:08 +01:00
|
|
|
|
2022-07-06 19:45:16 +02:00
|
|
|
on: [push, pull_request]
|
2019-12-10 12:09:08 +01:00
|
|
|
|
|
|
|
jobs:
|
2022-07-06 19:45:16 +02:00
|
|
|
test:
|
2022-08-01 17:37:01 +02:00
|
|
|
name: Test, Build & Upload
|
2019-12-10 12:09:08 +01:00
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
2020-05-09 09:16:05 +02:00
|
|
|
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
|
|
|
|
|
2019-12-10 12:09:08 +01:00
|
|
|
steps:
|
2022-10-30 09:54:19 +01:00
|
|
|
- name: 📥 Checkout git repository
|
2022-11-20 11:23:58 +01:00
|
|
|
uses: actions/checkout@v3
|
2021-07-24 13:04:48 +02:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2022-10-30 09:47:59 +01:00
|
|
|
- name: ☕ Setup JDK
|
2022-11-20 11:23:58 +01:00
|
|
|
uses: actions/setup-java@v3
|
2021-07-23 15:49:34 +02:00
|
|
|
with:
|
|
|
|
distribution: 'adopt'
|
2022-06-10 15:21:53 +02:00
|
|
|
java-version: '17'
|
2022-10-30 09:47:59 +01:00
|
|
|
- name: 🚦 Setup Selenium Webdriver
|
2022-02-28 18:20:36 +01:00
|
|
|
uses: nanasess/setup-chromedriver@v1
|
2022-10-30 09:54:19 +01:00
|
|
|
- name: 🚦 Setup Selenium Webdriver settings
|
2022-02-28 18:20:36 +01:00
|
|
|
run: |
|
|
|
|
export DISPLAY=:99
|
|
|
|
chromedriver --url-base=/wd/hub &
|
|
|
|
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
|
2022-10-30 09:47:59 +01:00
|
|
|
- name: 📶 Verify MariaDB connection
|
2021-07-23 15:49:34 +02:00
|
|
|
env:
|
|
|
|
PORT: ${{ job.services.mariadb.ports[3306] }}
|
|
|
|
run: |
|
|
|
|
while ! mysqladmin ping -h"127.0.0.1" -P"$PORT" --silent; do
|
|
|
|
sleep 1
|
|
|
|
done
|
2022-10-30 09:47:59 +01:00
|
|
|
- name: 💼 Load Gradle Cache
|
2022-11-20 11:23:58 +01:00
|
|
|
uses: actions/cache@v3
|
2021-07-23 15:49:34 +02:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.gradle/caches
|
|
|
|
~/.gradle/wrapper
|
|
|
|
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-gradle-
|
2022-10-30 09:47:59 +01:00
|
|
|
- name: 🛠 Build jars
|
2021-07-23 15:49:34 +02:00
|
|
|
run: |
|
|
|
|
cd Plan
|
2022-08-14 19:35:32 +02:00
|
|
|
./gradlew shadowJar
|
2022-10-30 09:54:19 +01:00
|
|
|
- name: ⚙ Get versions
|
2022-07-06 19:45:16 +02:00
|
|
|
run: |
|
|
|
|
cd Plan
|
2022-08-01 17:37:01 +02:00
|
|
|
./gradlew snapshotVersion jarNameVersion
|
2022-07-06 19:45:16 +02:00
|
|
|
git_hash=$(git rev-parse --short "$GITHUB_SHA")
|
|
|
|
echo "git_hash=$git_hash" >> $GITHUB_ENV
|
|
|
|
echo "snapshotVersion=$(cat build/versions/snapshot.txt)" >> $GITHUB_ENV
|
|
|
|
echo "versionString=$(cat build/versions/jar.txt)" >> $GITHUB_ENV
|
|
|
|
echo "artifactPath=$(pwd)/builds" >> $GITHUB_ENV
|
2022-10-30 09:47:59 +01:00
|
|
|
- name: 📤 Upload Plan.jar
|
2022-07-06 19:45:16 +02:00
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: Plan-${{ env.versionString }}-${{ env.git_hash }}.jar
|
|
|
|
path: ${{ env.artifactPath }}/Plan-${{ env.snapshotVersion }}.jar
|
2022-10-30 09:47:59 +01:00
|
|
|
- name: 📤 Upload PlanFabric.jar
|
2022-07-06 19:45:16 +02:00
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: PlanFabric-${{ env.versionString }}-${{ env.git_hash }}.jar
|
|
|
|
path: ${{ env.artifactPath }}/PlanFabric-${{ env.snapshotVersion }}.jar
|
2022-10-30 09:47:59 +01:00
|
|
|
- name: 🩺 Test
|
2022-08-14 19:35:32 +02:00
|
|
|
env:
|
|
|
|
MYSQL_DB: test
|
|
|
|
MYSQL_USER: user
|
|
|
|
MYSQL_PASS: password
|
|
|
|
MYSQL_PORT: ${{ job.services.mariadb.ports[3306] }}
|
|
|
|
CHROMEDRIVER: /usr/local/bin/chromedriver
|
|
|
|
run: |
|
|
|
|
cd Plan
|
|
|
|
./gradlew build
|
2022-10-30 09:54:19 +01:00
|
|
|
- name: 🖨 Build Javadocs
|
2022-10-30 09:47:59 +01:00
|
|
|
run: |
|
|
|
|
cd Plan
|
|
|
|
echo "Building javadocs with gradle"
|
|
|
|
./gradlew aggregateJavadocs
|
|
|
|
echo "Moving to working directory:"
|
|
|
|
cd ../
|
|
|
|
mkdir javadocs
|
|
|
|
mkdir javadocs/all
|
|
|
|
mkdir javadocs/api
|
|
|
|
cp -r Plan/build/docs/javadoc/* javadocs/all/
|
|
|
|
cp -r Plan/api/build/docs/javadoc/* javadocs/api/
|
|
|
|
cp scripts/index.html javadocs/index.html
|
|
|
|
cd javadocs
|
|
|
|
touch .nojekyll
|
2022-10-30 09:54:19 +01:00
|
|
|
- name: 📤 Deploy Javadocs
|
2022-10-30 09:47:59 +01:00
|
|
|
if: github.ref == 'refs/heads/master'
|
2022-11-27 09:51:36 +01:00
|
|
|
uses: JamesIves/github-pages-deploy-action@v4
|
2022-10-30 09:47:59 +01:00
|
|
|
with:
|
|
|
|
branch: gh-pages # The branch the action should deploy to.
|
|
|
|
folder: javadocs # The folder the action should deploy.
|
2023-02-07 20:36:44 +01:00
|
|
|
- name: 🩺 SonarCloud - Java
|
2023-02-07 20:35:13 +01:00
|
|
|
if: "${{ env.SONAR_TOKEN != '' }}"
|
2022-08-01 17:37:01 +02:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
|
|
run: |
|
|
|
|
cd Plan
|
|
|
|
./gradlew sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=player-analytics-plan
|
2023-02-07 20:36:44 +01:00
|
|
|
- name: 🩺 SonarCloud - React
|
2023-02-07 20:35:13 +01:00
|
|
|
if: "${{ env.SONAR_TOKEN != '' }}"
|
|
|
|
uses: SonarSource/sonarcloud-github-action@master
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|