From 57441f42686ab88d8cf15c91aa8d7e72d35e81aa Mon Sep 17 00:00:00 2001 From: Alexandre C Date: Tue, 13 Sep 2022 13:54:50 +0200 Subject: [PATCH 1/3] Preparing pipelines for testing docs and reports deploy --- .../generate-jekyll-pages-for-docs.yml | 27 +++++++ .github/workflows/gradle.yml | 33 ++++---- .github/workflows/publish.yml | 14 +++- .github/workflows/update-gh-pages.yml | 81 +++++++++++++++++++ 4 files changed, 136 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/generate-jekyll-pages-for-docs.yml create mode 100644 .github/workflows/update-gh-pages.yml diff --git a/.github/workflows/generate-jekyll-pages-for-docs.yml b/.github/workflows/generate-jekyll-pages-for-docs.yml new file mode 100644 index 000000000..18d4e4815 --- /dev/null +++ b/.github/workflows/generate-jekyll-pages-for-docs.yml @@ -0,0 +1,27 @@ +name: generate-jekyll-pages-for-docs + +on: + workflow_run: + workflows: [ update-gh-pages ] + branches: [ main ] + types: [ completed ] + +jobs: + generate-jekyll-pages: + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + ref: gh-pages + fetch-depth: 0 + + - name: Generate pages from present docs folders and templates + run: bash ./generate-pages.sh + env: + MASTER_BRANCH_NAME: origin/main + SOURCE_INDEX_FILE: README.md + + - name: Commit changes + uses: EndBug/add-and-commit@v8.0.1 diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 89847b470..5797d2b5a 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -6,34 +6,33 @@ name: Java CI with Gradle on: push: branches: [ main ] - pull_request: - branches: [ main ] jobs: build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 8 - uses: actions/setup-java@v2 - with: - java-version: '8' - distribution: 'adopt' + - name: Checkout code + uses: actions/checkout@v2 - - name: Grant execute permission for gradlew - run: chmod +x gradlew + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'adopt' - - name: Build with Gradle - run: ./gradlew build + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build with Gradle + run: ./gradlew build publish-docs-reports: needs: build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Checkout code + uses: actions/checkout@v2 - name: Set up JDK 11 uses: actions/setup-java@v2 @@ -60,6 +59,7 @@ jobs: clean: true folder: build/reports/tests target-folder: docs/latest/junit + - name: Deploy jacoco report to GitHub Pages uses: JamesIves/github-pages-deploy-action@v4.2.2 with: @@ -67,6 +67,7 @@ jobs: clean: true folder: build/reports/jacoco target-folder: docs/latest/jacoco + - name: Deploy to GitHub Pages uses: JamesIves/github-pages-deploy-action@v4.2.2 with: @@ -82,6 +83,7 @@ jobs: clean: true folder: build/reports/tests target-folder: docs/${{ env.PROJECT_VERSION }}/junit + - name: Deploy jacoco report to GitHub Pages uses: JamesIves/github-pages-deploy-action@v4.2.2 with: @@ -89,6 +91,7 @@ jobs: clean: true folder: build/reports/jacoco target-folder: docs/${{ env.PROJECT_VERSION }}/jacoco + - name: Deploy to GitHub Pages uses: JamesIves/github-pages-deploy-action@v4.2.2 with: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 46675f9ad..9e69ec860 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,7 +3,7 @@ # separate terms of service, privacy policy, and support # documentation. -name: Publish package to GitHub Packages and Maven Central +name: Publish package to Maven Central on: release: types: [created] @@ -14,15 +14,21 @@ jobs: contents: read packages: write steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v2 + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up JDK 11 + uses: actions/setup-java@v2 with: - java-version: '8' + java-version: '11' distribution: 'adopt' + - name: Grant execute permission for gradlew run: chmod +x gradlew + - name: Validate Gradle wrapper uses: gradle/wrapper-validation-action@v1 + - name: Publish package uses: gradle/gradle-build-action@v2 with: diff --git a/.github/workflows/update-gh-pages.yml b/.github/workflows/update-gh-pages.yml new file mode 100644 index 000000000..f86d29829 --- /dev/null +++ b/.github/workflows/update-gh-pages.yml @@ -0,0 +1,81 @@ +name: update-gh-pages + +on: + workflow_run: + workflows: [ Java CI with Gradle ] + types: [ completed ] + branches: [ main ] + +jobs: + generate-docs-reports: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'temurin' + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Export project version + run: echo "PROJECT_VERSION=$(./gradlew properties -q | grep "version:" | awk '{print $2}')" >> $GITHUB_ENV + + - name: Generate Javadoc + run: ./gradlew javadoc + + - name: Run tests and generate reports + run: ./gradlew test + + - name: Deploy site (javadocs) to GitHub Pages for current version + uses: JamesIves/github-pages-deploy-action@v4.2.5 + with: + branch: gh-pages + clean: true + folder: target/site + target-folder: docs/${{ env.PROJECT_VERSION }}/site + + - name: Deploy tests results to GitHub Pages for current version + uses: JamesIves/github-pages-deploy-action@v4.2.2 + with: + branch: gh-pages + clean: true + folder: build/reports/tests + target-folder: docs/${{ env.PROJECT_VERSION }}/junit + + - name: Deploy jacoco report to GitHub Pages for current version + uses: JamesIves/github-pages-deploy-action@v4.2.2 + with: + branch: gh-pages + clean: true + folder: build/reports/jacoco + target-folder: docs/${{ env.PROJECT_VERSION }}/jacoco + + - name: Deploy site (javadocs) to GitHub Pages as latest version + uses: JamesIves/github-pages-deploy-action@v4.2.2 + with: + branch: gh-pages + clean: true + folder: build/docs/javadoc + target-folder: docs/latest/javadoc + + - name: Deploy tests results to GitHub Pages as latest version + uses: JamesIves/github-pages-deploy-action@v4.2.2 + with: + branch: gh-pages + clean: true + folder: build/reports/tests + target-folder: docs/latest/junit + + - name: Deploy jacoco report to GitHub Pages as latest version + uses: JamesIves/github-pages-deploy-action@v4.2.2 + with: + branch: gh-pages + clean: true + folder: build/reports/jacoco + target-folder: docs/latest/jacoco From 094bcd99a35f735806401724cf1b89de92794f9e Mon Sep 17 00:00:00 2001 From: Alexandre C Date: Tue, 13 Sep 2022 15:21:08 +0200 Subject: [PATCH 2/3] Fixing wrong source folder for javadocs on workflow --- .github/workflows/update-gh-pages.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-gh-pages.yml b/.github/workflows/update-gh-pages.yml index f86d29829..159d4bfb3 100644 --- a/.github/workflows/update-gh-pages.yml +++ b/.github/workflows/update-gh-pages.yml @@ -37,8 +37,8 @@ jobs: with: branch: gh-pages clean: true - folder: target/site - target-folder: docs/${{ env.PROJECT_VERSION }}/site + folder: build/docs/javadoc + target-folder: docs/${{ env.PROJECT_VERSION }}/javadoc - name: Deploy tests results to GitHub Pages for current version uses: JamesIves/github-pages-deploy-action@v4.2.2 From 52b288190f1c166bf9f99e79fd0c3bb8e68bd106 Mon Sep 17 00:00:00 2001 From: Alexandre C Date: Tue, 13 Sep 2022 15:25:48 +0200 Subject: [PATCH 3/3] run java build/tests on pull requests for main --- .github/workflows/gradle.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 5797d2b5a..599d0ed4a 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -6,6 +6,8 @@ name: Java CI with Gradle on: push: branches: [ main ] + pull_request: + branches: [ main ] jobs: build: