|
| 1 | +name: Spack CI GCC Build |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize, reopened] |
| 6 | + # Do not run if the only files changed cannot affect the build |
| 7 | + paths-ignore: |
| 8 | + - "**.md" |
| 9 | + - "**.pro" |
| 10 | + - "**.sh" |
| 11 | + - "**.perl" |
| 12 | + - ".github/CODEOWNERS" |
| 13 | + workflow_dispatch: |
| 14 | + |
| 15 | +concurrency: |
| 16 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 17 | + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} |
| 18 | + |
| 19 | +jobs: |
| 20 | + build_ldas: |
| 21 | + name: Spack CI GCC Build |
| 22 | + runs-on: ubuntu-24.04 |
| 23 | + steps: |
| 24 | + |
| 25 | + - name: Checkout LDAS |
| 26 | + uses: actions/checkout@v4 |
| 27 | + with: |
| 28 | + fetch-depth: 1 |
| 29 | + filter: blob:none |
| 30 | + repository: GEOS-ESM/GEOSldas |
| 31 | + |
| 32 | + - name: Set all directories as git safe |
| 33 | + run: | |
| 34 | + git config --global --add safe.directory '*' |
| 35 | +
|
| 36 | + - name: Setup Python |
| 37 | + uses: actions/setup-python@v5 |
| 38 | + with: |
| 39 | + python-version: '3.13' |
| 40 | + |
| 41 | + - name: Pip install mepo |
| 42 | + run: | |
| 43 | + python -m pip install --upgrade pip |
| 44 | + pip install mepo |
| 45 | + mepo --version |
| 46 | +
|
| 47 | + - name: Mepo clone external repos |
| 48 | + run: | |
| 49 | + ls |
| 50 | + mepo clone --partial blobless |
| 51 | + mepo status |
| 52 | +
|
| 53 | + - name: Update other branches |
| 54 | + if: |
| 55 | + "!contains('refs/heads/main,refs/heads/develop', github.ref)" |
| 56 | + run: | |
| 57 | + mepo checkout-if-exists ${GITHUB_HEAD_REF} |
| 58 | + mepo status |
| 59 | +
|
| 60 | + - name: Set up Spack |
| 61 | + uses: spack/setup-spack@v2 |
| 62 | + with: |
| 63 | + ref: develop # Spack version (examples: develop, releases/v0.21) |
| 64 | + color: true # Force color output (SPACK_COLOR=always) |
| 65 | + path: spack # Where to clone Spack |
| 66 | + buildcache: false # Do not use the spack buildcache |
| 67 | + |
| 68 | + - name: Find compilers |
| 69 | + shell: spack-bash {0} |
| 70 | + run: | |
| 71 | + spack compiler find |
| 72 | +
|
| 73 | + - name: Set default compiler and target |
| 74 | + shell: spack-bash {0} |
| 75 | + run: | |
| 76 | + spack config add 'packages:all:compiler:[[email protected]]' |
| 77 | + spack config add 'packages:all:require:target=x86_64_v3' |
| 78 | +
|
| 79 | + - name: Create Spack environment |
| 80 | + shell: spack-bash {0} |
| 81 | + run: | |
| 82 | + spack env create spack-env |
| 83 | + spack env activate spack-env |
| 84 | +
|
| 85 | + - name: Login |
| 86 | + shell: spack-bash {0} |
| 87 | + run: | |
| 88 | + spack -e spack-env mirror add geos-buildcache oci://ghcr.io/GEOS-ESM/geos-buildcache |
| 89 | + spack -e spack-env mirror set --oci-username ${{ github.actor }} --oci-password "${{ secrets.BUILDCACHE_TOKEN }}" geos-buildcache |
| 90 | + spack -e spack-env mirror list |
| 91 | + spack -e spack-env buildcache update-index geos-buildcache |
| 92 | + spack -e spack-env buildcache list --allarch |
| 93 | +
|
| 94 | + - name: Concretize |
| 95 | + shell: spack-bash {0} |
| 96 | + run: | |
| 97 | + spack -e spack-env concretize |
| 98 | +
|
| 99 | + - name: Install |
| 100 | + shell: spack-bash {0} |
| 101 | + run: | |
| 102 | + spack -e spack-env install --add --no-check-signature --use-buildcache only \ |
| 103 | + esmf gftl gftl-shared fargparse pflogger pfunit yafyaml ecbuild udunits openblas |
| 104 | +
|
| 105 | + - name: Build with Cmake |
| 106 | + shell: spack-bash {0} |
| 107 | + run: | |
| 108 | + spack env activate spack-env |
| 109 | + spack load \ |
| 110 | + esmf gftl gftl-shared fargparse pflogger pfunit yafyaml ecbuild udunits openblas |
| 111 | + spack find --loaded |
| 112 | + FC=gfortran-14 CC=gcc-14 CXX=g++-14 |
| 113 | + cmake -B build -S . -DCMAKE_INSTALL_PREFIX=$PWD/install -DCMAKE_BUILD_TYPE=Debug -DUSE_F2PY=OFF -DCMAKE_Fortran_COMPILER=${FC} -DCMAKE_C_COMPILER=${CC} -DCMAKE_CXX_COMPILER=${CXX} |
| 114 | + cmake --build build -j 4 |
| 115 | + cmake --install build |
| 116 | +
|
0 commit comments