From 6e30e09cca0bd147d1656dae5f028364eef742a2 Mon Sep 17 00:00:00 2001 From: Alexander Schwartz Date: Tue, 28 Mar 2023 12:35:27 +0200 Subject: [PATCH] Run tests for the moved documentation (#19278) Closes #19272 --- .github/actions/conditional/action.yml | 9 +- .github/actions/conditional/conditions | 7 +- .github/workflows/documentation.yml | 141 ++++++++++++++++++ .github/workflows/{docs.yml => guides.yml} | 14 +- docs/documentation/README.md | 8 +- docs/documentation/aggregation/pom.xml | 2 +- docs/documentation/api_documentation/pom.xml | 2 +- .../authorization_services/pom.xml | 2 +- docs/documentation/dist/pom.xml | 11 +- docs/documentation/pom.xml | 3 +- docs/documentation/release_notes/pom.xml | 2 +- docs/documentation/securing_apps/pom.xml | 2 +- docs/documentation/server_admin/pom.xml | 2 +- docs/documentation/server_development/pom.xml | 2 +- docs/documentation/tests/pom.xml | 29 ++-- .../tests/src/test/resources/log4j.properties | 4 +- docs/documentation/upgrading/pom.xml | 2 +- docs/pom.xml | 16 +- 18 files changed, 218 insertions(+), 40 deletions(-) create mode 100644 .github/workflows/documentation.yml rename .github/workflows/{docs.yml => guides.yml} (75%) diff --git a/.github/actions/conditional/action.yml b/.github/actions/conditional/action.yml index 5062b55287..717d67769c 100644 --- a/.github/actions/conditional/action.yml +++ b/.github/actions/conditional/action.yml @@ -17,9 +17,12 @@ outputs: codeql-themes: description: Should "codeql-analysis.yml / themes" execute value: ${{ steps.changes.outputs.codeql-themes }} - docs: - description: Should "docs.yml" execute - value: ${{ steps.changes.outputs.docs }} + guides: + description: Should "guides.yml" execute + value: ${{ steps.changes.outputs.guides }} + documentation: + description: Should "documentation.yml" execute + value: ${{ steps.changes.outputs.documentation }} runs: using: composite diff --git a/.github/actions/conditional/conditions b/.github/actions/conditional/conditions index 9a8f166c29..7da66f4c7b 100644 --- a/.github/actions/conditional/conditions +++ b/.github/actions/conditional/conditions @@ -2,18 +2,21 @@ # # To test a pattern run '.github/actions/conditional/conditional.sh ' -.github/actions/ ci operator js codeql-java codeql-themes +.github/actions/ ci operator js codeql-java codeql-themes guides documentation .github/workflows/ci.yml ci .github/workflows/operator-ci.yml operator .github/workflows/js-ci.yml js .github/workflows/codeql-analysis.yml codeql-java codeql-themes +.github/workflows/guides.yml guides +.github/workflows/documentation.yml documentation */src/main/ ci operator */src/test/ ci operator pom.xml ci operator -docs/guides/ docs +docs/guides/ guides +docs/documentation/ documentation js/ js diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 0000000000..e8a1f7eb80 --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,141 @@ +name: Keycloak Documentation + +on: + push: + branches-ignore: + - main + - dependabot/** + pull_request: + schedule: + - cron: 0 5 * * * + workflow_dispatch: + +env: + DEFAULT_JDK_VERSION: 17 + DEFAULT_JDK_DIST: temurin + +concurrency: + # Only cancel jobs for PR updates + group: documentation-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +defaults: + run: + shell: bash + +jobs: + + conditional: + name: Check conditional workflows and jobs + if: github.event_name != 'schedule' || github.repository == 'keycloak/keycloak' + runs-on: ubuntu-latest + outputs: + documentation: ${{ steps.conditional.outputs.documentation }} + steps: + - uses: actions/checkout@v3 + + - id: conditional + uses: ./.github/actions/conditional + + build: + name: Build + if: ${{ needs.conditional.outputs.documentation == 'true' }} + runs-on: ubuntu-latest + needs: conditional + steps: + - uses: actions/checkout@v3 + + - id: setup-java + name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: ${{ env.DEFAULT_JDK_DIST }} + java-version: ${{ env.DEFAULT_JDK_VERSION }} + + - id: maven-cache + name: Maven cache + uses: ./.github/actions/maven-cache + + - id: build-documentation + name: Build Keycloak + shell: bash + run: | + MVN_HTTP_CONFIG="-Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120" + ./mvnw install -DskipTests -am -pl docs/documentation/tests,docs/documentation/dist -nsu -B -e $MVN_HTTP_CONFIG -Pdocumentation + + - id: test-documentation + name: Verify Keycloak documentation + shell: bash + run: | + ./mvnw test -Dtest=!ExternalLinksTest -am -pl docs/documentation/tests,docs/documentation/dist -nsu -B -e -Pdocumentation + + - id: upload-keycloak-documentation + name: Upload Keycloak documentation + uses: actions/upload-artifact@v3 + with: + name: keycloak-documentation + path: docs/documentation/dist/target/*.zip + retention-days: 1 + + external-links: + name: External links check + if: ${{ needs.conditional.outputs.documentation == 'true' }} + runs-on: ubuntu-latest + needs: conditional + steps: + - uses: actions/checkout@v3 + + - id: setup-java + name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: ${{ env.DEFAULT_JDK_DIST }} + java-version: ${{ env.DEFAULT_JDK_VERSION }} + + - id: maven-cache + name: Maven cache + uses: ./.github/actions/maven-cache + + - id: build-documentation + name: Build Keycloak + shell: bash + run: | + MVN_HTTP_CONFIG="-Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.wagon.httpconnectionManager.ttlSeconds=120" + ./mvnw install -DskipTests -am -pl docs/documentation/tests -nsu -B -e -Pdocumentation $MVN_HTTP_CONFIG + + - id: test-documentation + name: Verify Keycloak documentation + shell: bash + run: | + ./mvnw test -Dtest=ExternalLinksTest -am -pl docs/documentation/tests,docs/documentation/dist -nsu -B -e -Pdocumentation + + check-set-status: + name: Set check conclusion + needs: + - build + runs-on: ubuntu-latest + outputs: + conclusion: ${{ steps.check.outputs.conclusion }} + + steps: + - uses: actions/checkout@v3 + + - id: check + uses: ./.github/actions/checks-success + + check: + name: Status Check - Keycloak Documentation + if: always() && ( github.event_name != 'schedule' || github.repository == 'keycloak/keycloak' ) + needs: + - conditional + - check-set-status + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Check status + uses: ./.github/actions/checks-job-pass + with: + required: ${{ needs.conditional.outputs.documentation == 'true' }} + conclusion: ${{ needs.check-set-status.outputs.conclusion }} diff --git a/.github/workflows/docs.yml b/.github/workflows/guides.yml similarity index 75% rename from .github/workflows/docs.yml rename to .github/workflows/guides.yml index 953ce8830a..698bc301e3 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/guides.yml @@ -1,4 +1,4 @@ -name: Keycloak Docs +name: Keycloak Guides on: push: @@ -14,7 +14,7 @@ env: concurrency: # Only cancel jobs for PR updates - group: docs-${{ github.head_ref || github.run_id }} + group: guides-${{ github.head_ref || github.run_id }} cancel-in-progress: true defaults: @@ -28,7 +28,7 @@ jobs: if: github.event_name != 'schedule' || github.repository == 'keycloak/keycloak' runs-on: ubuntu-latest outputs: - docs: ${{ steps.conditional.outputs.docs }} + guides: ${{ steps.conditional.outputs.guides }} ci: ${{ steps.conditional.outputs.ci }} steps: - uses: actions/checkout@v3 @@ -38,8 +38,8 @@ jobs: build: name: Build - # will only build the docs if the general CI doesn't run, which will also build the docs - if: ${{ needs.conditional.outputs.docs == 'true' && needs.conditional.outputs.ci != 'true' }} + # will only build the guides if the general CI doesn't run, which will also build the guides + if: ${{ needs.conditional.outputs.guides == 'true' && needs.conditional.outputs.ci != 'true' }} runs-on: ubuntu-latest needs: conditional steps: @@ -63,7 +63,7 @@ jobs: uses: ./.github/actions/checks-success check: - name: Status Check - Keycloak Docs + name: Status Check - Keycloak Guides if: always() && ( github.event_name != 'schedule' || github.repository == 'keycloak/keycloak' ) needs: - conditional @@ -76,5 +76,5 @@ jobs: - name: Check status uses: ./.github/actions/checks-job-pass with: - required: ${{ needs.conditional.outputs.docs == 'true' && needs.conditional.outputs.ci != 'true' }} + required: ${{ needs.conditional.outputs.guides == 'true' && needs.conditional.outputs.ci != 'true' }} conclusion: ${{ needs.check-set-status.outputs.conclusion }} diff --git a/docs/documentation/README.md b/docs/documentation/README.md index 08a496b6da..e92cabfd50 100755 --- a/docs/documentation/README.md +++ b/docs/documentation/README.md @@ -30,17 +30,17 @@ If you are using Windows, you need to run the following command with administrat To build Keycloak Documentation run: - mvn clean install + mvn clean install -am -pl docs/documentation/dist -Pdocumentation Or to build a specific guide run: - mvn clean install -f GUIDE_DIR + mvn clean install -pl doc/documentation/GUIDE_DIR -Pdocumentation By default, an archive version of the documentation is built. To build the latest build run: - mvn clean install -Dlatest + mvn clean install ... -Platest,documentation -You can then view the documentation by opening GUIDE_DIR/target/generated-docs/index.html. +You can then view the documentation by opening `doc/documentation/GUIDE_DIR/target/generated-docs/index.html`. License diff --git a/docs/documentation/aggregation/pom.xml b/docs/documentation/aggregation/pom.xml index c98a777627..af92b7cdde 100644 --- a/docs/documentation/aggregation/pom.xml +++ b/docs/documentation/aggregation/pom.xml @@ -6,7 +6,7 @@ org.keycloak.documentation documentation-parent 999.0.0-SNAPSHOT - ../ + ../pom.xml Aggregation diff --git a/docs/documentation/api_documentation/pom.xml b/docs/documentation/api_documentation/pom.xml index 1644ce5e29..580cefbb33 100644 --- a/docs/documentation/api_documentation/pom.xml +++ b/docs/documentation/api_documentation/pom.xml @@ -6,7 +6,7 @@ org.keycloak.documentation documentation-parent 999.0.0-SNAPSHOT - ../ + ../pom.xml API Documentation diff --git a/docs/documentation/authorization_services/pom.xml b/docs/documentation/authorization_services/pom.xml index 2126b52cb3..6e1042aa84 100644 --- a/docs/documentation/authorization_services/pom.xml +++ b/docs/documentation/authorization_services/pom.xml @@ -6,7 +6,7 @@ org.keycloak.documentation documentation-parent 999.0.0-SNAPSHOT - ../ + ../pom.xml Authorization Services diff --git a/docs/documentation/dist/pom.xml b/docs/documentation/dist/pom.xml index 915bb047c2..7ae91bdb25 100644 --- a/docs/documentation/dist/pom.xml +++ b/docs/documentation/dist/pom.xml @@ -6,13 +6,22 @@ org.keycloak.documentation documentation-parent 999.0.0-SNAPSHOT - ../ + ../pom.xml Keycloak Documentation dist keycloak-documentation pom + + + org.keycloak.documentation + aggregation + ${project.version} + pom + + + diff --git a/docs/documentation/pom.xml b/docs/documentation/pom.xml index 630d36be1d..87b0811474 100644 --- a/docs/documentation/pom.xml +++ b/docs/documentation/pom.xml @@ -109,6 +109,7 @@ + OUTPUT: file://${project.build.directory}/generated-docs/${masterFile}.html ${projectLatestBuild} @@ -136,7 +137,7 @@ header - ${masterFile} + ${masterFile} diff --git a/docs/documentation/release_notes/pom.xml b/docs/documentation/release_notes/pom.xml index 9387b1307c..57d62bebae 100644 --- a/docs/documentation/release_notes/pom.xml +++ b/docs/documentation/release_notes/pom.xml @@ -6,7 +6,7 @@ org.keycloak.documentation documentation-parent 999.0.0-SNAPSHOT - ../ + ../pom.xml Release Notes diff --git a/docs/documentation/securing_apps/pom.xml b/docs/documentation/securing_apps/pom.xml index 06931882e3..6d8dce060e 100644 --- a/docs/documentation/securing_apps/pom.xml +++ b/docs/documentation/securing_apps/pom.xml @@ -6,7 +6,7 @@ org.keycloak.documentation documentation-parent 999.0.0-SNAPSHOT - ../ + ../pom.xml Securing Applications and Services diff --git a/docs/documentation/server_admin/pom.xml b/docs/documentation/server_admin/pom.xml index a093514cf9..cb0c3fdffe 100644 --- a/docs/documentation/server_admin/pom.xml +++ b/docs/documentation/server_admin/pom.xml @@ -6,7 +6,7 @@ org.keycloak.documentation documentation-parent 999.0.0-SNAPSHOT - ../ + ../pom.xml Server Administration diff --git a/docs/documentation/server_development/pom.xml b/docs/documentation/server_development/pom.xml index 41dee455dd..6e0ec2e820 100644 --- a/docs/documentation/server_development/pom.xml +++ b/docs/documentation/server_development/pom.xml @@ -6,7 +6,7 @@ org.keycloak.documentation documentation-parent 999.0.0-SNAPSHOT - ../ + ../pom.xml Server Developer diff --git a/docs/documentation/tests/pom.xml b/docs/documentation/tests/pom.xml index ec43cdce73..75cec10856 100644 --- a/docs/documentation/tests/pom.xml +++ b/docs/documentation/tests/pom.xml @@ -8,15 +8,6 @@ - - org.apache.maven.plugins - maven-compiler-plugin - - 1.8 - 1.8 - - - org.apache.maven.plugins maven-jar-plugin @@ -65,10 +56,10 @@ org.keycloak.documentation documentation-parent 999.0.0-SNAPSHOT - ../ + ../pom.xml - Tests + Keycloak Documentation tests tests jar @@ -103,6 +94,18 @@ ${project.version} pom + + org.keycloak.documentation + upgrading + ${project.version} + pom + + + org.keycloak.documentation + release-notes + ${project.version} + pom + org.junit.jupiter @@ -140,6 +143,10 @@ 5.0.1 test + + org.slf4j + slf4j-log4j12 + diff --git a/docs/documentation/tests/src/test/resources/log4j.properties b/docs/documentation/tests/src/test/resources/log4j.properties index 2d8aaa7297..ff5c214ec1 100644 --- a/docs/documentation/tests/src/test/resources/log4j.properties +++ b/docs/documentation/tests/src/test/resources/log4j.properties @@ -1,5 +1,5 @@ -log4j.rootLogger=debug, keycloak +log4j.rootLogger=info, keycloak log4j.appender.keycloak=org.apache.log4j.ConsoleAppender log4j.appender.keycloak.layout=org.apache.log4j.PatternLayout -log4j.appender.keycloak.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%c] %m%n +log4j.appender.keycloak.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%c] %m%n \ No newline at end of file diff --git a/docs/documentation/upgrading/pom.xml b/docs/documentation/upgrading/pom.xml index c9176f6aa3..9c081109a5 100644 --- a/docs/documentation/upgrading/pom.xml +++ b/docs/documentation/upgrading/pom.xml @@ -6,7 +6,7 @@ org.keycloak.documentation documentation-parent 999.0.0-SNAPSHOT - ../ + ../pom.xml Upgrading Guide diff --git a/docs/pom.xml b/docs/pom.xml index 28ac79bcc6..35f5dfa64f 100755 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -32,6 +32,20 @@ maven-plugin guides - documentation + + + + documentation + + documentation + + + + all + + documentation + + +