Skip to content

Commit

Permalink
[issue-1351] - Implement automation to build and deploy the project d…
Browse files Browse the repository at this point in the history
…ocumentatiion to GitHub pages (#1352)

* [issue-1351] - Adding a build module and a build/docs module

* [issue-1351] - Fixing documentation sources

* [issue-1351] - Adding a GitHub action workflow to deploy documentation on GitHub Pages
  • Loading branch information
fabiobrz authored Jan 22, 2025
1 parent 91fcd95 commit 283452f
Show file tree
Hide file tree
Showing 11 changed files with 170 additions and 37 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build and Deploy to GitHub Pages
on:
workflow_dispatch:
inputs:
arquillian-cube-ref:
description: 'The Arquillian Cube branch that will be used to build and deploy the documentation'
required: false
default: "2.0.0.Alpha1"
type: string

jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.arquillian-cube-ref }}
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 11
cache: maven
- name: Build with Maven
run: ./mvnw --batch-mode --no-transfer-progress clean package -pl build/docs
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: build/docs/target/generated-docs/
git-config-name: Alien Ike
git-config-email: [email protected]
37 changes: 18 additions & 19 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
= Arquillian Cube
:asciidoctor-source: https://raw.githubusercontent.com/arquillian/arquillian-cube/main/docs
:numbered:
:sectlink:
:sectanchors:
Expand All @@ -20,40 +19,40 @@ To read complete documentation visit http://arquillian.org/arquillian-cube/
endif::generated-doc[]

ifdef::generated-doc[]
include::{asciidoctor-source}/what-is-this.adoc[]
include::what-is-this.adoc[]

include::{asciidoctor-source}/preliminaries.adoc[]
include::preliminaries.adoc[]

include::{asciidoctor-source}/example.adoc[]
include::example.adoc[]

include::{asciidoctor-source}/bom.adoc[]
include::bom.adoc[]

include::{asciidoctor-source}/configuration.adoc[]
include::configuration.adoc[]

include::{asciidoctor-source}/build-containers.adoc[]
include::build-containers.adoc[]

include::{asciidoctor-source}/compose.adoc[]
include::compose.adoc[]

include::{asciidoctor-source}/enrichers.adoc[]
include::enrichers.adoc[]

include::{asciidoctor-source}/parallel.adoc[]
include::parallel.adoc[]

include::{asciidoctor-source}/cop.adoc[]
include::cop.adoc[]

include::{asciidoctor-source}/requirements.adoc[]
include::requirements.adoc[]

include::{asciidoctor-source}/containerless.adoc[]
include::containerless.adoc[]

include::{asciidoctor-source}/drone.adoc[]
include::drone.adoc[]

include::{asciidoctor-source}/restassured.adoc[]
include::restassured.adoc[]

include::{asciidoctor-source}/reports.adoc[]
include::reports.adoc[]

include::{asciidoctor-source}/polyglot.adoc[]
include::polyglot.adoc[]

include::{asciidoctor-source}/kubernetes.adoc[]
include::kubernetes.adoc[]

include::{asciidoctor-source}/fabric8.adoc[]
include::fabric8.adoc[]

endif::generated-doc[]
82 changes: 82 additions & 0 deletions build/docs/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.arquillian.cube</groupId>
<artifactId>arquillian-cube-build</artifactId>
<version>2.0.0.Alpha1</version>
</parent>
<artifactId>arquillian-cube-build-docs</artifactId>
<packaging>pom</packaging>
<name>Arquillian Cube: Build documentation</name>

<properties>
<project.root.dir>${basedir}/../..</project.root.dir>
<documentation.sources.directory>${project.build.directory}/compiled-sources-docs</documentation.sources.directory>
</properties>

<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<mkdir dir="${documentation.sources.directory}"/>
<copy todir="${documentation.sources.directory}">
<fileset dir="${project.build.directory}/../../../docs/" includes="*.adoc"/>
</copy>
<copy file="${project.build.directory}/../../../README.adoc" tofile="${documentation.sources.directory}/index.adoc"/>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>2.2.6</version>
<executions>
<execution>
<id>output-html-user-guide</id>
<phase>package</phase>
<goals>
<goal>process-asciidoc</goal>
</goals>
<configuration>
<backend>html5</backend>
<attributes>
<toc>left</toc>
<linkcss>false</linkcss>
<attribute-missing>warn</attribute-missing>
<sectnums>true</sectnums>
<!-- Attribute used to differentiate between built-tin rendering a GitHub project landing page readme vs building a page for publishing -->
<!-- Example: -->
<!-- ifdef::generated-doc[] -->
<!-- ... -->
<!-- endif::generated-doc[] -->
<generated-doc>true</generated-doc>
<project_version>${project.version}</project_version>
<project_root_dir>${project.root.dir}</project_root_dir>
</attributes>
<sourceDirectory>${documentation.sources.directory}</sourceDirectory>
<sourceDocumentName>index.adoc</sourceDocumentName>
<logHandler>
<failIf>
<severity>WARN</severity>
</failIf>
</logHandler>
<enableVerbose>true</enableVerbose>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
17 changes: 17 additions & 0 deletions build/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.arquillian.cube</groupId>
<artifactId>arquillian-cube-parent</artifactId>
<version>2.0.0.Alpha1</version>
</parent>

<artifactId>arquillian-cube-build</artifactId>
<name>Arquillian Cube: Build Parent</name>
<packaging>pom</packaging>

<modules>
<module>docs</module>
</modules>
</project>
6 changes: 3 additions & 3 deletions docs/bom.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Then include the individual modules as you see fit, by simply depending on the u

[source, xml, indent=0]
----
include::../pom.xml[tag=docker_starter_dependency]
include::{project_root_dir}/pom.xml[tag=docker_starter_dependency,role=include]
----

==== Arquillian Cube Docker Junit Rule
Expand Down Expand Up @@ -184,7 +184,7 @@ include::../pom.xml[tag=docker_starter_dependency]

[source, xml, indent=0]
----
include::../pom.xml[tag=kubernetes_starter_dependency]
include::{project_root_dir}/pom.xml[tag=kubernetes_starter_dependency]
----

==== Arquillian Cube Kubernetes Reporter
Expand Down Expand Up @@ -224,5 +224,5 @@ include::../pom.xml[tag=kubernetes_starter_dependency]

[source, xml, indent=0]
----
include::../pom.xml[tag=openshift_starter_dependency]
include::{project_root_dir}/pom.xml[tag=openshift_starter_dependency]
----
4 changes: 2 additions & 2 deletions docs/cop.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ To do use it you need to define the container object using `ContainerDsl` class
[source, java]
.RedisTest.java
----
include::../docker/ftest-docker-junit5/src/test/java/org/arquillian/cube/docker/junit5/RedisTest.java[tag=docs, indent=0]
include::{project_root_dir}/docker/ftest-docker-junit5/src/test/java/org/arquillian/cube/docker/junit5/RedisTest.java[tag=docs, indent=0]
----

If field is static, container is started and stopped just once. If not then it is started and stopped for each test method execution.
Expand Down Expand Up @@ -389,7 +389,7 @@ To do use it you need to define the network object using `NetowrkDsl` class and
[source, java]
.NetworkTest.java
----
include::../docker/ftest-docker-junit5/src/test/java/org/arquillian/cube/docker/junit5/NetworkTest.java[tag=docs, indent=0]
include::{project_root_dir}/docker/ftest-docker-junit5/src/test/java/org/arquillian/cube/docker/junit5/NetworkTest.java[tag=docs, indent=0]
----

If field is static, network is created and destroyed just once. If not then it is created and destroyed for each test method execution.
Expand Down
2 changes: 1 addition & 1 deletion docs/enrichers.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ or
[source, java]
.RouterURLEnricher.java
----
include::../openshift/ftest-openshift-resources-standalone/src/test/java/org/arquillian/cube/openshift/standalone/HelloWorldOpenShiftResourcesIT.java[tag=enricher_expression_resolver_example]
include::{project_root_dir}/openshift/ftest-openshift-resources-standalone/src/test/java/org/arquillian/cube/openshift/standalone/HelloWorldOpenShiftResourcesIT.java[tag=enricher_expression_resolver_example]
----

You can also use an additional annotation `@AwaitRoute` to wait until the route becomes available.
Expand Down
4 changes: 2 additions & 2 deletions docs/fabric8.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ However, there is way to build images and generate resources using the JKube `ku
`openshift-maven-plugin` as a part of test execution.
If you enable `cube.fmp.build` property, cube will build image and generate resources for you by running embedded maven
build as per options provided in `arquillian.xml` using either:
- `mvn package k8s:build k8s:resource -Dfabric8.namespace=${namespace_configured_for_cube}`, or
- `mvn package oc:build oc:resource -Dfabric8.namespace=${namespace_configured_for_cube}`
- `mvn package k8s:build k8s:resource -Dfabric8.namespace=$+{namespace_configured_for_cube}+`, or
- `mvn package oc:build oc:resource -Dfabric8.namespace=$+{namespace_configured_for_cube}+`

You can use the following configuration options with Kubernetes and OpenShift extension to enable
link:https://eclipse.dev/jkube/docs/kubernetes-maven-plugin/[JKube Kubernetes Maven Plugin] or
Expand Down
18 changes: 9 additions & 9 deletions docs/kubernetes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ The main modules of this extension are the following:

=== Setup

To use Kubernetes extension you need to register next dependency in your build tool: `org.arquillian.cube:arquillian-cube-kubernetes:${version}`.
To use Kubernetes extension you need to register next dependency in your build tool: `org.arquillian.cube:arquillian-cube-kubernetes:${project_version}`.

To use OpenShift extension you need to register next dependency in your build tool: `org.arquillian.cube:arquillian-cube-openshift:${version}`.
To use OpenShift extension you need to register next dependency in your build tool: `org.arquillian.cube:arquillian-cube-openshift:${project_version}`.

=== Configuring the extension

Expand Down Expand Up @@ -187,7 +187,7 @@ You can set a template location viaa a configuration parameter or using `@Templa
Here's a small example:
[source, java]
----
include::../openshift/ftest-template-standalone/src/test/java/org/arquillian/cube/openshift/standalone/HelloWorldTemplateIT.java[tag=openshift_template_example]
include::{project_root_dir}/openshift/ftest-template-standalone/src/test/java/org/arquillian/cube/openshift/standalone/HelloWorldTemplateIT.java[tag=openshift_template_example]
----

However, in `@Template`, url can be set using `url = https://git.io/vNRQm` or using
Expand Down Expand Up @@ -429,7 +429,7 @@ To control you need to inject into test the `org.arquillian.cube.kubernetes.impl

[source, java]
----
include::../kubernetes/ftest-kubernetes-assistant/src/test/java/org/arquillian/cube/kubernetes/assistant/HelloWorldKubernetesAssistantTest.java[tag=k8_assistant_example]
include::{project_root_dir}/kubernetes/ftest-kubernetes-assistant/src/test/java/org/arquillian/cube/kubernetes/assistant/HelloWorldKubernetesAssistantTest.java[tag=k8_assistant_example]
----
<1> Sets the application name where everything is deployed.
<2> You can get the url of the deployed service on the cluster.
Expand Down Expand Up @@ -625,7 +625,7 @@ Let's see how can you execute `oc` or `kubectl` commands as a part of your test.
[source, java]
.OpenshiftAndK8sExample.java
----
include::../openshift/ftest-oc-proxy/src/test/java/org/arquillian/cube/openshift/ftest/HelloWorldIT.java[tag=client_cli_execution]
include::{project_root_dir}/openshift/ftest-oc-proxy/src/test/java/org/arquillian/cube/openshift/ftest/HelloWorldIT.java[tag=client_cli_execution]
----

=== OpenShift Integration with Graphene
Expand Down Expand Up @@ -723,7 +723,7 @@ treated as is. For example:
[source, xml]
.arquillian.xml
----
include::../openshift/ftest-openshift-restassured/src/test/resources/arquillian.xml[tag=restassured_configuration]
include::{project_root_dir}/openshift/ftest-openshift-restassured/src/test/resources/arquillian.xml[tag=restassured_configuration]
----

As shown in the above snippet example (1), this integration will try to find an OpenShift route with name hello-world
Expand Down Expand Up @@ -754,7 +754,7 @@ to write your Arquillian Cube test as :
[source, java]
.HelloOpenShiftRestAssuredIT.java
----
include::../openshift/ftest-openshift-restassured/src/test/java/org/arquillian/openshift/restassured/HelloOpenShiftRestAssuredIT.java[tag=openshift_restassured_example]
include::{project_root_dir}/openshift/ftest-openshift-restassured/src/test/java/org/arquillian/openshift/restassured/HelloOpenShiftRestAssuredIT.java[tag=openshift_restassured_example]
----

Notice that no _ip_ nor _port_ configuration are required since everything is managed and configured by Cube.
Expand All @@ -775,7 +775,7 @@ To use Istio integration you just need to add next dependency.
[source, xml]
.pom.xml
----
include::../pom.xml[indent=0, tag=istio_dependency]
include::{project_root_dir}/pom.xml[indent=0, tag=istio_dependency]
----

TIP: Same dependency can be used for OpenShift
Expand Down Expand Up @@ -815,7 +815,7 @@ Notice that both annotations and assistant approaches can be mixed in the same t

[source, java]
----
include::../openshift/ftest-istio-openshift/src/test/java/org/arquillian/cube/openshift/standalone/ReviewsIT.java[indent=0, tag=istio_assistant]
include::{project_root_dir}/openshift/ftest-istio-openshift/src/test/java/org/arquillian/cube/openshift/standalone/ReviewsIT.java[indent=0, tag=istio_assistant]
----

The assistant provides you `deployIstioResources` and `undeployIstioResources` to deploy and undeploy Istio resources.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void should_inject_kubernetes_assistant() {

@Test
public void should_apply_route_programmatically() throws IOException {
kubernetesAssistant.deployApplication("hello-world"); // <1>
kubernetesAssistant.deployApplication("hello-world"); // <1>
Optional<URL> serviceUrl = kubernetesAssistant.getServiceUrl("hello-world"); // <2>

given()
Expand Down
2 changes: 2 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
<module>arquillian-cube-kubernetes-starter</module>
<module>arquillian-cube-openshift-starter</module>
<module>jkube-maven-plugin-build</module>
<!-- build modules -->
<module>build</module>
</modules>

<developers>
Expand Down

0 comments on commit 283452f

Please sign in to comment.