|
7 | 7 | branches: [ "main" ]
|
8 | 8 |
|
9 | 9 | env:
|
10 |
| - # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) |
11 | 10 | BUILD_TYPE: Release
|
12 | 11 |
|
13 | 12 | jobs:
|
14 | 13 | build:
|
15 |
| - # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. |
16 |
| - # You can convert this to a matrix build if you need cross-platform coverage. |
17 |
| - # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix |
18 |
| - runs-on: ubuntu-latest |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + fortran_compiler: [gfortran, ifort] |
| 19 | + os: [ubuntu-latest, macos-latest] # issue with windows-latest & CMake with CMake not recognizing defined compilers |
19 | 20 |
|
20 | 21 | steps:
|
21 |
| - - uses: actions/checkout@v3 |
22 | 22 |
|
23 |
| - - name: Configure CMake |
24 |
| - # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. |
25 |
| - # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type |
26 |
| - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} |
| 23 | + - name: Setup IFORT |
| 24 | + if: contains( matrix.fortran_compiler, 'ifort' ) |
| 25 | + uses: modflowpy/install-intelfortran-action@v1 |
| 26 | + |
| 27 | + - name: Setup GFORTRAN |
| 28 | + if: contains( matrix.fortran_compiler, 'gfortran') |
| 29 | + uses: awvwgk/setup-fortran@main |
| 30 | + id: setup-fortran |
| 31 | + with: |
| 32 | + compiler: gcc |
| 33 | + version: 12 |
| 34 | + |
| 35 | + env: |
| 36 | + FC: ${{ steps.setup-fortran.outputs.fc }} |
| 37 | + CC: ${{ steps.setup-fortran.outputs.cc }} |
27 | 38 |
|
28 |
| - - name: Build |
29 |
| - # Build your program with the given configuration |
| 39 | + - uses: actions/checkout@v3 |
| 40 | + |
| 41 | + - name: Configure CMake |
| 42 | + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_C_COMPILER=${{ env.CC }} -DCMAKE_Fortran_COMPILER=${{ env.FC }} -DBUILD_TESTING=TRUE |
| 43 | + |
| 44 | + - name: Build with CMake |
30 | 45 | run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
31 | 46 |
|
32 |
| - - name: Test |
| 47 | + - name: Test with CMake |
33 | 48 | working-directory: ${{github.workspace}}/build
|
34 |
| - # Execute tests defined by the CMake configuration. |
35 |
| - # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail |
36 | 49 | run: ctest -C ${{env.BUILD_TYPE}}
|
37 |
| - |
|
0 commit comments