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
RUN apt-get update && apt-get install -y firefox-esr
# Use args to build radius auth extension such as
# `--build-arg BUILD_PROFILE=lgpl-extensions`
ARG BUILD_PROFILE
# Arbitrary arguments that can be passed to the maven build. By default, an
# argument will be provided to explicitly unskip any skipped tests. To, for
# 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
ENV \
@@ -48,7 +50,7 @@ COPY guacamole-docker/bin/ /opt/guacamole/bin/
COPY . "$BUILD_DIR"
# 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
FROM tomcat:${TOMCAT_VERSION}-${TOMCAT_JRE}

View File

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

View File

@@ -44,7 +44,13 @@
between karma and firefox. The default location, /tmp, does not work
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>
@@ -125,18 +131,29 @@
</executions>
</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 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>createFirefoxTempdir</id>
<phase>test-compile</phase>
<phase>test</phase>
<configuration>
<tasks>
<target>
<mkdir dir="${firefox.temp.dir}"/>
</tasks>
</target>
</configuration>
<goals>
<goal>run</goal>
@@ -174,7 +191,7 @@
<!-- Install node.js and NPM before running tests -->
<execution>
<id>install node and npm</id>
<phase>test-compile</phase>
<phase>test</phase>
<goals>
<goal>install-node-and-npm</goal>
</goals>
@@ -183,7 +200,7 @@
<!-- Install test dependencies -->
<execution>
<id>npm install</id>
<phase>test-compile</phase>
<phase>test</phase>
<goals>
<goal>npm</goal>
</goals>

View File

@@ -38,15 +38,9 @@
## subdirectories within this directory, and files will thus be grouped by
## 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"
DESTINATION="$2"
BUILD_PROFILE="$3"
#
# Create destination, if it does not yet exist
@@ -60,16 +54,11 @@ mkdir -p "$DESTINATION"
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
# file or directory")
export OPENSSL_CONF=/etc/ssl
#
# Run the maven build, applying any arbitrary provided maven arguments.
#
if [ -z "$BUILD_PROFILE" ]; then
mvn package
else
mvn -P "$BUILD_PROFILE" package
fi
mvn $MAVEN_ARGUMENTS package
#
# Copy guacamole.war to destination