Include json via CMake (#87) #184
This file contains hidden or 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: Build and test macOS | |
# Builds FANS for macOS on Apple Silicon CPU and runs the tests. | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.event_name }}-${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{github.event_name == 'pull_request'}} | |
jobs: | |
build-macos: | |
name: macos-latest | |
runs-on: macos-latest | |
env: | |
FANS_BUILD_DIR: build | |
strategy: | |
fail-fast: false | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v5 | |
- name: Install FANS dependencies | |
run: | | |
brew uninstall --force cmake | |
brew install gnu-time gcc@15 | |
brew install open-mpi --build-from-source --cc=gcc-15 | |
brew install hdf5-mpi --build-from-source --cc=gcc-15 | |
brew install fftw eigen nlohmann-json | |
- name: Set up pixi | |
uses: prefix-dev/[email protected] | |
with: | |
environments: dashboard | |
- name: Generate build directory | |
run: mkdir -p ${{ env.FANS_BUILD_DIR }} | |
- name: Configure | |
working-directory: ${{ env.FANS_BUILD_DIR }} | |
env: | |
CC: gcc-15 | |
CXX: g++-15 | |
MPICC: mpicc | |
MPICXX: mpicxx | |
run: | | |
cmake --version | |
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. | |
- uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: macOS 15 CMakeCache | |
path: ${{ env.FANS_BUILD_DIR }}/CMakeCache.txt | |
- uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: macOS 15 CMakeLogs | |
path: '${{ env.FANS_BUILD_DIR }}/CMakeFiles/*.log' | |
- uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: macOS 15 CompileCommands | |
path: ${{ env.FANS_BUILD_DIR }}/compile_commands.json | |
- name: Compile | |
working-directory: ${{ env.FANS_BUILD_DIR }} | |
run: | |
cmake --build . -j $(nproc) || cmake --build . -j1 | |
- name: Tests | |
working-directory: ${{ env.FANS_BUILD_DIR }} | |
env: | |
CTEST_OUTPUT_ON_FAILURE: 1 | |
run: ctest | |
- uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: macOS 15 CTest logs | |
path: ${{ env.FANS_BUILD_DIR }}/Testing/Temporary/LastTest.log | |
# ──────────────────────────────────────────────────────────────── | |
# Pytest checks | |
# ──────────────────────────────────────────────────────────────── | |
- name: Run pytest checks on HDF5 output | |
run: pixi run -e dashboard pytest | |
- uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: ${{ format('Ubuntu {0}', matrix.UBUNTU_VERSION) }} PyTest logs | |
path: | | |
**/pytest*.xml | |
**/.pytest_cache |