Merge javadocs pipeline to ci pipeline

Affects issues:
- Close #2677
This commit is contained in:
Aurora Lahtela 2022-10-30 10:47:59 +02:00
parent 2ee404b83d
commit 7491e54692
2 changed files with 32 additions and 57 deletions

View File

@ -25,26 +25,26 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Setup JDK - name: Setup JDK
uses: actions/setup-java@v2 uses: actions/setup-java@v2
with: with:
distribution: 'adopt' distribution: 'adopt'
java-version: '17' java-version: '17'
- name: Setup Selenium Webdriver - name: 🚦 Setup Selenium Webdriver
uses: nanasess/setup-chromedriver@v1 uses: nanasess/setup-chromedriver@v1
- name: Setup Selenium Webdriver settings - name: Setup Selenium Webdriver settings
run: | run: |
export DISPLAY=:99 export DISPLAY=:99
chromedriver --url-base=/wd/hub & chromedriver --url-base=/wd/hub &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
- name: Verify MariaDB connection - name: 📶 Verify MariaDB connection
env: env:
PORT: ${{ job.services.mariadb.ports[3306] }} PORT: ${{ job.services.mariadb.ports[3306] }}
run: | run: |
while ! mysqladmin ping -h"127.0.0.1" -P"$PORT" --silent; do while ! mysqladmin ping -h"127.0.0.1" -P"$PORT" --silent; do
sleep 1 sleep 1
done done
- name: Cache Gradle packages - name: 💼 Load Gradle Cache
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: | path: |
@ -53,11 +53,11 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: | restore-keys: |
${{ runner.os }}-gradle- ${{ runner.os }}-gradle-
- name: Build jars - name: 🛠 Build jars
run: | run: |
cd Plan cd Plan
./gradlew shadowJar ./gradlew shadowJar
- name: Get versions - name: Get versions 🛒
run: | run: |
cd Plan cd Plan
./gradlew snapshotVersion jarNameVersion ./gradlew snapshotVersion jarNameVersion
@ -66,17 +66,17 @@ jobs:
echo "snapshotVersion=$(cat build/versions/snapshot.txt)" >> $GITHUB_ENV echo "snapshotVersion=$(cat build/versions/snapshot.txt)" >> $GITHUB_ENV
echo "versionString=$(cat build/versions/jar.txt)" >> $GITHUB_ENV echo "versionString=$(cat build/versions/jar.txt)" >> $GITHUB_ENV
echo "artifactPath=$(pwd)/builds" >> $GITHUB_ENV echo "artifactPath=$(pwd)/builds" >> $GITHUB_ENV
- name: Upload Plan.jar - name: 📤 Upload Plan.jar
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: Plan-${{ env.versionString }}-${{ env.git_hash }}.jar name: Plan-${{ env.versionString }}-${{ env.git_hash }}.jar
path: ${{ env.artifactPath }}/Plan-${{ env.snapshotVersion }}.jar path: ${{ env.artifactPath }}/Plan-${{ env.snapshotVersion }}.jar
- name: Upload PlanFabric.jar - name: 📤 Upload PlanFabric.jar
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: PlanFabric-${{ env.versionString }}-${{ env.git_hash }}.jar name: PlanFabric-${{ env.versionString }}-${{ env.git_hash }}.jar
path: ${{ env.artifactPath }}/PlanFabric-${{ env.snapshotVersion }}.jar path: ${{ env.artifactPath }}/PlanFabric-${{ env.snapshotVersion }}.jar
- name: Test - name: 🩺 Test
env: env:
MYSQL_DB: test MYSQL_DB: test
MYSQL_USER: user MYSQL_USER: user
@ -86,7 +86,29 @@ jobs:
run: | run: |
cd Plan cd Plan
./gradlew build ./gradlew build
- name: SonarCloud - name: 🖨 Build Javadocs
if: github.ref == 'refs/heads/master'
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
- name: 🖨 Deploy Javadocs
if: github.ref == 'refs/heads/master'
uses: JamesIves/github-pages-deploy-action@4.1.4
with:
branch: gh-pages # The branch the action should deploy to.
folder: javadocs # The folder the action should deploy.
- name: 🩺 SonarCloud
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

View File

@ -1,47 +0,0 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Automatically Deploy Javadocs
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2.3.1
- name: Set up JDK 🍵
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '17'
- name: Build Javadocs 🔧
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
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@4.1.4
with:
branch: gh-pages # The branch the action should deploy to.
folder: javadocs # The folder the action should deploy.