Skip to content
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

WIP: Add Spack build in CI #3123

Draft
wants to merge 23 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions .github/workflows/spack-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: spack-ci-gcc

on:
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-24.04
steps:

- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Pip install mepo
run: |
python -m pip install --upgrade pip
pip install mepo

- name: Mepo clone
run: |
mepo clone

- name: Set up Spack
uses: spack/setup-spack@v2
with:
ref: develop # Spack version (examples: develop, releases/v0.21)
color: true # Force color output (SPACK_COLOR=always)
path: spack # Where to clone Spack
buildcache: false # Do not use the spack buildcache

- name: Find compilers
shell: spack-bash {0}
run: |
spack compiler find

- name: Set default compiler and target
shell: spack-bash {0}
run: |
spack config add 'packages:all:compiler:[[email protected]]'
spack config add 'packages:all:require:target=x86_64_v3'

- name: Create Spack environment
shell: spack-bash {0}
run: |
spack env create spack-env
spack env activate spack-env

- name: Login
shell: spack-bash {0}
run: |
spack -e spack-env mirror add mapl-buildcache oci://ghcr.io/mathomp4/mapl-buildcache
spack -e spack-env mirror set --oci-username ${{ github.actor }} --oci-password "${{ secrets.BUILDCACHE_TOKEN }}" mapl-buildcache
spack -e spack-env mirror list
spack -e spack-env buildcache update-index mapl-buildcache
spack -e spack-env buildcache list --allarch

- name: Concretize
shell: spack-bash {0}
run: |
spack -e spack-env concretize

- name: Install
shell: spack-bash {0}
run: |
spack -e spack-env install --add --no-check-signature --use-buildcache only \
esmf gftl gftl-shared fargparse pflogger pfunit yafyaml ecbuild udunits

- name: Build with Cmake
shell: spack-bash {0}
run: |
spack env activate spack-env
spack load \
esmf gftl gftl-shared fargparse pflogger pfunit yafyaml ecbuild udunits
spack find --loaded
FC=gfortran-13 CC=gcc-13 CXX=g++-13
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}
cmake --build build -j 4
cmake --install build
cd build
make -j4 tests

1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Allow update offsets of ±timestep in ExtData2G
- Added CI build using spack
- Minor revision (and generalization) of grid-def for GSI purposes

### Changed
Expand Down
Loading