Browse Source

CI: Test also without OpenMP and pthreads (#2245)

This adds an additional build configuration to the Ubuntu workflow which builds code without OpenMP and pthreads and runs tests. Notably, modules using nprocs parameter should accept nprocs > 1 even when they are not able to parallelize due to a missing dependency. This check tests that behavior.

Other selected optional dependencies can be added in the future. The current goal is to test code without dependencies which don't influence the primary actions the code performs.
Vaclav Petras 3 years ago
parent
commit
a693eae663
2 changed files with 66 additions and 4 deletions
  1. 54 0
      .github/workflows/build_ubuntu-20.04_without_x.sh
  2. 12 4
      .github/workflows/ubuntu.yml

+ 54 - 0
.github/workflows/build_ubuntu-20.04_without_x.sh

@@ -0,0 +1,54 @@
+#!/usr/bin/env bash
+
+# The make step requires something like:
+# export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PREFIX/lib"
+# further steps additionally require:
+# export PATH="$PATH:$PREFIX/bin"
+
+# fail on non-zero return code from a subprocess
+set -e
+
+# print commands
+set -x
+
+if [ -z "$1" ]; then
+    echo "Usage: $0 PREFIX"
+    exit 1
+fi
+
+# Adding -Werror to make's CFLAGS is a workaround for configuring with
+# an old version of configure, which issues compiler warnings and
+# errors out. This may be removed with upgraded configure.in file.
+makecmd="make"
+if [[ "$#" -eq 2 ]]; then
+    makecmd="make CFLAGS='$CFLAGS $2' CXXFLAGS='$CXXFLAGS $2'"
+fi
+
+# non-existent variables as an errors
+set -u
+
+export INSTALL_PREFIX=$1
+
+./configure \
+    --prefix="$INSTALL_PREFIX/" \
+    --enable-largefile \
+    --with-cxx \
+    --with-zstd \
+    --with-bzlib \
+    --with-blas \
+    --with-lapack \
+    --with-readline \
+    --without-openmp \
+    --with-pdal \
+    --without-pthread \
+    --with-tiff \
+    --with-freetype \
+    --with-freetype-includes="/usr/include/freetype2/" \
+    --with-proj-share=/usr/share/proj \
+    --with-geos \
+    --with-sqlite \
+    --with-fftw \
+    --with-netcdf
+
+eval $makecmd
+make install

+ 12 - 4
.github/workflows/ubuntu.yml

@@ -7,13 +7,21 @@ on:
 
 jobs:
   build-and-test:
-    name: ${{ matrix.os }} tests
+    name: ${{ matrix.name }} tests
 
     runs-on: ${{ matrix.os }}
     strategy:
       matrix:
-        os:
-          - ubuntu-20.04
+        include:
+          - name: "20.04"
+            os: ubuntu-20.04
+            config: ubuntu-20.04
+          # This is without optional things but it still keeps things useful,
+          # so, e.g., without OpenMP, but with PDAL. Code or tests should be written
+          # so that test pass even when these optional things are not present.
+          - name: "minimum config"
+            os: ubuntu-20.04
+            config: ubuntu-20.04_without_x
       fail-fast: false
 
     steps:
@@ -39,7 +47,7 @@ jobs:
           echo "LD_LIBRARY_PATH=$HOME/install/lib" >> $GITHUB_ENV
 
       - name: Build
-        run: .github/workflows/build_${{ matrix.os }}.sh $HOME/install
+        run: .github/workflows/build_${{ matrix.config }}.sh $HOME/install
 
       - name: Add the bin directory to PATH
         run: |