Skip to content

Commit 9ffda3d

Browse files
committed
Add Github Actions CI
1 parent 9d304a0 commit 9ffda3d

File tree

2 files changed

+194
-0
lines changed

2 files changed

+194
-0
lines changed

.github/workflows/spack-ci.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
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+

.github/workflows/workflow.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Build Tests
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+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.ref }}
16+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
17+
18+
jobs:
19+
build_ldas:
20+
name: Build GEOSldas
21+
if: "!contains(github.event.pull_request.labels.*.name, '0 diff trivial')"
22+
runs-on: ubuntu-24.04
23+
container:
24+
image: gmao/ubuntu24-geos-env:v7.32.0-intelmpi_2021.13-ifort_2021.13
25+
# Per https://github.com/actions/virtual-environments/issues/1445#issuecomment-713861495
26+
# It seems like we might not need secrets on GitHub Actions which is good for forked
27+
# pull requests
28+
#credentials:
29+
#username: ${{ secrets.DOCKERHUB_USERNAME }}
30+
#password: ${{ secrets.DOCKERHUB_TOKEN }}
31+
32+
env:
33+
OMPI_ALLOW_RUN_AS_ROOT: 1
34+
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
35+
OMPI_MCA_btl_vader_single_copy_mechanism: none
36+
37+
steps:
38+
# https://github.com/orgs/community/discussions/25678#discussioncomment-5242449
39+
- name: Delete huge unnecessary tools folder
40+
run: rm -rf /opt/hostedtoolcache
41+
42+
- name: Checkout LDAS
43+
uses: actions/checkout@v4
44+
with:
45+
fetch-depth: 1
46+
filter: blob:none
47+
repository: GEOS-ESM/GEOSldas
48+
49+
- name: Set all directories as git safe
50+
run: |
51+
git config --global --add safe.directory '*'
52+
53+
- name: Versions etc.
54+
run: |
55+
ifort --version
56+
mpirun --version
57+
echo $BASEDIR
58+
59+
- name: Mepo clone external repos
60+
run: |
61+
mepo clone --partial blobless
62+
mepo status
63+
64+
- name: Update other branches
65+
if:
66+
"!contains('refs/heads/main,refs/heads/develop', github.ref)"
67+
run: |
68+
mepo checkout-if-exists ${GITHUB_HEAD_REF}
69+
mepo status
70+
71+
- name: CMake
72+
run: |
73+
cmake -B build -S . --install-prefix=${pwd}/install -DCMAKE_Fortran_COMPILER=ifort -DCMAKE_BUILD_TYPE=Debug -DMPIEXEC_PREFLAGS='--oversubscribe' -DUSE_F2PY=OFF
74+
75+
- name: Build
76+
run: |
77+
cmake --build build -j 4
78+
cmake --install build

0 commit comments

Comments
 (0)