-
Notifications
You must be signed in to change notification settings - Fork 73
Improvement: Introduce Mac OS Github Workflow #2378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+182
−2
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,154 @@ | ||
| name: CMake tests t8code on Mac OS | ||
|
|
||
|
|
||
| # This file is part of t8code. | ||
| # t8code is a C library to manage a collection (a forest) of multiple | ||
| # connected adaptive space-trees of general element types in parallel. | ||
| # | ||
| # Copyright (C) 2026 the developers | ||
| # | ||
| # t8code is free software; you can redistribute it and/or modify | ||
| # it under the terms of the GNU General Public License as published by | ||
| # the Free Software Foundation; either version 2 of the License, or | ||
| # (at your option) any later version. | ||
| # | ||
| # t8code is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with t8code; if not, write to the Free Software Foundation, Inc., | ||
| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
|
|
||
| # This workflow checks whether building and testing works on Mac OS. | ||
| # In the past, this meant that Mac-OS-specific problems in t8code became | ||
| # apparrent only in Trixi and T8Code.jl, where they are very hard and | ||
| # cumbersome to debug. This workflow is intended to avoid that by catching | ||
| # such problems as early as possible, i.e., within t8code's CI. | ||
| # To reduce runtime, (for now) only one configuration is run, that is, Debug mode | ||
| # with MPI, mesh handle, and Fortran interface. The main reason the external | ||
| # libraries (VTK, OpenCASCADE) are deactivated is that github's Mac OS runners | ||
| # do not use containers, meaning we would have to install the libraries in every | ||
| # single CI run (or cache them). | ||
|
|
||
| env: | ||
| DEBUG_CONFIG: "-O1" | ||
|
|
||
| on: | ||
| workflow_call: | ||
| # Note: To simplify adding more configurations of this workflow later, the MPI mode and the BUILD_TYPE | ||
| # are passed as input, although currently only MPI on and Debug mode are tested. | ||
| inputs: | ||
| MAKEFLAGS: | ||
| required: true | ||
| type: string | ||
| description: 'Make flags to use for compilation (like -j4)' | ||
| MPI: | ||
| required: true | ||
| type: string | ||
| description: 'Use MPI for compilation (ON/OFF)' | ||
| BUILD_TYPE: | ||
| required: true | ||
| type: string | ||
| description: 'Build type (Release/Debug)' | ||
| TEST_LEVEL: | ||
| required: true | ||
| type: string | ||
| description: 'Test level used for configuring (T8_TEST_LEVEL_FULL, T8_TEST_LEVEL_MEDIUM, or T8_TEST_LEVEL_BASIC)' | ||
| default: 'T8_TEST_LEVEL_FULL' | ||
|
|
||
| jobs: | ||
| t8code_cmake_tests: | ||
| # | ||
| # Container setup: To avoid unwanted side effects of gcc or mpich, an own Clang version of the | ||
| # t8-dependencies Docker image is used. Aside from some basic packages, it contains a manually built | ||
| # Clang version of OpenMPI. | ||
| timeout-minutes: 25 | ||
| runs-on: macos-latest | ||
| steps: | ||
| # | ||
| # Part 1: Preparation | ||
| # ------------------------------------- | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Update packages | ||
| run: brew update | ||
| - name: Install missing packages via Homebrew | ||
| run: | | ||
| brew install open-mpi ninja cmake openssl gfortran | ||
| - name: Export correct OpenMPI path to environment variables | ||
| run: | | ||
| export OPENMPI_BIN="/opt/homebrew/opt/open-mpi/bin" | ||
| echo OPENMPI_BIN="$OPENMPI_BIN" >> $GITHUB_ENV | ||
| - name: Show gfortran version | ||
| run: $OPENMPI_BIN/mpifort --version | ||
| - name: Show mpicc version | ||
| run: $OPENMPI_BIN/mpicc --version | ||
| - name: Show mpiexec version | ||
| run: $OPENMPI_BIN/mpiexec --version | ||
| - name: MPI sanity check (should print hostname four times) | ||
| run: $OPENMPI_BIN/mpiexec --oversubscribe -n 4 hostname | ||
| - name: Get input vars | ||
| run: export MAKEFLAGS="${{ inputs.MAKEFLAGS }}" | ||
| && export MPI="${{ inputs.MPI }}" | ||
| && export BUILD_TYPE="${{ inputs.BUILD_TYPE }}" | ||
| && echo MAKEFLAGS="$MAKEFLAGS" >> $GITHUB_ENV | ||
| && echo MPI="$MPI" >> $GITHUB_ENV | ||
| && echo BUILD_TYPE="$BUILD_TYPE" >> $GITHUB_ENV | ||
| # | ||
| # Part 2: Build t8code | ||
| # -------------------- | ||
| # Define build config | ||
| - name: Set test level | ||
| run: export TEST_LEVEL_FLAG="-DT8CODE_TEST_LEVEL=${{ inputs.TEST_LEVEL }}" | ||
| && echo TEST_LEVEL_FLAG="$TEST_LEVEL_FLAG" >> $GITHUB_ENV | ||
| - name: build config variables | ||
| run: | | ||
| export CONFIG_OPTIONS="-GNinja -DCMAKE_INSTALL_PREFIX=$(pwd)/install \ | ||
| -DT8CODE_ENABLE_MPI=ON -DCMAKE_BUILD_TYPE=$BUILD_TYPE ${TEST_LEVEL_FLAG} -DCMAKE_C_FLAGS_DEBUG=${DEBUG_CONFIG} -DCMAKE_CXX_FLAGS_DEBUG=${DEBUG_CONFIG} \ | ||
| -DT8CODE_BUILD_PEDANTIC=ON -DT8CODE_BUILD_WALL=ON -DT8CODE_BUILD_WERROR=OFF -DT8CODE_BUILD_WEXTRA=ON \ | ||
| -DT8CODE_BUILD_FORTRAN_INTERFACE=ON -DT8CODE_BUILD_MESH_HANDLE=ON \ | ||
| -DT8CODE_ENABLE_OCC=OFF -DT8CODE_ENABLE_VTK=OFF" | ||
| echo CONFIG_OPTIONS="$CONFIG_OPTIONS" >> $GITHUB_ENV | ||
| # Run cmake | ||
| # NOTE 1: We use -DT8CODE_CUSTOM_PARALLEL_TEST_COMMAND to activate oversubscription, which is required on the github runner. | ||
| # NOTE 2: DT8CODE_CUSTOM_PARALLEL_TEST_COMMAND is not included in $CONFIG_OPTIONS because of whitespace issues. | ||
| - name: echo cmake line | ||
| run: echo 'cmake ../ $CONFIG_OPTIONS -DT8CODE_CUSTOM_PARALLEL_TEST_COMMAND="mpirun --oversubscribe -np 4"' | ||
| - name: cmake | ||
| run: mkdir build && cd build && cmake ../ $CONFIG_OPTIONS -DT8CODE_CUSTOM_PARALLEL_TEST_COMMAND="mpirun --oversubscribe -np 4" | ||
| # On failure, upload logs | ||
| - name: OnFailUploadLog | ||
| if: failure() | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: cmake_w_clang_and_ompi_${{ inputs.BUILD_TYPE }}_MPI_${{ inputs.MPI }}.log | ||
| path: build/CMakeFiles/CMakeOutput.log | ||
| # Build with ninja | ||
| - name: ninja | ||
| run: cd build && ninja $MAKEFLAGS | ||
| - name: ninja install | ||
| run: cd build && ninja install $MAKEFLAGS | ||
| # | ||
| # Part 3: Run t8code tests | ||
| # ------------------------ | ||
| - name: serial tests (if MPI is enabled) | ||
| run: cd build && ctest -R _serial | ||
| if: ${{ inputs.MPI == 'ON' }} | ||
| - name: parallel tests (if MPI is enabled) | ||
| run: | | ||
| cd build | ||
| ctest -R _parallel | ||
| if: ${{ inputs.MPI == 'ON' }} | ||
| - name: tests (if MPI is disabled) | ||
| run: cd build && ctest $MAKEFLAGS | ||
| if: ${{ inputs.MPI == 'OFF' }} | ||
| # On failure, upload logs | ||
| - name: OnFailUploadLog | ||
| if: failure() | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: test-suite_w_clang_and_ompi_${{ inputs.BUILD_TYPE }}_MPI_${{ inputs.MPI }}.log | ||
| path: build/Testing/Temporary/LastTest.log | ||
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.