Skip to content

Commit 636710f

Browse files
Containerize GCC & Intel CI workflows
1 parent 487c738 commit 636710f

2 files changed

Lines changed: 67 additions & 194 deletions

File tree

.github/workflows/ubuntu_gcc.yaml

Lines changed: 28 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,13 @@
11
name: GCC Linux Build and Test
22
on: [push, pull_request, workflow_dispatch]
33

4-
5-
# Use custom shell with -l so .bash_profile is sourced
6-
# without having to do it in manually every step
7-
defaults:
8-
run:
9-
shell: bash -leo pipefail {0}
10-
11-
env:
12-
cache_key: gcc
13-
CC: gcc-13
14-
FC: gfortran-13
15-
CXX: g++-13
16-
17-
# The jobs are split into:
18-
# 1. a dependency build step (setup), and
19-
# 2. a UFS-utils build and test step (ufs_utils)
20-
# The setup is run once and the environment is cached,
21-
# so each subsequent build and test of UFS-utils can reuse the cached
22-
# dependencies to save time (and compute).
23-
244
jobs:
25-
setup:
26-
runs-on: ubuntu-24.04
27-
28-
steps:
29-
- name: checkout # this is to get the ci/spack.yaml file
30-
uses: actions/checkout@v3
31-
with:
32-
path: ufs_utils
33-
34-
# Cache spack, compiler and dependencies
35-
- name: cache-env
36-
id: cache-env
37-
uses: actions/cache@v3
38-
with:
39-
path: |
40-
spack
41-
~/.spack
42-
key: spack-${{ runner.os }}-${{ env.cache_key }}-${{ hashFiles('ufs_utils/ci/spack.yaml') }}
43-
44-
# Install dependencies using Spack
45-
- name: install-dependencies-with-spack
46-
if: steps.cache-env.outputs.cache-hit != 'true'
47-
run: |
48-
git clone -c feature.manyFiles=true https://github.com/spack/spack.git
49-
source spack/share/spack/setup-env.sh
50-
sed "s/\[oneapi, gcc@13:13, apple-clang@14\]/\[gcc@13:13\]/g" ufs_utils/ci/spack.yaml > spack_ci.yaml
51-
spack env create ufs_utils-env spack_ci.yaml
52-
spack env activate ufs_utils-env
53-
spack config add "packages:all:prefer:['%gcc']"
54-
sudo apt install cmake
55-
spack external find
56-
spack add mpich@3.4.2
57-
spack concretize
58-
spack install -v --fail-fast --dirty
59-
spack clean --all
60-
61-
ufs_utils:
62-
needs: setup
5+
ufs_utils-gcc:
636
runs-on: ubuntu-24.04
7+
# Dependencies are preinstalled in a container image.
8+
# For available images, see https://github.com/orgs/NOAA-EMC/packages?tab=packages&q=ufs-utils.
9+
# See https://github.com/NOAA-EMC/ci-common-build-cache/#using-container-images for further container usage instructions.
10+
container: ghcr.io/noaa-emc/ci-common-build-cache/ufs-utils-ubuntu-24.04-gcc-13-mpich-x@sha256:081212acfb78e790a3ee6471cd3dab41737f60214678e9a2c428fe8b6fdedaa7
6411

6512
steps:
6613
- name: checkout
@@ -69,31 +16,30 @@ jobs:
6916
path: ufs_utils
7017
submodules: recursive
7118

72-
- name: cache-env
73-
id: cache-env
74-
uses: actions/cache@v3
75-
with:
76-
path: |
77-
spack
78-
~/.spack
79-
key: spack-${{ runner.os }}-${{ env.cache_key }}-${{ hashFiles('ufs_utils/ci/spack.yaml') }}
80-
8119
- name: build
20+
shell: bash
8221
run: |
83-
source spack/share/spack/setup-env.sh
84-
spack env activate ufs_utils-env
22+
. /entrypoint.sh
23+
spack uninstall --force --yes-to-all gcc-runtime # prevents CMake config warnings
24+
############################
25+
## Modify Spack installation, if needed
26+
##
27+
## For `swap-package` custom Spack command documentation,
28+
## see https://github.com/NOAA-EMC/spack-helpers#modify-package-spec-swap-package.
29+
## To request a package addition or update , create an issue or PR at
30+
## https://github.com/NOAA-EMC/ci-common-build-cache/.
31+
##
32+
## Configure a different version/build options for a package:
33+
#spack swap-package foo@1.2.3
34+
## Configure an additional package not already in Spack:
35+
#spack add bar@4.5.6
36+
## Concretize environment and run the installation:
37+
#spack concretize --fresh
38+
#spack install --only-concrete
39+
############################
8540
export CC=mpicc
8641
export FC=mpif90
87-
cd ufs_utils
88-
mkdir -p build && cd build
89-
cmake -DCMAKE_INSTALL_PREFIX=../install ..
90-
make -j2 VERBOSE=1
91-
make install
92-
93-
- name: ctest
94-
run: |
95-
source spack/share/spack/setup-env.sh
96-
spack env activate ufs_utils-env
97-
cd ufs_utils
98-
cd build
99-
ctest --verbose --rerun-failed --output-on-failure
42+
cmake -S ufs_utils -B build -DCMAKE_INSTALL_PREFIX=install
43+
cmake --build build --parallel 4 --verbose
44+
cmake --install build
45+
ctest --test-dir build --parallel 4 --output-on-failure
Lines changed: 39 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,127 +1,54 @@
1-
name: Intel Linux Build and Test
1+
name: Intel oneAPI Linux Build and Test
22
on: [push, pull_request, workflow_dispatch]
33

4-
# Use custom shell with -l so .bash_profile is sourced which loads intel/oneapi/setvars.sh
5-
# without having to do it in manually every step
6-
defaults:
7-
run:
8-
shell: bash -leo pipefail {0}
9-
10-
# Set I_MPI_CC/F90 so IntelLLVM is used.
11-
env:
12-
cache_key: intel
13-
CC: mpiicx
14-
FC: mpiifx
15-
CXX: mpiicpx
16-
I_MPI_CC: icx
17-
I_MPI_F90: ifx
18-
I_MPI_CXX: icpx
19-
20-
# The jobs are split into:
21-
# 1. a dependency build step (setup), and
22-
# 2. a UFS-utils build and test step (ufs_utils)
23-
# The setup is run once and the environment is cached,
24-
# so each subsequent build and test of UFS-utils can reuse the cached
25-
# dependencies to save time (and compute).
26-
274
jobs:
28-
setup:
5+
ufs_utils-oneapi:
296
runs-on: ubuntu-24.04
7+
# Dependencies are preinstalled in a container image.
8+
# For available images, see https://github.com/orgs/NOAA-EMC/packages?tab=packages&q=ufs-utils.
9+
# See https://github.com/NOAA-EMC/ci-common-build-cache/#using-container-images for further container usage instructions.
10+
container: ghcr.io/noaa-emc/ci-common-build-cache/ufs-utils-ubuntu-24.04-oneapi-2025.3-intel-oneapi-mpi-2021.17@sha256:93fb43fdd2e74e1a4081b52bbf5a1afd244d4e48219fa2c7f06fdcddb609697e
3011

3112
steps:
32-
- name: checkout # this is to get the ci/spack.yaml file
33-
uses: actions/checkout@v3
34-
with:
35-
path: ufs_utils
36-
37-
# Cache spack, compiler and dependencies
38-
- name: cache-env
39-
id: cache-env
40-
uses: actions/cache@v3
41-
with:
42-
path: |
43-
spack
44-
~/.spack
45-
/opt/intel
46-
key: spack-${{ runner.os }}-${{ env.cache_key }}-${{ hashFiles('ufs_utils/ci/spack.yaml') }}
47-
48-
- name: install-intel-compilers
49-
run: |
50-
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
51-
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
52-
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
53-
sudo apt-get update
54-
sudo apt-get install intel-oneapi-mpi-devel intel-oneapi-openmp-2024.1 intel-oneapi-compiler-fortran-2024.1 intel-oneapi-compiler-dpcpp-cpp-2024.1
55-
echo "source /opt/intel/oneapi/setvars.sh" >> ~/.bash_profile
56-
57-
# Install dependencies using Spack
58-
- name: install-dependencies-with-spack
59-
if: steps.cache-env.outputs.cache-hit != 'true'
60-
run: |
61-
sudo mv /usr/local /usr/local_mv
62-
git clone -c feature.manyFiles=true https://github.com/spack/spack.git
63-
source spack/share/spack/setup-env.sh
64-
sed "s/\[oneapi, gcc@10:10, apple-clang@14\]/\[oneapi\]/g" ufs_utils/ci/spack.yaml > spack_ci.yaml
65-
spack env create ufs_utils-env spack_ci.yaml
66-
spack env activate ufs_utils-env
67-
spack compiler find
68-
sudo apt install cmake
69-
spack external find --not-buildable gmake
70-
spack external find
71-
spack config add "packages:all:prefer:['%oneapi']"
72-
spack config add "packages:fortran:require:'intel-oneapi-compilers'"
73-
spack config add "packages:mpi:require:intel-oneapi-mpi"
74-
spack config add "packages:mpi:buildable:false"
75-
spack config add "packages:mpi:require:intel-oneapi-mpi"
76-
intel_mpi_version=$(basename $(realpath /opt/intel/oneapi/mpi/latest))
77-
sed -i "s|^ packages:| packages:\n intel-oneapi-mpi:\n buildable: false\n externals:\n - spec: intel-oneapi-mpi@${intel_mpi_version}\n prefix: /opt/intel/oneapi|" $SPACK_ENV/spack.yaml
78-
spack config add "packages:python:require:'@3.11'"
79-
cat $SPACK_ENV/spack.yaml
80-
spack concretize
81-
spack install --dirty --show-log-on-error --fail-fast
82-
spack clean --all
83-
84-
ufs_utils:
85-
needs: setup
86-
runs-on: ubuntu-24.04
87-
88-
steps:
89-
- name: install-intel
90-
run: |
91-
echo "source /opt/intel/oneapi/setvars.sh" >> ~/.bash_profile
92-
9313
- name: checkout
9414
uses: actions/checkout@v3
9515
with:
9616
path: ufs_utils
9717
submodules: recursive
9818

99-
- name: cache-env
100-
id: cache-env
101-
uses: actions/cache@v3
102-
with:
103-
path: |
104-
spack
105-
~/.spack
106-
/opt/intel
107-
key: spack-${{ runner.os }}-${{ env.cache_key }}-${{ hashFiles('ufs_utils/ci/spack.yaml') }}
19+
- name: "Install Intel compilers & MPI"
20+
uses: NOAA-EMC/ci-install-intel-toolkit@develop
21+
with: # Match versions to container configuration
22+
install-classic: false
23+
oneapi-version: 2025.3
24+
install-mpi: true
25+
mpi-version: 2021.17
26+
mpi-wrapper-setup: oneapi
27+
compiler-setup: oneapi
28+
configure-gcc: false
10829

10930
- name: build
31+
shell: bash
11032
run: |
111-
source spack/share/spack/setup-env.sh
112-
spack env activate ufs_utils-env
113-
export CC=mpiicx
114-
export FC=mpiifx
115-
cd ufs_utils
116-
mkdir -p build && cd build
117-
cmake -DCMAKE_INSTALL_PREFIX=../install ..
118-
make -j2 VERBOSE=1
119-
make install
120-
121-
- name: ctest
122-
run: |
123-
source spack/share/spack/setup-env.sh
124-
spack env activate ufs_utils-env
125-
cd ufs_utils
126-
cd build
127-
ctest --verbose --rerun-failed --output-on-failure
33+
. /entrypoint.sh
34+
spack uninstall --force --yes-to-all gcc-runtime intel-oneapi-runtime # prevents CMake config warnings
35+
############################
36+
## Modify Spack installation, if needed
37+
##
38+
## For `swap-package` custom Spack command documentation,
39+
## see https://github.com/NOAA-EMC/spack-helpers#modify-package-spec-swap-package.
40+
## To request a package addition or update , create an issue or PR at
41+
## https://github.com/NOAA-EMC/ci-common-build-cache/.
42+
##
43+
## Configure a different version/build options for a package:
44+
#spack swap-package foo@1.2.3
45+
## Configure an additional package not already in Spack:
46+
#spack add bar@4.5.6
47+
## Concretize environment and run the installation:
48+
#spack concretize --fresh
49+
#spack install --only-concrete
50+
############################
51+
cmake -S ufs_utils -B build -DCMAKE_INSTALL_PREFIX=install
52+
cmake --build build --parallel 4 --verbose
53+
cmake --install build
54+
ctest --test-dir build --parallel 4 --output-on-failure

0 commit comments

Comments
 (0)