Merge pull request #2088 from wsfulton/actions-gcc11

Github Actions enhancements.

Adds gcc-11 testing.
Refactor Github Actions by breaking up into more steps (Install Dependencies, Configure, Build, Test, Install SWIG).
Fix Octave test
This commit is contained in:
William S Fulton 2021-10-18 10:15:41 +01:00 committed by GitHub
commit bfdbcdcf1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 76 additions and 40 deletions

View file

@ -41,6 +41,9 @@ jobs:
- SWIGLANG: ""
GCC: 10
desc: gcc10
- SWIGLANG: ""
GCC: 11
desc: gcc11
- SWIGLANG: ""
compiler: clang
desc: clang
@ -192,13 +195,32 @@ jobs:
with:
key: ${{ matrix.os || 'ubuntu-20.04' }}-${{ matrix.compiler || 'gcc' }}${{ matrix.GCC }}
- name: Configure
- name: Install Dependencies
run: |
set -x
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
echo PATH="$PATH" >> $GITHUB_ENV
source Tools/GHA-linux-install.sh
source $GITHUB_WORKSPACE/Tools/GHA-linux-install.sh
echo WITHLANG="$WITHLANG" >> $GITHUB_ENV
case $(uname) in
Linux)
cpu_count=$(nproc)
;;
Darwin)
cpu_count=$(sysctl -n hw.ncpu)
;;
*)
cpu_count=1
;;
esac
if [[ $cpu_count != 1 ]]; then
echo SWIGJOBS=-j$cpu_count >> $GITHUB_ENV
fi
if test '${{ matrix.compiler }}' = 'clang'; then
CC="clang"
@ -219,11 +241,15 @@ jobs:
echo CC="$CC" >> $GITHUB_ENV
echo CXX="$CXX" >> $GITHUB_ENV
echo "Compiler used:"
ls -la $(which $CC) $(which $CXX)
$CC --version
$CXX --version
- name: Configure
run: |
set -x
source $GITHUB_WORKSPACE/Tools/CI-linux-environment.sh
if test -n '${{ matrix.CONFIGOPTS }}'; then
CONFIGOPTS=${{ matrix.CONFIGOPTS }}
fi
@ -234,46 +260,30 @@ jobs:
echo "${CONFIGOPTS[@]}"
./autogen.sh && mkdir -p build/build && cd build/build && ../../configure "${CONFIGOPTS[@]}"
case $(uname) in
Linux)
cpu_count=$(nproc)
;;
Darwin)
cpu_count=$(sysctl -n hw.ncpu)
;;
*)
cpu_count=1
;;
esac
if [[ $cpu_count != 1 ]]; then
echo SWIGJOBS=-j$cpu_count >> $GITHUB_ENV
fi
- name: Build
working-directory: build/build
run: |
set -x
make $SWIGJOBS
make -s $SWIGJOBS
./swig -version && ./swig -pcreversion
if test -z "$SWIGLANG"; then make $SWIGJOBS check-ccache; fi
if test -z "$SWIGLANG"; then make $SWIGJOBS check-errors-test-suite; fi
echo 'Installing...'
if test -z "$SWIGLANG"; then sudo make install && swig -version && ccache-swig -V; fi
- name: Test
working-directory: build/build
run: |
set -x
source $GITHUB_WORKSPACE/Tools/CI-linux-environment.sh
if test -n "$CPP11"; then export CPPSTD=c++11; fi
if test -n "$CPP14"; then export CPPSTD=c++14; fi
if test -n "$CPP17"; then export CPPSTD=c++17; fi
if test -z "$SWIGLANG"; then make $SWIGJOBS check-ccache; fi
if test -z "$SWIGLANG"; then make $SWIGJOBS check-errors-test-suite; fi
case "$SWIGLANG" in
javascript)
case "$ENGINE" in
node)
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
nvm use ${VER}
;;
*)
v8 | jsc)
# Running tests using v8 or jsc involves creating a custom
# interpreter in Tools/javascript, which is currently broken
# for parallel builds (we attempt to update this interpreter
@ -281,16 +291,8 @@ jobs:
unset SWIGJOBS
esac
;;
ruby)
source $HOME/.rvm/scripts/rvm
;;
esac
set -x
if test -n "$CPP11"; then export CPPSTD=c++11; fi
if test -n "$CPP14"; then export CPPSTD=c++14; fi
if test -n "$CPP17"; then export CPPSTD=c++17; fi
# Stricter compile flags for examples. Various headers and SWIG generated code prevents full use of -pedantic.
if test -n "$SWIGLANG"; then cflags=$($GITHUB_WORKSPACE/Tools/testflags.py --language $SWIGLANG --cflags --std=$CSTD --compiler=$CC) && echo $cflags; fi
if test -n "$SWIGLANG"; then cxxflags=$($GITHUB_WORKSPACE/Tools/testflags.py --language $SWIGLANG --cxxflags --std=$CPPSTD --compiler=$CC) && echo $cxxflags; fi
@ -299,6 +301,12 @@ jobs:
if test -n "$SWIGLANG"; then make $SWIGJOBS check-$SWIGLANG-examples CFLAGS="$cflags" CXXFLAGS="$cxxflags"; fi
if test -n "$SWIGLANG"; then make $SWIGJOBS check-$SWIGLANG-test-suite CFLAGS="$cflags" CXXFLAGS="$cxxflags"; fi
- name: Install
working-directory: build/build
run: |
set -x
if test -z "$SWIGLANG"; then sudo make install && swig -version && ccache-swig -V; fi
- name: Clean
working-directory: build/build
run: |

View file

@ -0,0 +1,27 @@
#!/bin/bash
# Expected to be called from elsewhere with same variables set as CI-linux-install.sh
# e.g. RETRY=travis-retry SWIGLANG=python
# Sets up environment for using various target languages
# For Github Actions where the environment is not preserved between steps
set -e # exit on failure (same as -o errexit)
case "$SWIGLANG" in
"javascript")
case "$ENGINE" in
"node")
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && source "$NVM_DIR/nvm.sh"
nvm use ${VER}
;;
*) ;;
esac
;;
"ruby")
if ! command -v rvm; then
set +x
source $HOME/.rvm/scripts/rvm
set -x
fi
;;
*) ;;
esac

View file

@ -1,5 +1,5 @@
#!/bin/bash
# expected to be called from elsewhere with certain variables set
# Expected to be called from elsewhere with certain variables set
# e.g. RETRY=travis-retry SWIGLANG=python GCC=7
set -e # exit on failure (same as -o errexit)
@ -73,6 +73,7 @@ case "$SWIGLANG" in
$RETRY sudo apt-get -qq install ocaml camlp4
;;
"octave")
$RETRY sudo apt-get -qq update
$RETRY sudo apt-get -qq install liboctave-dev
;;
"php")