From 4b71cad8bf09efd5e47dd50e73182b2a85b616c5 Mon Sep 17 00:00:00 2001 From: Igor Krivenko Date: Tue, 14 May 2024 11:50:03 +0200 Subject: [PATCH] [CI] Split workflow `CI` into two (Ubuntu and macOS) --- .github/workflows/build-and-test-macos.yml | 113 ++++++++++++++++++ .../{CI.yml => build-and-test-ubuntu.yml} | 56 +++------ 2 files changed, 132 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/build-and-test-macos.yml rename .github/workflows/{CI.yml => build-and-test-ubuntu.yml} (73%) diff --git a/.github/workflows/build-and-test-macos.yml b/.github/workflows/build-and-test-macos.yml new file mode 100644 index 0000000..92e4b18 --- /dev/null +++ b/.github/workflows/build-and-test-macos.yml @@ -0,0 +1,113 @@ +name: Build and test (macOS) + +on: + push: + branches: + - master + - ci + pull_request: + branches: + - master + schedule: + - cron: '0 0 * * 0' + +jobs: + build-and-test: + runs-on: macos-12 + strategy: + fail-fast: false + matrix: + compiler: + - {name: gcc-12, cc: gcc-12, cxx: g++-12} + + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + run: | + brew install llvm@17 eigen fftw hdf5 open-mpi + pip3 install mako numpy scipy mpi4py + + - name: Cache Boost (a C++20 compatible version) + id: cache-boost + uses: actions/cache@v4 + with: + path: ~/boost + key: boost-1.82 + + - name: Download Boost (a C++20 compatible version) + if: ${{ steps.cache-boost.outputs.cache-hit != 'true' }} + run: | + wget -q https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.bz2 + tar -xf boost_1_82_0.tar.bz2 + mv boost_1_82_0 $HOME/boost + + - name: Install libcommute + env: + CXX: ${{ matrix.compiler.cxx }} + run: | + git clone https://github.com/krivenko/libcommute libcommute + mkdir libcommute/build && pushd libcommute/build + cmake .. \ + -DCMAKE_INSTALL_PREFIX=$HOME/install \ + -DTESTS=OFF \ + -DEXAMPLES=OFF + make install + popd + + - name: Build & install Pomerol + env: + CC: ${{ matrix.compiler.cc }} + CXX: ${{ matrix.compiler.cxx }} + run: | + git clone https://github.com/pomerol-ed/pomerol + mkdir pomerol/build && pushd pomerol/build + cmake .. \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_INSTALL_PREFIX=$HOME/install \ + -DBoost_INCLUDE_DIR=$HOME/boost \ + -Dlibcommute_DIR=$HOME/install/lib/cmake \ + -DTesting=OFF \ + -DDocumentation=OFF + make -j2 install VERBOSE=1 + popd + + - name: Build & install TRIQS + env: + CC: ${{ matrix.compiler.cc }} + CXX: ${{ matrix.compiler.cxx }} + run: | + git clone https://github.com/TRIQS/triqs --branch 3.2.x + mkdir triqs/build && pushd triqs/build + cmake .. \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_INSTALL_PREFIX=$HOME/install \ + -DBoost_INCLUDE_DIR=$HOME/boost \ + -DBuild_Tests=OFF + make -j2 install VERBOSE=1 + popd + + - name: Build pomerol2triqs + env: + CC: ${{ matrix.compiler.cc }} + CXX: ${{ matrix.compiler.cxx }} + run: | + source $HOME/install/share/triqs/triqsvars.sh + mkdir build && pushd build + cmake .. \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_INSTALL_PREFIX=$HOME/install \ + -DBoost_INCLUDE_DIR=$HOME/boost + make -j2 install VERBOSE=1 + popd + + - name: Test pomerol2triqs + env: + TMPDIR: "/tmp" + run: | + mkdir -p $HOME/.prte + echo -e "\nrmaps_default_mapping_policy = :oversubscribe" >> \ + $HOME/.prte/mca-params.conf + source $HOME/install/share/triqs/triqsvars.sh + cd build + ctest --output-on-failure diff --git a/.github/workflows/CI.yml b/.github/workflows/build-and-test-ubuntu.yml similarity index 73% rename from .github/workflows/CI.yml rename to .github/workflows/build-and-test-ubuntu.yml index d86c27e..6d69dd0 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/build-and-test-ubuntu.yml @@ -1,4 +1,4 @@ -name: CI +name: Build and test (Ubuntu) on: push: @@ -12,25 +12,19 @@ on: - cron: '0 0 * * 0' jobs: - build: - + build-and-test: + runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: - include: - - {os: ubuntu-22.04, cc: gcc-12, cxx: g++-12} - - {os: ubuntu-22.04, cc: clang-15, cxx: clang++-15} - - {os: macos-12, cc: gcc-12, cxx: g++-12} - - {os: macos-12, cc: /usr/local/opt/llvm@17/bin/clang, - cxx: /usr/local/opt/llvm@17/bin/clang++} - - runs-on: ${{ matrix.os }} + compiler: + - {name: gcc-12, cc: gcc-12, cxx: g++-12} + - {name: clang-15, cc: clang-15, cxx: clang++-15} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - name: Install Ubuntu dependencies - if: startsWith(matrix.os, 'ubuntu') + - name: Install dependencies run: > sudo apt-get update && sudo apt-get install lsb-release wget software-properties-common && @@ -61,15 +55,9 @@ jobs: python3-mpi4py python3-mako - - name: Install Homebrew dependencies - if: startsWith(matrix.os, 'macos') - run: | - brew install llvm@17 libomp eigen fftw hdf5 open-mpi - pip3 install mako numpy scipy mpi4py - - name: Cache Boost (a C++20 compatible version) id: cache-boost - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/boost key: boost-1.82 @@ -82,12 +70,12 @@ jobs: mv boost_1_82_0 $HOME/boost - name: Force use of libc++ - if: startsWith(matrix.os, 'ubuntu') && startsWith(matrix.cxx, 'clang') + if: startsWith(matrix.compiler.name, 'clang') run: echo "CXXFLAGS=-stdlib=libc++" >> $GITHUB_ENV - name: Install libcommute env: - CXX: ${{ matrix.cxx }} + CXX: ${{ matrix.compiler.cxx }} run: | git clone https://github.com/krivenko/libcommute libcommute mkdir libcommute/build && pushd libcommute/build @@ -100,8 +88,8 @@ jobs: - name: Build & install Pomerol env: - CC: ${{ matrix.cc }} - CXX: ${{ matrix.cxx }} + CC: ${{ matrix.compiler.cc }} + CXX: ${{ matrix.compiler.cxx }} run: | git clone https://github.com/pomerol-ed/pomerol mkdir pomerol/build && pushd pomerol/build @@ -117,8 +105,8 @@ jobs: - name: Build & install TRIQS env: - CC: ${{ matrix.cc }} - CXX: ${{ matrix.cxx }} + CC: ${{ matrix.compiler.cc }} + CXX: ${{ matrix.compiler.cxx }} run: | git clone https://github.com/TRIQS/triqs --branch 3.2.x mkdir triqs/build && pushd triqs/build @@ -132,8 +120,8 @@ jobs: - name: Build pomerol2triqs env: - CC: ${{ matrix.cc }} - CXX: ${{ matrix.cxx }} + CC: ${{ matrix.compiler.cc }} + CXX: ${{ matrix.compiler.cxx }} run: | source $HOME/install/share/triqs/triqsvars.sh mkdir build && pushd build @@ -148,14 +136,8 @@ jobs: env: TMPDIR: "/tmp" run: | - if [[ "${{ matrix.os }}" == ubuntu* ]]; then - sudo sh -c 'echo -e "\nrmaps_base_oversubscribe = 1" >> \ - /etc/openmpi/openmpi-mca-params.conf' - else - mkdir -p $HOME/.prte - echo -e "\nrmaps_default_mapping_policy = :oversubscribe" >> \ - $HOME/.prte/mca-params.conf - fi + sudo sh -c 'echo -e "\nrmaps_base_oversubscribe = 1" >> \ + /etc/openmpi/openmpi-mca-params.conf' source $HOME/install/share/triqs/triqsvars.sh cd build ctest --output-on-failure