Merge pull request #268 from loriab/ci_pb11 #554
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: Linux/MacOS Build | |
on: [push, pull_request] | |
#env: | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
build_type : [ Release, Debug ] | |
os : [ macos-latest, ubuntu-20.04 ] | |
include: | |
- os: ubuntu-20.04 | |
cxx: /usr/bin/g++-9 | |
- os: macos-latest | |
cxx: clang++ | |
name: "${{ matrix.os }}: ${{ matrix.cxx }} ${{ matrix.build_type }}" | |
runs-on: ${{ matrix.os }} | |
env: | |
CXX : ${{ matrix.cxx }} | |
CCACHE_DIR : ${{github.workspace}}/build/.ccache | |
CCACHE_COMPRESS : true | |
CCACHE_COMPRESSLEVEL : 6 | |
BUILD_CONFIG : > | |
-G Ninja | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} | |
-DCMAKE_PREFIX_PATH=/usr/local/Cellar/eigen/3.3.9;/usr/local/opt/bison | |
-DBUILD_SHARED_LIBS=OFF | |
-DCMAKE_POSITION_INDEPENDENT_CODE=ON | |
-DMPIEXEC_PREFLAGS='--bind-to;none;--allow-run-as-root' | |
-DENABLE_FORTRAN=ON | |
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/library/install | |
outputs: | |
should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
steps: | |
- uses: actions/checkout@v2 | |
- id: skip_check | |
name: Check if can skip | |
uses: fkirc/[email protected] | |
with: | |
cancel_others: 'true' | |
- name: Create Build Environment | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
# Some projects don't allow in-source building, so create a separate build directory | |
# We'll use this as our working directory for all subsequent commands | |
run: | | |
cmake -E make_directory ${{github.workspace}}/build/compiler | |
cmake -E make_directory ${{github.workspace}}/build/library | |
cmake -E make_directory ${{github.workspace}}/build/library_test | |
- name: Install prerequisite MacOS packages | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.os == 'macos-latest' }} | |
run: | | |
brew install ninja gcc@10 boost eigen bison ccache automake python3 numpy scipy | |
echo "FC=/usr/local/bin/gfortran-10" >> $GITHUB_ENV | |
echo "EIGEN3_INCLUDE_DIR=/usr/local/include/eigen3" >> $GITHUB_ENV | |
- name: Install prerequisites Ubuntu packages | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.os == 'ubuntu-20.04' }} | |
run: | | |
sudo apt-get update | |
sudo apt-get install ninja-build g++-9 gfortran-9 liblapack-dev libboost-dev libeigen3-dev ccache python3-numpy python3-scipy | |
echo "FC=/usr/bin/gfortran-9" >> $GITHUB_ENV | |
echo "EIGEN3_INCLUDE_DIR=/usr/include/eigen3" >> $GITHUB_ENV | |
- name: Prepare ccache timestamp | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
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: Setup ccache cache files | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
uses: actions/[email protected] | |
with: | |
path: ${{github.workspace}}/build/.ccache | |
key: ${{ matrix.config.name }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} | |
restore-keys: | | |
${{ matrix.config.name }}-ccache- | |
- name: Generate configure script | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
shell: bash | |
working-directory: ${{github.workspace}} | |
run: ./autogen.sh && ls -l ${{github.workspace}}/configure | |
- name: Generate Libint library | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
# Use a bash shell so we can use the same syntax for environment variable | |
# access regardless of the host operating system | |
shell: bash | |
working-directory: ${{github.workspace}}/build/compiler | |
run: | | |
CPPFLAGS="-I$EIGEN3_INCLUDE_DIR" CXXFLAGS="-std=c++11 -Wno-enum-compare" ${{github.workspace}}/configure --with-max-am=2,2 --with-eri-max-am=2,2 --with-eri3-max-am=3,2 --enable-eri=1 --enable-eri3=1 --enable-1body=1 --disable-1body-property-derivs --with-multipole-max-order=2 | |
make -j3 | |
make check | |
cd src/bin/test_eri && ./stdtests.pl && cd ../../.. | |
make export | |
- name: Build+test+install Libint library | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
shell: bash | |
working-directory: ${{github.workspace}}/build/library | |
run: | | |
tar -xzf ../compiler/libint-2*.tgz | |
cd libint-2* | |
echo "LIBINT_EXPORTED_DIR=`pwd`" >> $GITHUB_ENV | |
cmake -S . -B build -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DPYTHON_EXECUTABLE=`which python3` $BUILD_CONFIG | |
cmake --build build --target check | |
cmake --build build --target install | |
- name: Test installed Libint library | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
shell: bash | |
working-directory: ${{github.workspace}}/build/library_test | |
run: | | |
cat > CMakeLists.txt <<EOF | |
cmake_minimum_required(VERSION 3.8) | |
project(hf++) | |
find_package(Libint2 2.8.0 REQUIRED) | |
find_package(Threads) # clang does not autolink threads even though we are using std::thread | |
add_executable(hf++ EXCLUDE_FROM_ALL $LIBINT_EXPORTED_DIR/tests/hartree-fock/hartree-fock++.cc) | |
target_link_libraries(hf++ Libint2::cxx Threads::Threads) | |
EOF | |
cmake . -DCMAKE_PREFIX_PATH=${{github.workspace}}/build/library/install -DCMAKE_BUILD_TYPE=$BUILD_TYPE | |
cmake --build . --target hf++ | |
./hf++ $LIBINT_EXPORTED_DIR/tests/hartree-fock/h2o_rotated.xyz | python $LIBINT_EXPORTED_DIR/tests/hartree-fock/hartree-fock++-validate.py $LIBINT_EXPORTED_DIR/MakeVars.features | |
- name: Build Python bindings | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
shell: bash | |
working-directory: ${{github.workspace}}/build/library | |
run: | | |
cd libint-2* | |
cd build | |
cmake . -DLIBINT2_PYTHON=ON | |
cmake --build . --target libint2-python | |
cmake --build . --target libint2-python-test | |