diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake_macos.yml similarity index 59% rename from .github/workflows/cmake.yml rename to .github/workflows/cmake_macos.yml index fe4124896..eb547b441 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake_macos.yml @@ -1,38 +1,37 @@ -name: CMake +name: CMake MacOS on: pull_request: workflow_dispatch: +env: + LIBRARY_PATH: /usr/local/lib/gcc/current + jobs: build: runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: - os: [ubuntu-latest] # macos-latest disabled because of https://github.com/PHAREHUB/PHARE/issues/732 + os: [macos-11, macos-latest] steps: + - name: Build Info + run: | + uname -a + gcc -v + clang -v + - name: CCache id: cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: ~/.ccache key: ${{ runner.os }}-ccache-${{ hashFiles('hashFile.txt') }} restore-keys: ${{ runner.os }}-ccache- - - name: Cache PIP (Linux) - uses: actions/cache@v2 - if: startsWith(runner.os, 'Linux') - with: - path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - - name: Cache PIP (OSX) uses: actions/cache@v3 - if: startsWith(runner.os, 'macOS') with: path: ~/Library/Caches/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} @@ -50,14 +49,9 @@ jobs: - name: Install system deps (openmpi, hdf5, ccache,...) run: | - if [ "$RUNNER_OS" == "Linux" ]; then - sudo apt-get update - sudo apt-get install -y libopenmpi-dev openmpi-bin libhdf5-openmpi-dev ccache - else - brew reinstall gcc - brew install open-mpi hdf5-mpi ccache - echo "/usr/local/opt/ccache/libexec" >> $GITHUB_PATH - fi + brew reinstall gcc + brew install open-mpi hdf5-mpi ccache + echo "/usr/local/opt/ccache/libexec" >> $GITHUB_PATH - name: Ensure ccache uses ~/.ccache run: | @@ -68,34 +62,27 @@ jobs: - name: Install python deps run: | python -m pip install --upgrade pip - if [ -f requirements.txt ]; then python -m pip install -r requirements.txt; fi + python -m pip install -r requirements.txt - name: Create Build Environment run: cmake -E make_directory ${{runner.workspace}}/build - name: Configure CMake - shell: bash working-directory: ${{runner.workspace}}/build run: | - cmake $GITHUB_WORKSPACE \ + cmake $GITHUB_WORKSPACE -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \ -DENABLE_SAMRAI_TESTS=OFF -DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DlowResourceTests=ON \ -DCMAKE_CXX_FLAGS="-DPHARE_DIAG_DOUBLES=1 -O2" - name: Build working-directory: ${{runner.workspace}}/build - shell: bash run: | - if [ "$RUNNER_OS" == "Linux" ]; then - cmake --build . # OOM if more threads - else - cmake --build . -j 2 - fi + cmake --build . -j 2 - name: Test working-directory: ${{runner.workspace}}/build env: CTEST_OUTPUT_ON_FAILURE: 1 - shell: bash - run: ctest -j 2 - + run: ctest -j 2 + diff --git a/.github/workflows/cmake_ubuntu.yml b/.github/workflows/cmake_ubuntu.yml new file mode 100644 index 000000000..4763fe3cf --- /dev/null +++ b/.github/workflows/cmake_ubuntu.yml @@ -0,0 +1,94 @@ +name: CMake Ubuntu + +on: + pull_request: + workflow_dispatch: + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + + steps: + - name: Build Info + run: | + uname -a + gcc -v + clang -v + + - name: CCache + id: cache + uses: actions/cache@v2 + with: + path: ~/.ccache + key: ${{ runner.os }}-ccache-${{ hashFiles('hashFile.txt') }} + restore-keys: ${{ runner.os }}-ccache- + + - name: Cache PIP (Linux) + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: Clone PHARE + uses: actions/checkout@v3 + with: + submodules: 'recursive' + + - uses: actions/setup-python@v4 + with: + python-version: '3.11.1' + + - name: Install system deps (openmpi, hdf5, ccache,...) + run: | + sudo apt-get update + sudo apt-get install -y libopenmpi-dev openmpi-bin libhdf5-openmpi-dev ccache + + - name: Ensure ccache uses ~/.ccache + run: | + mkdir -p ~/.ccache + ccache --set-config=cache_dir=~/.ccache + ccache --get-config=cache_dir + + - name: Install python deps + run: | + python -m pip install --upgrade pip + python -m pip install -r requirements.txt + + - name: Create Build Environment + run: cmake -E make_directory ${{runner.workspace}}/build + + - name: Configure CMake + shell: bash + working-directory: ${{runner.workspace}}/build + run: | + set -ex + cmake $GITHUB_WORKSPACE + cd ${{runner.workspace}}/PHARE/subprojects/samrai && mkdir build && cd build + cmake .. -DENABLE_SAMRAI_TESTS=OFF -DCMAKE_BUILD_TYPE=Release + make -j2 && sudo make install && cd ../.. && rm -rf samrai + cd ${{runner.workspace}}/build && rm -rf * + cmake $GITHUB_WORKSPACE -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON --fresh \ + -DCMAKE_C_COMPILER_LAUNCHER=ccache \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ + -DlowResourceTests=ON \ + -DCMAKE_CXX_FLAGS="-DPHARE_DIAG_DOUBLES=1 -O2" + + - name: Build + working-directory: ${{runner.workspace}}/build + shell: bash + run: | + cmake --build . # OOM if more threads + + - name: Test + working-directory: ${{runner.workspace}}/build + env: + CTEST_OUTPUT_ON_FAILURE: 1 + shell: bash + run: ctest -j 2 + diff --git a/CMakeLists.txt b/CMakeLists.txt index 32dab9d3e..b7313e2f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,7 +22,7 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) include(CheckCXXCompilerFlag) find_program(Git git) -find_package(PythonInterp 3.0 REQUIRED) +find_package(PythonInterp 3.8 REQUIRED) set(PHARE_PROJECT_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(CMAKE_EXPORT_COMPILE_COMMANDS 1)