GUACAMOLE-1765: Disable tests by default so the build doesn't require firefox.

This commit is contained in:
James Muehlner
2023-04-07 01:12:33 +00:00
parent bf63964337
commit bd12ac9bc6
4 changed files with 33 additions and 26 deletions

View File

@@ -33,9 +33,11 @@ FROM maven:3-jdk-8 AS builder
# Install firefox browser for sake of JavaScript unit tests # Install firefox browser for sake of JavaScript unit tests
RUN apt-get update && apt-get install -y firefox-esr RUN apt-get update && apt-get install -y firefox-esr
# Use args to build radius auth extension such as # Arbitrary arguments that can be passed to the maven build. By default, an
# `--build-arg BUILD_PROFILE=lgpl-extensions` # argument will be provided to explicitly unskip any skipped tests. To, for
ARG BUILD_PROFILE # example, allow the building of the RADIUS auth extension, pass a build profile
# as well: `--build-arg MAVEN_ARGUMENTS="-P lgpl-extensions -DskipTests=false"`.
ARG MAVEN_ARGUMENTS="-DskipTests=false"
# Build environment variables # Build environment variables
ENV \ ENV \
@@ -48,7 +50,7 @@ COPY guacamole-docker/bin/ /opt/guacamole/bin/
COPY . "$BUILD_DIR" COPY . "$BUILD_DIR"
# Run the build itself # Run the build itself
RUN /opt/guacamole/bin/build-guacamole.sh "$BUILD_DIR" /opt/guacamole "$BUILD_PROFILE" RUN /opt/guacamole/bin/build-guacamole.sh "$BUILD_DIR" /opt/guacamole
# For the runtime image, we start with the official Tomcat distribution # For the runtime image, we start with the official Tomcat distribution
FROM tomcat:${TOMCAT_VERSION}-${TOMCAT_JRE} FROM tomcat:${TOMCAT_VERSION}-${TOMCAT_JRE}

View File

@@ -1,5 +1,4 @@
node/ node/
node_modules/ node_modules/
target/ target/
.tmp/
*~ *~

View File

@@ -44,7 +44,13 @@
between karma and firefox. The default location, /tmp, does not work between karma and firefox. The default location, /tmp, does not work
if firefox is installed via snap. if firefox is installed via snap.
--> -->
<firefox.temp.dir>${project.basedir}/.tmp</firefox.temp.dir> <firefox.temp.dir>${project.build.directory}/tmp</firefox.temp.dir>
<!--
Skip tests unless requested otherwise with -DskipTests=false.
Skipped by default because these tests require firefox to be installed.
-->
<skipTests>true</skipTests>
</properties> </properties>
@@ -125,18 +131,29 @@
</executions> </executions>
</plugin> </plugin>
<!-- Skip tests if configured to do so -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<skipTests>${skipTests}</skipTests>
</configuration>
</plugin>
<!-- Ensure the firefox temp directory exists --> <!-- Ensure the firefox temp directory exists -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId> <artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<executions> <executions>
<execution> <execution>
<id>createFirefoxTempdir</id> <id>createFirefoxTempdir</id>
<phase>test-compile</phase> <phase>test</phase>
<configuration> <configuration>
<tasks> <target>
<mkdir dir="${firefox.temp.dir}"/> <mkdir dir="${firefox.temp.dir}"/>
</tasks> </target>
</configuration> </configuration>
<goals> <goals>
<goal>run</goal> <goal>run</goal>
@@ -174,7 +191,7 @@
<!-- Install node.js and NPM before running tests --> <!-- Install node.js and NPM before running tests -->
<execution> <execution>
<id>install node and npm</id> <id>install node and npm</id>
<phase>test-compile</phase> <phase>test</phase>
<goals> <goals>
<goal>install-node-and-npm</goal> <goal>install-node-and-npm</goal>
</goals> </goals>
@@ -183,7 +200,7 @@
<!-- Install test dependencies --> <!-- Install test dependencies -->
<execution> <execution>
<id>npm install</id> <id>npm install</id>
<phase>test-compile</phase> <phase>test</phase>
<goals> <goals>
<goal>npm</goal> <goal>npm</goal>
</goals> </goals>

View File

@@ -38,15 +38,9 @@
## subdirectories within this directory, and files will thus be grouped by ## subdirectories within this directory, and files will thus be grouped by
## extension type. ## extension type.
## ##
## @param BUILD_PROFILE
## The build profile that will be passed to Maven build process. Defaults
## to empty string. Can be set to "lgpl-extensions" to e.g. include
## RADIUS authentication extension.
##
BUILD_DIR="$1" BUILD_DIR="$1"
DESTINATION="$2" DESTINATION="$2"
BUILD_PROFILE="$3"
# #
# Create destination, if it does not yet exist # Create destination, if it does not yet exist
@@ -60,16 +54,11 @@ mkdir -p "$DESTINATION"
cd "$BUILD_DIR" cd "$BUILD_DIR"
# Required for build leveraging PhantomJS for unit testing (without this, the #
# build fails with "libssl_conf.so: cannot open shared object file: No such # Run the maven build, applying any arbitrary provided maven arguments.
# file or directory") #
export OPENSSL_CONF=/etc/ssl
if [ -z "$BUILD_PROFILE" ]; then mvn $MAVEN_ARGUMENTS package
mvn package
else
mvn -P "$BUILD_PROFILE" package
fi
# #
# Copy guacamole.war to destination # Copy guacamole.war to destination