Improve import manipulation of Fortran files #110
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: CI | |
on: [push, pull_request] | |
env: | |
CI: "ON" | |
HOMEBREW_NO_ANALYTICS: "ON" | |
HOMEBREW_NO_AUTO_UPDATE: "ON" | |
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON" | |
HOMEBREW_NO_GITHUB_API: "ON" | |
HOMEBREW_NO_INSTALL_CLEANUP: "ON" | |
BUILD_DIR: _build | |
CMAKE_OPTIONS: >- | |
-DWITH_API=true | |
-DWITH_SDFTD3=true | |
-DWITH_TBLITE=true | |
-DWITH_MBD=true | |
-DWITH_TRANSPORT=true | |
-DFYPP_FLAGS='-n;-DTRAVIS' | |
-DWITH_UNIT_TESTS=true | |
-DWITH_CHIMES=true | |
-DWITH_PYTHON=true | |
jobs: | |
gcc-build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
mpi: [nompi, openmpi] | |
config: [Debug] | |
version: [11] | |
include: | |
- os: ubuntu-latest | |
mpi: nompi | |
config: Coverage | |
version: 11 | |
exclude: | |
- os: macos-latest | |
mpi: openmpi | |
config: Debug | |
version: 11 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
# Note: xcode version 14.0 (default on macos-latest @ 2022-11-23) fails to link gfortran compiled | |
# code. Therefore, 14.1 is selected below (which seems to be installed.) | |
- name: Install GCC (OSX) | |
if: ${{ contains(matrix.os, 'macos') }} | |
run: | | |
brew install gcc@${{ matrix.version }} openblas pkg-config | |
ln -s /usr/local/bin/gfortran-${{ matrix.version }} /usr/local/bin/gfortran | |
ln -s /usr/local/bin/gcc-${{ matrix.version }} /usr/local/bin/gcc | |
ln -s /usr/local/bin/g++-${{ matrix.version }} /usr/local/bin/g++ | |
echo "PKG_CONFIG_PATH=/usr/local/opt/openblas/lib/pkgconfig" >> $GITHUB_ENV | |
xcversion select 14.1 | |
- name: Install GCC (Linux) | |
if: ${{ contains(matrix.os, 'ubuntu') }} | |
run: | | |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test | |
sudo apt-get update | |
sudo apt-get install -y gcc-${{ matrix.version}} gfortran-${{ matrix.version }} g++-${{ matrix.version }} | |
sudo update-alternatives \ | |
--install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.version }} 100 \ | |
--slave /usr/bin/gfortran gfortran /usr/bin/gfortran-${{ matrix.version }} \ | |
--slave /usr/bin/g++ g++ /usr/bin/g++-${{ matrix.version }} \ | |
--slave /usr/bin/gcov gcov /usr/bin/gcov-${{ matrix.version }} | |
- name: Enable MPI build | |
if: contains(matrix.mpi, 'openmpi') || contains(matrix.mpi, 'mpich') | |
run: echo "WITH_MPI=true" >> $GITHUB_ENV | |
- name: Disable MPI build | |
if: contains(matrix.mpi, 'nompi') | |
run: echo "WITH_MPI=false" >> $GITHUB_ENV | |
- name: Set Compiler (Linux) | |
if: contains(matrix.os, 'ubuntu') | |
run: | | |
echo "FC=gfortran" >> $GITHUB_ENV | |
echo "CC=gcc" >> $GITHUB_ENV | |
echo "CXX=g++" >> $GITHUB_ENV | |
- name: Set Compiler (OSX) | |
if: contains(matrix.os, 'macos') | |
run: | | |
echo "FC=gfortran-${{ matrix.version }}" >> $GITHUB_ENV | |
echo "CC=gcc-${{ matrix.version }}" >> $GITHUB_ENV | |
echo "CXX=g++-${{ matrix.version }}" >> $GITHUB_ENV | |
- name: Check submodule commits | |
run: ./utils/test/check_submodule_commits | |
- name: Install ARPACK (Linux) | |
if: contains(matrix.os, 'ubuntu') && contains(matrix.mpi, 'nompi') | |
run: | | |
sudo apt-get install libarpack2-dev | |
echo "CMAKE_OPTIONS=${CMAKE_OPTIONS} -DWITH_ARPACK=true" >> $GITHUB_ENV | |
- name: Install OpenMPI (OSX) | |
if: contains(matrix.os, 'macos') && contains(matrix.mpi, 'openmpi') | |
run: | | |
brew install open-mpi scalapack | |
- name: Install OpenMPI (Linux) | |
if: contains(matrix.os, 'ubuntu') && contains(matrix.mpi, 'openmpi') | |
run: | | |
sudo apt-get update | |
sudo apt-get install libopenmpi-dev libscalapack-openmpi-dev | |
echo "CMAKE_OPTIONS=${CMAKE_OPTIONS} -DSCALAPACK_LIBRARY='scalapack-openmpi'" >> $GITHUB_ENV | |
echo "CMAKE_DEP_OPTIONS=-DSCALAPACK_LIBRARY='scalapack-openmpi'" >> $GITHUB_ENV | |
- name: Install MPICH (Linux) | |
if: contains(matrix.os, 'ubuntu') && contains(matrix.mpi, 'mpich') | |
run: | | |
sudo apt-get update | |
sudo apt-get install mpich libscalapack-mpich-dev | |
echo "CMAKE_OPTIONS=${CMAKE_OPTIONS} -DSCALAPACK_LIBRARY='scalapack-mpich'" >> $GITHUB_ENV | |
echo "CMAKE_DEP_OPTIONS=-DSCALAPACK_LIBRARY='scalapack-mpich'" >> $GITHUB_ENV | |
- name: Install cmake | |
run: pip3 install cmake ninja fypp numpy | |
- name: Get external dependencies | |
run: echo "y" | ./utils/get_opt_externals ALL | |
- name: Set extra CMake flags (Linux) | |
if: contains(matrix.os, 'ubuntu') | |
run: | | |
echo "CMAKE_OPTIONS=${CMAKE_OPTIONS} -DENABLE_DYNAMIC_LOADING=true" >> $GITHUB_ENV | |
- name: Configure build | |
run: >- | |
cmake -B _build -G Ninja | |
-DCMAKE_INSTALL_PREFIX=${PWD}/_install | |
-DCMAKE_BUILD_TYPE=${{ matrix.config }} | |
${CMAKE_OPTIONS} | |
-DWITH_MPI=${WITH_MPI} | |
- name: Build project | |
run: cmake --build ${BUILD_DIR} | |
- name: Run regression tests | |
run: | | |
pushd ${BUILD_DIR} | |
ctest -j 2 --output-on-failure | |
popd | |
- name: Install project | |
run: | | |
cmake --install ${BUILD_DIR} | |
- name: Create gcov reports | |
if: contains(matrix.config, 'Coverage') | |
run: ./utils/test/make_gcov_reports ${PWD} ${PWD}/_build/gcovs ${PWD}/_build/src ${PWD}/_build/app | |
- name: Upload coverage report | |
if: contains(matrix.config, 'Coverage') | |
uses: codecov/codecov-action@v1 | |
with: | |
directory: _build/gcovs | |
functionalities: gcov | |
- name: Run integration CMake test | |
run: >- | |
CMAKE_PREFIX_PATH="${PWD}/_install:${CMAKE_PREFIX_PATH}" | |
./test/src/dftbp/integration/cmake/runtest.sh ${BUILD_DIR}_cmake | |
${CMAKE_DEP_OPTIONS} | |
- name: Run integration pkg-config test | |
run: >- | |
PKG_CONFIG_PATH="${PWD}/_install/lib/pkgconfig:${PKG_CONFIG_PATH}" | |
./test/src/dftbp/integration/pkgconfig/runtest.sh ${BUILD_DIR}_pkgconfig | |
intel-build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
fc: [ifx] | |
cc: [icx] | |
env: | |
FC: ${{ matrix.fc }} | |
CC: ${{ matrix.cc }} | |
WITH_MPI: false | |
APT_PACKAGES: >- | |
intel-oneapi-compiler-fortran | |
intel-oneapi-compiler-dpcpp-cpp | |
intel-oneapi-mkl | |
intel-oneapi-mkl-devel | |
CMAKE_OPTIONS: >- | |
-DCMAKE_BUILD_TYPE=RelWithDebInfo | |
-DWITH_API=true | |
-DWITH_SDFTD3=true | |
-DWITH_MBD=true | |
-DWITH_TRANSPORT=true | |
-DFYPP_FLAGS='-DTRAVIS' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.x | |
- name: Add Intel repository | |
if: contains(matrix.os, 'ubuntu') | |
run: | | |
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null | |
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list | |
sudo apt-get update | |
- name: Install Intel oneAPI compiler | |
if: contains(matrix.os, 'ubuntu') | |
run: | | |
sudo apt-get update | |
sudo apt-get install ${APT_PACKAGES} | |
source /opt/intel/oneapi/setvars.sh | |
printenv >> $GITHUB_ENV | |
- name: Install cmake | |
run: pip3 install cmake ninja fypp numpy | |
- name: Get external dependencies | |
run: echo "y" | ./utils/get_opt_externals ALL | |
- name: Set extra CMake flags (Linux) | |
run: | | |
echo "CMAKE_OPTIONS=${CMAKE_OPTIONS} -DBUILD_SHARED_LIBS=true -DENABLE_DYNAMIC_LOADING=true" >> $GITHUB_ENV | |
- name: Configure build | |
run: >- | |
cmake -B _build -G Ninja | |
-DCMAKE_INSTALL_PREFIX=${PWD}/_install | |
-DCMAKE_BUILD_TYPE=Debug | |
${CMAKE_OPTIONS} | |
-DWITH_MPI=${WITH_MPI} | |
- name: Build project | |
run: cmake --build ${BUILD_DIR} | |
- name: Run regression tests | |
run: | | |
pushd ${BUILD_DIR} | |
ctest -j 2 --output-on-failure | |
popd | |
- name: Install project | |
run: | | |
cmake --install ${BUILD_DIR} |