Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 6 additions & 18 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,12 @@ jobs:
name: Maven cache
uses: ./.github/actions/maven-cache

- id: build-documentation
name: Build Keycloak
- id: build-test-documentation
name: Build and verify Keycloak documentation
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
./mvnw install -Dtest=!ExternalLinksTest -am -pl docs/documentation/tests,docs/documentation/dist -nsu -B -e $MVN_HTTP_CONFIG -Pdocumentation

- id: upload-keycloak-documentation
name: Upload Keycloak documentation
Expand All @@ -85,18 +79,12 @@ jobs:
name: Maven cache
uses: ./.github/actions/maven-cache

- id: build-documentation
name: Build Keycloak
- id: build-test-documentation
name: Build and verify Keycloak documentation
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
./mvnw install -Dtest=ExternalLinksTest -am -pl docs/documentation/tests -nsu -B -e -Pdocumentation $MVN_HTTP_CONFIG

check:
name: Status Check - Keycloak Documentation
Expand Down
7 changes: 6 additions & 1 deletion docs/documentation/tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

<properties>
<version.log4j>2.17.1</version.log4j>
<!-- this property prevents the warning "WARN FilenoUtil: Native subprocess control requires open access" when using JRuby for the unit tests on JDK17 -->
<surefire.system.args>
--add-opens=java.base/sun.nio.ch=ALL-UNNAMED
--add-opens java.base/java.io=ALL-UNNAMED
</surefire.system.args>
</properties>

<build>
Expand Down Expand Up @@ -134,7 +139,7 @@
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj</artifactId>
<version>2.1.0</version>
<version>2.5.10</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.keycloak.documentation.test;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.keycloak.documentation.test.utils.LinkUtils;
Expand All @@ -10,11 +12,24 @@

public class ExternalLinksTest {

static LinkUtils linkUtils = LinkUtils.getInstance();

@BeforeAll
public static void setup() {
linkUtils = LinkUtils.getInstance();
}

@AfterAll
public static void close() {
// this will save a cache with all verified links that will expire after one day.
linkUtils.close();
}

@ParameterizedTest
@MethodSource("org.keycloak.documentation.test.Guides#guides()")
public void checkExternalLinks(String guideName) throws IOException {
Guide guide = new Guide(guideName);
List<LinkUtils.InvalidLink> invalidLinks = LinkUtils.getInstance().findInvalidLinks(guide);
List<LinkUtils.InvalidLink> invalidLinks = linkUtils.findInvalidLinks(guide);
if (!invalidLinks.isEmpty()) {
StringBuilder sb = new StringBuilder();
sb.append("Broken links (" + invalidLinks.size() + ") in guide '" + guideName + "': ");
Expand Down
2 changes: 2 additions & 0 deletions docs/documentation/tests/src/test/resources/ignored-links
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/#ro
https://github.com/keycloak/keycloak/blob/main/docs/tests.md#kerberos-server
https://github.com/apache/felix-dev/tree/master/http#using-the-osgi-http-whiteboard
https://github.com/keycloak/keycloak/blob/025778fe9c745316f80b53fe3052aeb314e868ef/js/apps/admin-ui/public/locales/en/dashboard.json#L3
https://github.com/keycloak/keycloak/issues/new?*
https://stackapps.com/apps/oauth/register