Plan/.github/workflows/ci.yml
Aurora Lahtela b646e18c68
Fix fabric join address gathering (#2546)
- Refactored player online listeners to move common. often changed logic to common package
- Changed method fabric uses to get join address to use the client handshake packet which has the address
- Added command `/plan db removejoinaddresses {server}` to allow removing invalid join address data
- Changed build pipeline to always build jars even if tests fail
- Disabled one flaky test

Affects issues:
- Closed #817
- Fixed  #2526
2022-08-14 20:35:32 +03:00

97 lines
3.1 KiB
YAML

name: CI
on: [push, pull_request]
jobs:
test:
name: Test, Build & Upload
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: Setup JDK
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '17'
- name: Setup Selenium Webdriver
uses: nanasess/setup-chromedriver@v1
- name: Setup Selenium Webdriver settings
run: |
export DISPLAY=:99
chromedriver --url-base=/wd/hub &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
- 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 jars
run: |
cd Plan
./gradlew shadowJar
- name: Get versions
run: |
cd Plan
./gradlew snapshotVersion jarNameVersion
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
- name: Upload Plan.jar
uses: actions/upload-artifact@v3
with:
name: Plan-${{ env.versionString }}-${{ env.git_hash }}.jar
path: ${{ env.artifactPath }}/Plan-${{ env.snapshotVersion }}.jar
- name: Upload PlanFabric.jar
uses: actions/upload-artifact@v3
with:
name: PlanFabric-${{ env.versionString }}-${{ env.git_hash }}.jar
path: ${{ env.artifactPath }}/PlanFabric-${{ env.snapshotVersion }}.jar
- name: Test
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
- name: SonarCloud
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
if: "${{ env.SONAR_TOKEN != '' }}"
run: |
cd Plan
./gradlew sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=player-analytics-plan