Merge pull request #71 from OptimalDesignLab/miso-merge #373
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: MISO Tests | |
on: [push] | |
env: | |
CMAKE_VERSION: 3.21.1 | |
NINJA_VERSION: 1.10.2 | |
CCACHE_VERSION: 4.4 | |
jobs: | |
build: | |
name: ${{ matrix.config.name }} | |
runs-on: ${{ matrix.config.os }} | |
env: | |
BUILD_TYPE: ${{ matrix.config.buildtype }} | |
BUILD_FLAGS: ${{ matrix.config.buildflags}} | |
TEST_FLAGS: ${{ matrix.config.testflags}} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- { | |
name: "Ubuntu Latest GCC (Release)", artifact: "Linux.tar.xz", | |
os: ubuntu-latest, | |
cc: "gcc", cxx: "g++", | |
buildtype: "Release", | |
buildflags: "-fno-openmp", | |
testflags: "" | |
} | |
- { | |
name: "Ubuntu Latest GCC (Debug)", artifact: "Linux.tar.xz", | |
os: ubuntu-latest, | |
cc: "gcc", cxx: "g++", | |
buildtype: "Debug", | |
buildflags: "-fno-openmp", | |
testflags: "" | |
} | |
- { | |
name: "Ubuntu Latest Clang (Debug)", artifact: "Linux.tar.xz", | |
os: ubuntu-22.04, | |
cc: "clang", cxx: "clang++", | |
buildtype: "Debug", | |
buildflags: "-fno-openmp", | |
testflags: "" | |
} | |
steps: | |
- name: Download Ninja | |
id: cmake_and_ninja | |
shell: cmake -P {0} | |
run: | | |
set(cmake_version $ENV{CMAKE_VERSION}) | |
set(ninja_version $ENV{NINJA_VERSION}) | |
message(STATUS "Using host CMake version: ${CMAKE_VERSION}") | |
if ("${{ runner.os }}" STREQUAL "Linux") | |
set(ninja_suffix "linux.zip") | |
set(cmake_suffix "linux-x86_64.tar.gz") | |
set(cmake_dir "cmake-${cmake_version}-linux-x86_64/bin") | |
elseif ("${{ runner.os }}" STREQUAL "macOS") | |
set(ninja_suffix "mac.zip") | |
set(cmake_suffix "macos-universal.tar.gz") | |
set(cmake_dir "cmake-${cmake_version}-macos-universal/CMake.app/Contents/bin") | |
endif() | |
set(ninja_url "https://github.com/ninja-build/ninja/releases/download/v${ninja_version}/ninja-${ninja_suffix}") | |
file(DOWNLOAD "${ninja_url}" ./ninja.zip SHOW_PROGRESS) | |
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./ninja.zip) | |
set(cmake_url "https://github.com/Kitware/CMake/releases/download/v${cmake_version}/cmake-${cmake_version}-${cmake_suffix}") | |
file(DOWNLOAD "${cmake_url}" ./cmake.zip SHOW_PROGRESS) | |
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xvf ./cmake.zip) | |
# Add to PATH environment variable | |
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}/${cmake_dir}" cmake_dir) | |
set(path_separator ":") | |
file(APPEND "$ENV{GITHUB_PATH}" "$ENV{GITHUB_WORKSPACE}${path_separator}${cmake_dir}") | |
execute_process( | |
COMMAND chmod +x ninja | |
COMMAND chmod +x ${cmake_dir}/cmake | |
) | |
- name: Download OpenMPI | |
id: openmpi | |
run: sudo apt-get install openmpi-bin openmpi-common openmpi-doc libopenmpi-dev | |
- name: Download Metis | |
id: metis | |
run: brew install metis | |
# run: sudo apt-get install metis libmetis-dev | |
- name: Download ccache | |
id: ccache | |
# run: sudo apt-get install ccache | |
run: brew install ccache | |
- name: Prepare ccache timestamp | |
id: ccache_cache_timestamp | |
shell: cmake -P {0} | |
run: | | |
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) | |
message("::set-output name=timestamp::${current_date}") | |
- name: ccache cache files | |
uses: actions/[email protected] | |
with: | |
path: .ccache | |
key: ${{ matrix.config.name }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} | |
restore-keys: | | |
${{ matrix.config.name }}-ccache- | |
- name: Download Adept | |
uses: actions/checkout@v2 | |
with: | |
repository: 'rjhogan/Adept-2' | |
path: .deps/adept | |
- name: Configure Adept | |
run: | | |
cd ${GITHUB_WORKSPACE}/.deps/adept/ | |
autoreconf -i | |
./configure --prefix="${GITHUB_WORKSPACE}/.deps/adept/install" \ | |
--with-blas=blas \ | |
--with-lapack=lapack \ | |
--disable-openmp \ | |
CC="ccache ${{matrix.config.cc}}" \ | |
CXX="ccache ${{matrix.config.cxx}}" \ | |
- name: Build Adept | |
run: | | |
cd ${GITHUB_WORKSPACE}/.deps/adept/ | |
CC="ccache ${{matrix.config.cc}}" CXX="ccache ${{matrix.config.cxx}}" make -j 2 | |
# CC="ccache ${{matrix.config.cc}}" CXX="ccache ${{matrix.config.cxx}}" make check | |
make install | |
- name: Download Hypre | |
uses: actions/checkout@v2 | |
with: | |
repository: 'hypre-space/hypre' | |
ref: 'v2.20.0' | |
path: .deps/hypre | |
- name: Create Hypre Build Environment | |
run: cmake -E make_directory ${GITHUB_WORKSPACE}/.deps/hypre/src/build | |
- name: Configure Hypre | |
shell: cmake -P {0} | |
run: | | |
set(ENV{CC} ${{ matrix.config.cc }}) | |
set(ENV{CXX} ${{ matrix.config.cxx }}) | |
set(path_separator ":") | |
set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}") | |
execute_process( | |
COMMAND cmake | |
-S $ENV{GITHUB_WORKSPACE}/.deps/hypre/src | |
-B $ENV{GITHUB_WORKSPACE}/.deps/hypre/src/build | |
-D CMAKE_BUILD_TYPE=$ENV{BUILD_TYPE} | |
-G Ninja | |
-D CMAKE_MAKE_PROGRAM=ninja | |
-D CMAKE_C_COMPILER_LAUNCHER=ccache | |
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache | |
-D CMAKE_POSITION_INDEPENDENT_CODE=ON | |
-D CMAKE_INSTALL_PREFIX=$ENV{GITHUB_WORKSPACE}/.deps/hypre | |
RESULT_VARIABLE result | |
) | |
if (NOT result EQUAL 0) | |
message(FATAL_ERROR "Bad exit status") | |
endif() | |
- name: Build Hypre | |
shell: cmake -P {0} | |
run: | | |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ") | |
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}" ccache_basedir) | |
set(ENV{CCACHE_BASEDIR} "${ccache_basedir}") | |
set(ENV{CCACHE_DIR} "${ccache_basedir}/.ccache") | |
set(ENV{CCACHE_COMPRESS} "true") | |
set(ENV{CCACHE_COMPRESSLEVEL} "6") | |
set(ENV{CCACHE_MAXSIZE} "1000M") | |
if ("${{ matrix.config.cxx }}" STREQUAL "cl") | |
set(ENV{CCACHE_MAXSIZE} "1000M") | |
endif() | |
execute_process(COMMAND ccache -p) | |
execute_process(COMMAND ccache -z) | |
execute_process( | |
COMMAND cmake --build $ENV{GITHUB_WORKSPACE}/.deps/hypre/src/build | |
RESULT_VARIABLE result | |
OUTPUT_VARIABLE output | |
ERROR_VARIABLE output | |
ECHO_OUTPUT_VARIABLE ECHO_ERROR_VARIABLE | |
) | |
if (NOT result EQUAL 0) | |
string(REGEX MATCH "FAILED:.*$" error_message "${output}") | |
string(REPLACE "\n" "%0A" error_message "${error_message}") | |
message("::error::${error_message}") | |
message(FATAL_ERROR "Build failed") | |
endif() | |
- name: Install Hypre | |
run: cmake --build ${GITHUB_WORKSPACE}/.deps/hypre/src/build --config $BUILD_TYPE --target install | |
- name: Download MFEM | |
uses: actions/checkout@v2 | |
with: | |
repository: 'mfem/mfem' | |
ref: 'odl' | |
path: .deps/mfem | |
- name: Create MFEM Build Environment | |
run: cmake -E make_directory ${GITHUB_WORKSPACE}/.deps/mfem/build | |
- name: Configure MFEM | |
shell: cmake -P {0} | |
run: | | |
set(ENV{CC} ${{ matrix.config.cc }}) | |
set(ENV{CXX} ${{ matrix.config.cxx }}) | |
set(path_separator ":") | |
set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}") | |
execute_process( | |
COMMAND brew --prefix metis | |
OUTPUT_VARIABLE metis-dir | |
) | |
execute_process( | |
COMMAND cmake | |
-S $ENV{GITHUB_WORKSPACE}/.deps/mfem/ | |
-B $ENV{GITHUB_WORKSPACE}/.deps/mfem/build | |
-D CMAKE_BUILD_TYPE=$ENV{BUILD_TYPE} | |
-G Ninja | |
-D CMAKE_MAKE_PROGRAM=ninja | |
-D CMAKE_C_COMPILER_LAUNCHER=ccache | |
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache | |
-D CMAKE_POSITION_INDEPENDENT_CODE=ON | |
-D MFEM_USE_MPI=YES | |
-D MFEM_USE_METIS_5=YES | |
-D HYPRE_DIR=$ENV{GITHUB_WORKSPACE}/.deps/hypre | |
-D METIS_DIR=/home/linuxbrew/.linuxbrew/opt/metis | |
-D MFEM_ENABLE_EXAMPLES=NO | |
-D MFEM_ENABLE_MINIAPPS=NO | |
RESULT_VARIABLE result | |
) | |
if (NOT result EQUAL 0) | |
message(FATAL_ERROR "Bad exit status") | |
endif() | |
- name: Build MFEM | |
shell: cmake -P {0} | |
run: | | |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ") | |
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}" ccache_basedir) | |
set(ENV{CCACHE_BASEDIR} "${ccache_basedir}") | |
set(ENV{CCACHE_DIR} "${ccache_basedir}/.ccache") | |
set(ENV{CCACHE_COMPRESS} "true") | |
set(ENV{CCACHE_COMPRESSLEVEL} "6") | |
set(ENV{CCACHE_MAXSIZE} "1000M") | |
if ("${{ matrix.config.cxx }}" STREQUAL "cl") | |
set(ENV{CCACHE_MAXSIZE} "1000M") | |
endif() | |
execute_process( | |
COMMAND cmake --build $ENV{GITHUB_WORKSPACE}/.deps/mfem/build | |
RESULT_VARIABLE result | |
OUTPUT_VARIABLE output | |
ERROR_VARIABLE output | |
ECHO_OUTPUT_VARIABLE ECHO_ERROR_VARIABLE | |
) | |
if (NOT result EQUAL 0) | |
string(REGEX MATCH "FAILED:.*$" error_message "${output}") | |
string(REPLACE "\n" "%0A" error_message "${error_message}") | |
message("::error::${error_message}") | |
message(FATAL_ERROR "Build failed") | |
endif() | |
- name: Clone MISO | |
uses: actions/checkout@v2 | |
with: | |
path: miso | |
- name: Create MISO Build Environment | |
run: cmake -E make_directory ${GITHUB_WORKSPACE}/miso/build | |
- name: Configure MISO | |
shell: cmake -P {0} | |
run: | | |
set(ENV{CC} ${{ matrix.config.cc }}) | |
set(ENV{CXX} ${{ matrix.config.cxx }}) | |
set(path_separator ":") | |
set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}") | |
execute_process( | |
COMMAND cmake | |
-S miso | |
-B miso/build | |
-D CMAKE_BUILD_TYPE=$ENV{BUILD_TYPE} | |
-G Ninja | |
-D CMAKE_MAKE_PROGRAM=ninja | |
-D CMAKE_C_COMPILER_LAUNCHER=ccache | |
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache | |
-D CMAKE_POSITION_INDEPENDENT_CODE=ON | |
-D CMAKE_CXX_FLAGS="$ENV{BUILD_FLAGS}" | |
-D Adept_ROOT=$ENV{GITHUB_WORKSPACE}/.deps/adept/install | |
-D MFEM_DIR=$ENV{GITHUB_WORKSPACE}/.deps/mfem/build | |
RESULT_VARIABLE result | |
) | |
if (NOT result EQUAL 0) | |
message(FATAL_ERROR "Bad exit status") | |
endif() | |
- name: Build MISO | |
shell: cmake -P {0} | |
run: | | |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ") | |
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}" ccache_basedir) | |
set(ENV{CCACHE_BASEDIR} "${ccache_basedir}") | |
set(ENV{CCACHE_DIR} "${ccache_basedir}/.ccache") | |
set(ENV{CCACHE_COMPRESS} "true") | |
set(ENV{CCACHE_COMPRESSLEVEL} "6") | |
set(ENV{CCACHE_MAXSIZE} "1000M") | |
if ("${{ matrix.config.cxx }}" STREQUAL "cl") | |
set(ENV{CCACHE_MAXSIZE} "1000M") | |
endif() | |
# execute_process(COMMAND ccache -p) | |
# execute_process(COMMAND ccache -z) | |
execute_process( | |
COMMAND cmake --build miso/build | |
RESULT_VARIABLE result | |
OUTPUT_VARIABLE output | |
ERROR_VARIABLE output | |
ECHO_OUTPUT_VARIABLE ECHO_ERROR_VARIABLE | |
) | |
if (NOT result EQUAL 0) | |
string(REGEX MATCH "FAILED:.*$" error_message "${output}") | |
string(REPLACE "\n" "%0A" error_message "${error_message}") | |
message("::error::${error_message}") | |
message(FATAL_ERROR "Build failed") | |
endif() | |
- name: Build MISO Tests | |
shell: cmake -P {0} | |
run: | | |
set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ") | |
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}" ccache_basedir) | |
set(ENV{CCACHE_BASEDIR} "${ccache_basedir}") | |
set(ENV{CCACHE_DIR} "${ccache_basedir}/.ccache") | |
set(ENV{CCACHE_COMPRESS} "true") | |
set(ENV{CCACHE_COMPRESSLEVEL} "6") | |
set(ENV{CCACHE_MAXSIZE} "1000M") | |
if ("${{ matrix.config.cxx }}" STREQUAL "cl") | |
set(ENV{CCACHE_MAXSIZE} "1000M") | |
endif() | |
# execute_process(COMMAND ccache -p) | |
# execute_process(COMMAND ccache -z) | |
execute_process( | |
COMMAND cmake --build miso/build --target build_tests | |
RESULT_VARIABLE result | |
OUTPUT_VARIABLE output | |
ERROR_VARIABLE output | |
ECHO_OUTPUT_VARIABLE ECHO_ERROR_VARIABLE | |
) | |
if (NOT result EQUAL 0) | |
string(REGEX MATCH "FAILED:.*$" error_message "${output}") | |
string(REPLACE "\n" "%0A" error_message "${error_message}") | |
message("::error::${error_message}") | |
message(FATAL_ERROR "Build failed") | |
endif() | |
- name: Test MISO | |
working-directory: miso/build | |
shell: bash | |
run: ctest --output-on-failure | |
- name: ccache statistics | |
shell: cmake -P {0} | |
run: | | |
file(TO_CMAKE_PATH "$ENV{GITHUB_WORKSPACE}" ccache_basedir) | |
set(ENV{CCACHE_BASEDIR} "${ccache_basedir}") | |
set(ENV{CCACHE_DIR} "${ccache_basedir}/.ccache") | |
execute_process(COMMAND ccache -s) |