full cmake 7/N: library #24
Workflow file for this run
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: BuildCM | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
build_repo: | |
strategy: | |
fail-fast: false | |
matrix: | |
build_type : [ Release, Debug ] | |
os : [ macos-latest, ubuntu-20.04 ] | |
include: | |
- os: ubuntu-20.04 | |
cxx: g++-10 | |
cc: gcc-10 | |
- os: macos-latest | |
cxx: clang++ | |
cc: clang | |
- build_type: Release | |
build_shared_libs: ON | |
- build_type: Debug | |
build_shared_libs: OFF | |
name: "Repo • ${{ matrix.os }}: ${{ matrix.cxx }} ${{ matrix.build_type }}" | |
runs-on: ${{ matrix.os }} | |
env: | |
CC: ${{ matrix.cc }} | |
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 }} | |
-DBUILD_SHARED_LIBS=${{ matrix.build_shared_libs }} | |
-DMPIEXEC_PREFLAGS='--bind-to;none;--allow-run-as-root' | |
-DCMAKE_INSTALL_PREFIX=${{github.workspace}}/build/library | |
-DWITH_MAX_AM=2;2 | |
-DWITH_ERI_MAX_AM=2;2 | |
-DWITH_ERI3_MAX_AM=3;2 | |
-DENABLE_ERI=1 | |
-DENABLE_ERI3=1 | |
-DENABLE_ONEBODY=1 | |
-DDISABLE_ONEBODY_PROPERTY_DERIVS=ON | |
-DMULTIPOLE_MAX_ORDER=2 | |
-DLIBINT2_ENABLE_PYTHON=ON | |
outputs: | |
should_skip: ${{ steps.skip_check.outputs.should_skip }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# fetch-depth: 0 for git history to compute version | |
- id: skip_check | |
name: Check if can skip | |
uses: fkirc/skip-duplicate-actions@v5 | |
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 ccache [email protected] numpy scipy | |
echo "FC=/usr/local/bin/gfortran-10" >> $GITHUB_ENV | |
echo "EIGEN3_INCLUDE_DIR=/usr/local/include/eigen3" >> $GITHUB_ENV | |
- name: Install prerequisite 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++-10 gfortran-10 liblapack-dev libboost-dev libeigen3-dev ccache python3-numpy python3-scipy | |
echo "FC=/usr/bin/gfortran-10" >> $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("\"timestamp=${current_date}\" >> $GITHUB_OUTPUT") | |
- name: Setup ccache cache files | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
uses: actions/cache@v3 | |
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 Libint generator | |
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: | | |
git describe --tags | |
cmake -S ../.. -B build $BUILD_CONFIG --log-level=DEBUG | |
cmake --build build --target check-libint2compiler | |
- name: Generate Libint export | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
shell: bash | |
working-directory: ${{github.workspace}}/build/compiler | |
run: | | |
cmake --build build --target export | |
cd build && echo "ARTIFACT=`ls -1 libint*tgz`" >> $GITHUB_ENV | |
- name: Archive Library Tarball | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' && matrix.build_type == 'Release'}} | |
uses: actions/upload-artifact@v3 | |
with: | |
if-no-files-found: error | |
name: ${{ runner.os }}-${{ matrix.cxx }} | |
path: ${{github.workspace}}/build/compiler/build/${{ env.ARTIFACT }} | |
retention-days: 1 | |
- name: Generate Libint library | |
if: ${{ steps.skip_check.outputs.should_skip != 'true' }} | |
shell: bash | |
working-directory: ${{github.workspace}}/build/compiler | |
run: | | |
cmake --build build --target library check-libint2 | |
cd build && echo "ARTIFACT=`ls -1 libint*tgz`" >> $GITHUB_ENV | |
#rm -rf buildcm/ && cmake -S. -Bbuildcm -GNinja -DEXPORT_COMPRESSOR=bzip2 -DWITH_MAX_AM="2;2" -DWITH_ERI_MAX_AM="2;2" -DWITH_ERI3_MAX_AM="3;2" -DENABLE_ERI=1 -DENABLE_ERI3=1 -DMULTIPOLE_MAX_ORDER=2 -DBUILD_SHARED_LIBS=ON && time cmake --build buildcm --target check-libint2 | |
build_export: | |
needs: build_repo | |
if: always() && (needs.build_repo.outputs.should_skip != 'true') | |
strategy: | |
fail-fast: false | |
matrix: | |
cfg: | |
- runs-on: ubuntu-latest | |
lane: ubuntu-gnu | |
libargs: > | |
-DBUILD_SHARED_LIBS=ON | |
testargs: "" | |
- runs-on: windows-latest | |
lane: windows-clang-cl | |
libargs: > | |
-GNinja | |
-DCMAKE_BUILD_TYPE=Release | |
-DBUILD_SHARED_LIBS=OFF | |
-DCMAKE_CXX_COMPILER=clang-cl | |
-DCMAKE_C_COMPILER=clang-cl | |
testargs: > | |
-GNinja | |
-DCMAKE_BUILD_TYPE=Release | |
-DCMAKE_CXX_COMPILER=clang-cl | |
-DCMAKE_C_COMPILER=clang-cl | |
- runs-on: macos-latest | |
lane: macos-clang | |
libargs: > | |
-DBUILD_SHARED_LIBS=ON | |
testargs: "" | |
- runs-on: ubuntu-latest | |
lane: ubuntu-intel | |
libargs: > | |
-DCMAKE_CXX_COMPILER=icpx | |
-DCMAKE_CXX_FLAGS="--gcc-toolchain=${CONDA_PREFIX} --sysroot=${CONDA_PREFIX}/${HOST}/sysroot -target ${HOST}" | |
testargs: > | |
-DCMAKE_CXX_COMPILER=icpx | |
-DCMAKE_CXX_FLAGS="--gcc-toolchain=${CONDA_PREFIX} --sysroot=${CONDA_PREFIX}/${HOST}/sysroot -target ${HOST}" | |
name: "Export • ${{ matrix.cfg.lane }}" | |
runs-on: ${{ matrix.cfg.runs-on }} | |
steps: | |
# Note we're not checking out the repo. All src from Linux tarball generated above. | |
- name: Write a Conda Env File | |
shell: bash -l {0} | |
run: | | |
cat > export.yaml <<EOF | |
name: test | |
channels: | |
- conda-forge | |
dependencies: | |
- cmake | |
- ninja | |
- cxx-compiler | |
- python | |
- boost | |
- eigen | |
- numpy | |
- scipy | |
- pybind11 | |
#- dpcpp_linux-64 | |
EOF | |
if [[ "${{ runner.os }}" == "Windows" ]]; then | |
sed -i "s/- cxx/#- cxx/g" export.yaml | |
fi | |
if [[ "${{ matrix.cfg.lane }}" == "ubuntu-intel" ]]; then | |
sed -i "s/#- dpcpp_linux-64/- dpcpp_linux-64/g" export.yaml | |
fi | |
cat export.yaml | |
- name: Create Conda Environment | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniforge-variant: Mambaforge | |
use-mamba: true | |
python-version: "3.9" | |
activate-environment: test | |
channels: conda-forge | |
environment-file: export.yaml | |
show-channel-urls: true | |
- name: Environment Information | |
shell: bash -l {0} | |
run: | | |
conda info | |
conda list | |
- name: Prepare compiler environment for Windows | |
if: ${{ runner.os == 'Windows' }} | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: x64 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: Linux-g++-10 | |
- name: Extract, Build, Install Libint Library | |
shell: bash -l {0} | |
run: | | |
tar -zxf libint*tgz | |
mkdir libint && mv libint-2*/* libint/ && cd libint/ | |
cmake \ | |
-S. \ | |
-Bbuild \ | |
-GNinja \ | |
-DCMAKE_INSTALL_PREFIX="${{github.workspace}}/installed" \ | |
-DCMAKE_CXX_COMPILER=${CXX} \ | |
-DLIBINT2_PYTHON=OFF \ | |
-DCMAKE_PREFIX_PATH="${CONDA_PREFIX}" \ | |
${{ matrix.cfg.libargs }} | |
cmake --build build --target install | |
- name: Test Libint library - unit tests | |
shell: bash -l {0} | |
working-directory: ${{github.workspace}}/libint/build | |
run: | | |
cmake --build . --target check | |