Skip to content

Commit

Permalink
Build / release module build workflow improvements / fixes (#7619)
Browse files Browse the repository at this point in the history
* schemas now uses `SNAPSHOTS`, no longer to manage schemas `3.8` explicitly.
* Remember to include `-Drelease` flag so that all modules (even optional modules) are compiled and tested during QA.
* Troubleshoot release module order of execution and profile activation and handling of jetty folder.
* Web profile with-doc profile needs dependency to build docs first.
---------

Signed-off-by: Jody Garnett <[email protected]>
  • Loading branch information
jodygarnett authored Jan 16, 2024
1 parent 5d85e8c commit 44105b5
Show file tree
Hide file tree
Showing 8 changed files with 115 additions and 51 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,3 @@ jobs:
- name: Remove SNAPSHOT jars from repository
run: |
find ~/.m2/repository -name "*SNAPSHOT*" -type d | xargs rm -rf {}
- name: Remove Schema 3.8 jars from repository
run: |
find ~/.m2/repository -name "*3.8*" -type d | xargs rm -rf {}
10 changes: 2 additions & 8 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,10 @@ jobs:
maven-version: 3.6.3
- name: Build with Maven
run: |
mvn -B -ntp -V install -DskipTests=true -Dmaven.javadoc.skip=true -Pwith-doc
mvn -B -ntp -V install -DskipTests=true -Dmaven.javadoc.skip=true -Drelease -Pwith-doc
- name: Remove SNAPSHOT jars from repository
run: |
find ~/.m2/repository -name "*SNAPSHOT*" -type d | xargs rm -rf {}
- name: Remove Schema 3.8 jars from repository
run: |
find ~/.m2/repository -name "*3.8*" -type d | xargs rm -rf {}
QA:
runs-on: ubuntu-22.04
Expand All @@ -70,10 +67,7 @@ jobs:
- name: Test with maven
run: |
mvn -B resources:resources@copy-index-schema-to-source -f web
mvn -B -ntp -V -fae verify -Pit
mvn -B -ntp -V -fae verify -Drelesae -Pit
- name: Remove SNAPSHOT jars from repository
run: |
find ~/.m2/repository -name "*SNAPSHOT*" -type d | xargs rm -rf {}
- name: Remove Schema 3.8 jars from repository
run: |
find ~/.m2/repository -name "*3.8*" -type d | xargs rm -rf {}
7 changes: 0 additions & 7 deletions docs/manual/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,6 @@
</execution>
</executions>
</plugin>
<!-- no need to install this to local repo -->
<plugin>
<artifactId>maven-install-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<!-- no need to deploy to nexus repo -->
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
Expand Down
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.1.1</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.1</version>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
Expand Down
32 changes: 23 additions & 9 deletions release/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,33 @@ cd release
mvn clean install -Drelease
```

## Manual
This module is designed to be used as part of a full build. It copies files from web/target so gn-web-app must be built first.

## Manual release

Open a terminal window and execute the following steps from within the ``release`` folder.

* Once GeoNetwork has been built (run Maven in the repository root), download Jetty:
1. Once GeoNetwork has been built (run Maven in the repository root), download Jetty:

```bash
mvn clean install -Pjetty-download
```

This will download the version of jetty indicated in dependency management, and rename to ``jetty`` folder
(adjusting ``jetty-deploy.xml`` configuration to use `web` rather than default ``webapps``).

2. Next, create the ZIP distributions and copy the WAR:

`
mvn clean install -Pjetty-download
`
```
ant
```

The build.xml file will check everything is available and assemble into a zip.

* Next, create the ZIP distributions and copy the WAR:
## Jetty download

`
ant
`
To clean up the ``jetty`` download, when switching between branches:

```bash
mvn clean:clean@reset
```
3 changes: 2 additions & 1 deletion release/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@

<echo message="Creating ZIP file for ${appName} ${version}..."/>

<zip destfile="target/${appName}-${version}/${bundleName}-${version}-${subVersion}.zip">
<zip destfile="target/${appName}-${version}/${bundleName}-${version}-${subVersion}.zip" update="yes">
<zipfileset dir="./bin" excludes="**.sh" prefix="bin" />
<zipfileset dir="./bin" includes="**.sh" prefix="bin" filemode="774"/>
<zipfileset dir="${propsdir}" includes="readme.html, license.html" />
Expand All @@ -118,6 +118,7 @@
<checksum
file="target/${appName}-${version}/${bundleName}-${version}-${subVersion}.zip"
forceOverwrite="yes"/>

</target>

<!-- Copy and rename WAR file and calculate checksum -->
Expand Down
41 changes: 37 additions & 4 deletions release/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

<artifactId>gn-release</artifactId>
<packaging>pom</packaging>
<name>Release module</name>
<description>Use to create distribution packages.</description>
<name>GeoNetwork Release module</name>
<description>Use to create zip distribution packages (copies from files from web which must be built first).</description>

<licenses>
<license>
Expand All @@ -23,6 +23,35 @@
</license>
</licenses>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>gn-web-app</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<executions>
<execution>
<id>reset</id>
<goals><goal>clean</goal></goals>
<configuration>
<filesets>
<fileset>
<directory>jetty</directory>
</fileset>
</filesets>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

<profiles>
<!-- jetty-download is an optional build step for generating release -->
<!-- hack: using the integration phase steps to build before install -->
Expand All @@ -40,8 +69,9 @@
<artifactId>download-maven-plugin</artifactId>
<executions>
<execution>
<id>download-jetty</id>
<id>jetty-download</id>
<phase>pre-integration-test</phase>
<!-- prepare-package step moved later in maven lifecycle to avoid slowing down local testing -->
<goals>
<goal>wget</goal>
</goals>
Expand All @@ -57,7 +87,9 @@
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<id>jetty-rename</id>
<phase>pre-integration-test</phase>
<!-- prepare-package step moved later in maven lifecycle to avoid slowing down local testing -->
<goals>
<goal>run</goal>
</goals>
Expand Down Expand Up @@ -91,6 +123,7 @@
<executions>
<execution>
<phase>post-integration-test</phase>
<!-- package step moved later in maven lifecycle to avoid slowing down local testing -->
<goals>
<goal>run</goal>
</goals>
Expand Down
62 changes: 43 additions & 19 deletions web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@
</validationProperties>
<validationShouldFailIfNoMatch>false</validationShouldFailIfNoMatch>
</configuration>
</plugin>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
Expand Down Expand Up @@ -851,24 +851,6 @@
<overwrite>true</overwrite>
</configuration>
</execution>
<execution>
<id>copy-documentation</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<includeEmptyDirs>true</includeEmptyDirs>
<overwrite>true</overwrite>
<outputDirectory>${build.webapp.resources}</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/../docs/manual/target/help</directory>
<targetPath>${basedir}/src/main/webapp/doc</targetPath>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-index-schema-to-source</id>
<phase>process-resources</phase>
Expand Down Expand Up @@ -1310,6 +1292,48 @@
</properties>
</profile>

<profile>
<id>with-doc</id>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>gn-guide</artifactId>
<version>${project.version}</version>
<classifier>help</classifier>
<type>zip</type>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-documentation</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<includeEmptyDirs>true</includeEmptyDirs>
<overwrite>true</overwrite>
<outputDirectory>${build.webapp.resources}</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/../docs/manual/target/help</directory>
<targetPath>${basedir}/src/main/webapp/doc/en</targetPath>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>slave</id>
<dependencies>
Expand Down

0 comments on commit 44105b5

Please sign in to comment.