|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +env: |
| 6 | + CMAKE_BUILD_PARALLEL_LEVEL: "2" # 2 cores on each GHA VM, enable parallel builds |
| 7 | + CTEST_OUTPUT_ON_FAILURE: "ON" # This way we don't need a flag to ctest |
| 8 | + CTEST_PARALLEL_LEVEL: "2" |
| 9 | + CTEST_TIME_TIMEOUT: "5" # some failures hang forever |
| 10 | + HOMEBREW_NO_ANALYTICS: "ON" # Make Homebrew installation a little quicker |
| 11 | + HOMEBREW_NO_AUTO_UPDATE: "ON" |
| 12 | + HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: "ON" |
| 13 | + HOMEBREW_NO_GITHUB_API: "ON" |
| 14 | + HOMEBREW_NO_INSTALL_CLEANUP: "ON" |
| 15 | + |
| 16 | +jobs: |
| 17 | + Build: |
| 18 | + runs-on: ${{ matrix.os }} |
| 19 | + strategy: |
| 20 | + fail-fast: false |
| 21 | + matrix: |
| 22 | + os: [ubuntu-latest] |
| 23 | + toolchain: |
| 24 | + - {compiler: gcc, version: 14} |
| 25 | + build: [cmake] |
| 26 | + with_bitsets: [On, Off] |
| 27 | + env: |
| 28 | + BUILD_DIR: ${{ matrix.build == 'cmake' && 'build' || '.' }} |
| 29 | + |
| 30 | + steps: |
| 31 | + - name: Checkout code |
| 32 | + uses: actions/checkout@v4 |
| 33 | + |
| 34 | + - name: Set up Python 3.x |
| 35 | + uses: actions/setup-python@v5 # Use pip to install latest CMake, & FORD/Jin2For, etc. |
| 36 | + with: |
| 37 | + python-version: 3.x |
| 38 | + |
| 39 | + - name: Install fypp |
| 40 | + run: pip install --upgrade fypp ninja |
| 41 | + |
| 42 | + - name: Setup Fortran compiler |
| 43 | + uses: fortran-lang/[email protected] |
| 44 | + id: setup-fortran |
| 45 | + with: |
| 46 | + compiler: ${{ matrix.toolchain.compiler }} |
| 47 | + version: ${{ matrix.toolchain.version }} |
| 48 | + |
| 49 | + # Build and test with built-in BLAS and LAPACK |
| 50 | + - name: Configure with CMake |
| 51 | + if: ${{ contains(matrix.build, 'cmake') }} |
| 52 | + run: >- |
| 53 | + cmake -Wdev -G Ninja |
| 54 | + -DCMAKE_BUILD_TYPE=Release |
| 55 | + -DCMAKE_MAXIMUM_RANK:String=4 |
| 56 | + -DCMAKE_INSTALL_PREFIX=$PWD/_dist |
| 57 | + -DFIND_BLAS:STRING=FALSE |
| 58 | + -DWITH_BITSETS:STRING=${{ matrix.with_bitsets }} |
| 59 | + -S . -B ${{ env.BUILD_DIR }} |
| 60 | +
|
| 61 | + - name: Build and compile |
| 62 | + if: ${{ contains(matrix.build, 'cmake') }} |
| 63 | + run: cmake --build ${{ env.BUILD_DIR }} --parallel |
| 64 | + |
| 65 | + - name: catch build fail |
| 66 | + if: ${{ failure() && contains(matrix.build, 'cmake') }} |
| 67 | + run: cmake --build ${{ env.BUILD_DIR }} --verbose --parallel 1 |
| 68 | + |
| 69 | + - name: test |
| 70 | + if: ${{ contains(matrix.build, 'cmake') }} |
| 71 | + run: >- |
| 72 | + ctest |
| 73 | + --test-dir ${{ env.BUILD_DIR }} |
| 74 | + --parallel |
| 75 | + --output-on-failure |
| 76 | + --no-tests=error |
| 77 | +
|
| 78 | + - name: Install project |
| 79 | + if: ${{ contains(matrix.build, 'cmake') }} |
| 80 | + run: cmake --install ${{ env.BUILD_DIR }} |
0 commit comments