Skip to content

Commit

Permalink
try macos again
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipDeegan committed Oct 14, 2023
1 parent 3a8b85e commit c57c057
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 34 deletions.
53 changes: 20 additions & 33 deletions .github/workflows/cmake.yml → .github/workflows/cmake_macos.yml
Original file line number Diff line number Diff line change
@@ -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') }}
Expand All @@ -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: |
Expand All @@ -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

94 changes: 94 additions & 0 deletions .github/workflows/cmake_ubuntu.yml
Original file line number Diff line number Diff line change
@@ -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

2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c57c057

Please sign in to comment.