Skip to content

Commit

Permalink
docs: PlantUML images generation. (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniotarricone authored Mar 22, 2024
1 parent e12653f commit 5e842a5
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 132 deletions.
26 changes: 20 additions & 6 deletions .github/workflows/post-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
# Cache JDK.
#
- name: Cache JDK
if: steps.semantic.outputs.new_release_published == 'true'
#if: steps.semantic.outputs.new_release_published == 'true'
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
id: cache-jdk
with:
Expand All @@ -68,7 +68,8 @@ jobs:
# Download JDK and verify its hash.
#
- name: Download JDK and verify its hash
if: steps.semantic.outputs.new_release_published == 'true' && steps.cache-jdk.outputs.cache-hit != 'true'
#if: steps.semantic.outputs.new_release_published == 'true' && steps.cache-jdk.outputs.cache-hit != 'true'
if: steps.cache-jdk.outputs.cache-hit != 'true'
run: |
echo "e9458b38e97358850902c2936a1bb5f35f6cffc59da9fcd28c63eab8dbbfbc3b ${{ runner.temp }}/jdk_setup.tar.gz" >> ${{ runner.temp }}/jdk_setup.sha256
curl -L "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.7%2B7/OpenJDK17U-jdk_x64_linux_hotspot_17.0.7_7.tar.gz" -o "${{ runner.temp }}/jdk_setup.tar.gz"
Expand All @@ -78,7 +79,7 @@ jobs:
# Setup JDK.
#
- name: Setup JDK
if: steps.semantic.outputs.new_release_published == 'true'
#if: steps.semantic.outputs.new_release_published == 'true'
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2
with:
distribution: "jdkfile"
Expand All @@ -90,7 +91,7 @@ jobs:
# Cache Maven.
#
- name: Cache Maven
if: steps.semantic.outputs.new_release_published == 'true'
#if: steps.semantic.outputs.new_release_published == 'true'
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
id: cache-maven
with:
Expand All @@ -103,7 +104,8 @@ jobs:
# Download Maven and verify its hash.
#
- name: Download Maven and verify its hash
if: steps.semantic.outputs.new_release_published == 'true' && steps.cache-maven.outputs.cache-hit != 'true'
#if: steps.semantic.outputs.new_release_published == 'true' && steps.cache-maven.outputs.cache-hit != 'true'
if: steps.cache-maven.outputs.cache-hit != 'true'
run: |
echo "809ef3220c6d179195c06c324cb9a6d34d8ecba566c5cfd8eb83167bc034117d ${{ runner.temp }}/maven_setup.tar.gz" >> ${{ runner.temp }}/maven_setup.sha256
curl -L "https://archive.apache.org/dist/maven/maven-3/3.9.2/binaries/apache-maven-3.9.2-bin.tar.gz" -o "${{ runner.temp }}/maven_setup.tar.gz"
Expand All @@ -113,12 +115,24 @@ jobs:
# Setup Maven.
#
- name: Setup Maven
if: steps.semantic.outputs.new_release_published == 'true'
#if: steps.semantic.outputs.new_release_published == 'true'
run: |
mkdir ${{ runner.temp }}/maven
tar -xvf ${{ runner.temp }}/maven_setup.tar.gz -C ${{ runner.temp }}/maven --strip-components=1
echo "<settings><servers><server><id>github</id><username>${{ secrets.GIT_USER }}</username><password>${{ secrets.GIT_PAT }}</password></server></servers></settings>" >> ${{ runner.temp }}/settings.xml
#
# Generate images from PlantUML diagrams.
#
- name: Generate images from PlantUML diagrams.
run: |
${{ runner.temp }}/maven/bin/mvn exec:java -s ${{ runner.temp }}/settings.xml --no-transfer-progress
git config user.name "GitHub Workflow"
git config user.email "<>"
git add src/site/puml-img/*.*
git commit -m "PlantUML images updated"
git push origin ${{ github.ref_name }}
#
# RELEASE CANDIDATE - Update of pom.xml with the new version.
#
Expand Down
129 changes: 24 additions & 105 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,16 @@
</developer>
</developers>

<distributionManagement>
<site>
<id>github</id>
<url>https://github.com/pagopa/mil-auth.git</url>
</site>
</distributionManagement>

<properties>
<java.version>17</java.version>
<maven.compiler.release>${java.version}</maven.compiler.release>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.compiler.source>${java.version}</maven.compiler.source>

<compiler-plugin.version>3.11.0</compiler-plugin.version>
<clean-plugin.version>3.3.2</clean-plugin.version>
<exec-plugin.version>3.2.0</exec-plugin.version>
<surefire-plugin.version>3.0.0</surefire-plugin.version>
<sonar-plugin.version>3.9.1.2184</sonar-plugin.version>
<site-plugin.version>4.0.0-M13</site-plugin.version>
<scm-publish-plugin.version>3.2.1</scm-publish-plugin.version>
<openapi-generator-plugin.version>7.4.0</openapi-generator-plugin.version>
<antrun-plugin.version>3.1.0</antrun-plugin.version>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
Expand Down Expand Up @@ -178,10 +166,6 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>${clean-plugin.version}</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${compiler-plugin.version}</version>
Expand Down Expand Up @@ -223,6 +207,7 @@
</execution>
</executions>
</plugin>
<!-- Verifies the hash of the dependencies -->
<plugin>
<groupId>it.pagopa.maven</groupId>
<artifactId>depcheck</artifactId>
Expand All @@ -242,6 +227,7 @@
</execution>
</executions>
</plugin>
<!-- Verifies some quality rules -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
Expand Down Expand Up @@ -287,92 +273,31 @@
</execution>
</executions>
</plugin>
<!-- Copies src/site to target/site-tmp -->
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>${antrun-plugin.version}</version>
<executions>
<execution>
<phase>pre-site</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<mkdir
dir="${project.build.directory}/site-tmp" />
<copy
todir="${project.build.directory}/site-tmp">
<fileset dir="${basedir}/src/site"
includes="**" />
</copy>
</target>
</configuration>
</execution>
</executions>
</plugin>
<!-- Generates OpenAPI MD -->
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>${openapi-generator-plugin.version}</version>
<executions>
<execution>
<phase>pre-site</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>
${project.basedir}/src/main/resources/META-INF/openapi.yaml</inputSpec>
<generatorName>markdown</generatorName>
<output>
${project.build.directory}/site-tmp/markdown/openapi</output>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>${site-plugin.version}</version>
<configuration>
<siteDirectory>${project.build.directory}/site-tmp</siteDirectory>
</configuration>
</plugin>
<!-- Generates images from PlantUML files (mvn exec:java) -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${exec-plugin.version}</version>
<executions>
<execution>
<!-- after site -->
<phase>site</phase>
<goals>
<goal>java</goal>
</goals>
<configuration>
<includeProjectDependencies>false</includeProjectDependencies>
<includePluginDependencies>true</includePluginDependencies>
<executableDependency>
<groupId>net.sourceforge.plantuml</groupId>
<artifactId>plantuml-mit</artifactId>
</executableDependency>
<mainClass>net.sourceforge.plantuml.Run</mainClass>
<arguments>
<argument>${basedir}/src/site/puml/**/MAIN*.puml</argument>
<argument>-o</argument>
<argument>${project.build.directory}/site/puml</argument>
</arguments>
<systemProperties>
<systemProperty>
<key>PLANTUML_LIMIT_SIZE</key>
<value>2147483647</value>
</systemProperty>
</systemProperties>
</configuration>
</execution>
</executions>
<configuration>
<includeProjectDependencies>false</includeProjectDependencies>
<includePluginDependencies>true</includePluginDependencies>
<executableDependency>
<groupId>net.sourceforge.plantuml</groupId>
<artifactId>plantuml-mit</artifactId>
</executableDependency>
<mainClass>net.sourceforge.plantuml.Run</mainClass>
<arguments>
<argument>${basedir}/src/site/puml/**/MAIN*.puml</argument>
<argument>-o</argument>
<argument>${basedir}/src/site/puml-img</argument>
</arguments>
<systemProperties>
<systemProperty>
<key>PLANTUML_LIMIT_SIZE</key>
<value>2147483647</value>
</systemProperty>
</systemProperties>
</configuration>
<dependencies>
<dependency>
<groupId>net.sourceforge.plantuml</groupId>
Expand All @@ -382,16 +307,9 @@
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-scm-publish-plugin</artifactId>
<version>${scm-publish-plugin.version}</version>
<configuration>
<pubScmUrl>${project.scm.developerConnection}</pubScmUrl>
<scmBranch>gh-pages</scmBranch>
</configuration>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>native</id>
Expand All @@ -405,6 +323,7 @@
<quarkus.package.type>native</quarkus.package.type>
</properties>
</profile>

<!-- To execute SCA with SonarCloud: -->
<!-- 1. export SONAR_TOKEN=<sonar token provided by PagoPA DevOps team> -->
<!-- 2. mvn verify -Pvalidate -->
Expand Down
21 changes: 0 additions & 21 deletions src/site/site.xml

This file was deleted.

0 comments on commit 5e842a5

Please sign in to comment.