Skip to content

Commit

Permalink
Clang CI option (#213)
Browse files Browse the repository at this point in the history
* Add tests with clang

For the c8-dev platform activate also a build with clang

* Typo on docker command

* Set workflow environment properly for CI scripts

* Fix typo when setting CC/CXX for clang suite

Improve echo texts

* Don't reset compilers by mistake!

* More consistent passing of variables

Add output in those cases where CXX and CC are set from the outside

* Change to space indented
  • Loading branch information
graeme-a-stewart authored Dec 14, 2021
1 parent 5b7522f commit 0e8c9a3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 7 deletions.
25 changes: 21 additions & 4 deletions .github/scripts/build-test.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,37 @@
#! /usr/bin/env bash
#
# Wrapper script to build prmon on travis and run all tests
# Wrapper script to build prmon and run all tests
#
# Note that CXX, CC and CMAKE can all be customised so that
# they can be matched to the development environment in each
# container; CMAKE_EXTRA can be used to pass special options
# to cmake for particular platforms
cd /tmp
echo "Starting build and test for platform $PLATFORM, compiler suite $COMPILER"
if [ -z "$CXX" ]; then
CXX=$(type -p g++)
if [ "$COMPILER" == "clang" ]; then
CXX=$(type -p clang++)
else
# gcc suite is the fall through
CXX=$(type -p g++)
fi
else
echo "CXX was set externally to $CXX"
fi

if [ -z "$CC" ]; then
CC=$(type -p gcc)
if [ "$COMPILER" == "clang" ]; then
CC=$(type -p clang)
else
# gcc suite is the fall through
CC=$(type -p gcc)
fi
else
echo "CC was set externally to $CC"
fi

if [ -z "$CMAKE" ]; then
CMAKE=$(type -p cmake)
CMAKE=$(type -p cmake)
fi

# For debugging, handy to print what we're doing
Expand Down
15 changes: 12 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ jobs:
strategy:
matrix:
platform: [ c7-dev, c8-dev, u20-dev ]
compiler: [ gcc ]
include:
# On C8 we also test clang
- platform: c8-dev
compiler: clang

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand All @@ -32,8 +37,11 @@ jobs:
- name: Setup environment variables
run: |
echo "DIMAGE=hepsoftwarefoundation/$PLATFORM" >> $GITHUB_ENV
echo "PLATFORM=$PLATFORM" >> $GITHUB_ENV
echo "COMPILER=$COMPILER" >> $GITHUB_ENV
env:
PLATFORM: ${{ matrix.platform }}
COMPILER: ${{ matrix.compiler }}

# Pulls the associated Docker image
- name: Docker pull
Expand All @@ -42,15 +50,16 @@ jobs:
# Builds the code and runs the test
- name: Build and test
run: |
echo "Starting run for $PLATFORM, compiler suite $COMPILER"
if [[ "$DIMAGE" == *c7-dev ]];
then
docker run -e CMAKE=cmake3 -e CMAKE_EXTRA=$CMAKE_EXTRA -v $(pwd):/mnt $DIMAGE scl enable devtoolset-8 /mnt/.github/scripts/build-test.sh;
docker run -e PLATFORM -e COMPILER -e CMAKE=cmake3 -e CMAKE_EXTRA=$CMAKE_EXTRA -v $(pwd):/mnt $DIMAGE scl enable devtoolset-8 /mnt/.github/scripts/build-test.sh;
elif [[ "$DIMAGE" == *c8-dev ]];
then
docker run -v $(pwd):/mnt $DIMAGE /mnt/.github/scripts/build-test.sh;
docker run -e PLATFORM -e COMPILER -v $(pwd):/mnt $DIMAGE /mnt/.github/scripts/build-test.sh;
elif [[ "$DIMAGE" == *u20-dev ]];
then
docker run -e CXX=g++-9 -e CC=gcc-9 -v $(pwd):/mnt $DIMAGE /mnt/.github/scripts/build-test.sh;
docker run -e PLATFORM -e COMPILER -e CXX=g++-9 -e CC=gcc-9 -v $(pwd):/mnt $DIMAGE /mnt/.github/scripts/build-test.sh;
else
echo "Unkown Docker Image: $DIMAGE"
fi

0 comments on commit 0e8c9a3

Please sign in to comment.