Skip to content

Commit

Permalink
CI updates (#38)
Browse files Browse the repository at this point in the history
* update Intel.yml

* update main.yml

* update Spack.yml

* fix main.yml Intel.yml

* add recipe check action
  • Loading branch information
AlexanderRichert-NOAA authored Jul 2, 2024
1 parent a940431 commit 46d7912
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 89 deletions.
49 changes: 13 additions & 36 deletions .github/workflows/Intel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,72 +7,49 @@ on:
branches:
- develop

# Use custom shell with -l so .bash_profile is sourced which loads intel/oneapi/setvars.sh
# without having to do it in manually every step
defaults:
run:
shell: bash -leo pipefail {0}

jobs:
Intel:
runs-on: ubuntu-latest
strategy:
matrix:
compilers: ["CC=icc FC=ifort", "CC=icx FC=ifx"]
compilers: ["oneapi", "classic"]

steps:

# See https://software.intel.com/content/www/us/en/develop/articles/oneapi-repo-instructions.html
- name: install-intel
run: |
cd /tmp
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update
sudo apt-get install intel-oneapi-compiler-fortran intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic
echo "source /opt/intel/oneapi/setvars.sh" >> ~/.bash_profile
- name: "Install Intel"
uses: NOAA-EMC/ci-install-intel-toolkit@develop
with:
compiler-setup: ${{ matrix.compilers }}

- name: checkout-pfunit
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: Goddard-Fortran-Ecosystem/pFUnit
path: pfunit

- name: cache-pfunit
id: cache-pfunit
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/pfunit
key: pfunit-${{ runner.os }}-${{ matrix.compilers }}

- name: build-pfunit
if: steps.cache-pfunit.outputs.cache-hit != 'true'
run: |
cd pfunit
mkdir build
cd build
${{ matrix.compilers }} cmake .. -DSKIP_MPI=YES -DSKIP_ESMF=YES -DSKIP_FHAMCREST=YES -DCMAKE_INSTALL_PREFIX=~/pfunit -DCMAKE_BUILD_TYPE=Release
make -j2 VERBOSE=1
make install
cmake -S pfunit -B pfunit/build -DSKIP_MPI=YES -DSKIP_ESMF=YES -DSKIP_FHAMCREST=YES -DCMAKE_INSTALL_PREFIX=~/pfunit -DCMAKE_BUILD_TYPE=Release
cmake --build pfunit/build --parallel 2 --verbose
cmake --install pfunit/build
- name: checkout
uses: actions/checkout@v4
with:
path: sfcio
submodules: true

- name: build
run: |
cd sfcio
mkdir build
cd build
${{ matrix.compilers }} cmake .. -DENABLE_TESTS=ON -DCMAKE_PREFIX_PATH="~/pfunit"
make -j2 VERBOSE=1
cmake -S sfcio -B sfcio/build -DENABLE_TESTS=ON -DCMAKE_PREFIX_PATH="~/pfunit"
cmake --build sfcio/build --parallel 2 --verbose
- name: test
run: |
cd $GITHUB_WORKSPACE/sfcio/build
make test VERBOSE=1
run: ctest --test-dir sfcio/build --verbose
47 changes: 15 additions & 32 deletions .github/workflows/Spack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,43 +25,26 @@ jobs:

steps:

- name: checkout-sfcio
uses: actions/checkout@v4
with:
path: sfcio

- name: spack-build-and-test
run: |
git clone -c feature.manyFiles=true https://github.com/jcsda/spack
. spack/share/spack/setup-env.sh
spack env create sfcio-env
spack env activate sfcio-env
cp $GITHUB_WORKSPACE/sfcio/spack/package.py $SPACK_ROOT/var/spack/repos/builtin/packages/sfcio/package.py
spack develop --no-clone --path $GITHUB_WORKSPACE/sfcio sfcio@develop
spack add sfcio@develop%gcc@11 +pfunit
spack external find cmake gmake m4 python
spack concretize
# Run installation and run pFunit testing
spack install --verbose --fail-fast --test root
# Run 'spack load' to check for obvious errors in setup_run_environment
spack load sfcio
ls $SFCIO_LIB
- name: "Build Spack package"
uses: NOAA-EMC/ci-test-spack-package@develop
with:
package-name: sfcio
package-variants: +pfunit
custom-recipe: spack/package.py
use-repo-cache: true
spack-compiler: gcc
spack-externals: cmake gmake python perl m4
repo-cache-key-suffix: ${{ matrix.os }}-${{ matrix.variants }}-1

# This job validates the Spack recipe by making sure each cmake build option is represented
recipe-check:
runs-on: ubuntu-latest

steps:

- name: checkout-sfcio
uses: actions/checkout@v4
with:
path: sfcio

- name: recipe-check
run: |
echo "If this jobs fails, look at the most recently output CMake option below and make sure that option appears in spack/package.py"
for opt in $(grep -ioP '^option\(\K(?!(ENABLE_DOCS))[^ ]+' $GITHUB_WORKSPACE/sfcio/CMakeLists.txt) ; do
echo "Checking for presence of '$opt' CMake option in package.py"
grep -cP "define.+\b${opt}\b" $GITHUB_WORKSPACE/sfcio/spack/package.py
done
uses: NOAA-EMC/ci-check-spack-recipe@develop
with:
recipe-file: package/spack/package.py
cmakelists-txt: package/CMakeLists.txt
ignore-list: ENABLE_DOCS
33 changes: 12 additions & 21 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,42 @@ on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
env:
FC: gfortran-9
CC: gcc-9
FC: gfortran-11
CC: gcc-11

steps:

- name: checkout-pfunit
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: Goddard-Fortran-Ecosystem/pFUnit
path: pfunit

- name: cache-pfunit
id: cache-pfunit
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/pfunit
key: pfunit-${{ runner.os }}-${{ hashFiles('pfunit/VERSION') }}

- name: build-pfunit
if: steps.cache-pfunit.outputs.cache-hit != 'true'
run: |
cd pfunit
mkdir build
cd build
cmake .. -DSKIP_MPI=YES -DSKIP_ESMF=YES -DSKIP_FHAMCREST=YES -DCMAKE_INSTALL_PREFIX=~/pfunit
make -j2
make install
cmake -S pfunit -B pfunit/build -DSKIP_MPI=YES -DSKIP_ESMF=YES -DSKIP_FHAMCREST=YES -DCMAKE_INSTALL_PREFIX=~/pfunit
cmake --build pfunit/build --parallel 2 --verbose
cmake --install pfunit/build
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: sfcio
submodules: true

- name: build
run: |
cd sfcio
mkdir build
cd build
cmake .. -DENABLE_TESTS=ON -DCMAKE_PREFIX_PATH="~/pfunit;~/"
make -j2
cmake -S sfcio -B sfcio/build -DENABLE_TESTS=ON -DCMAKE_PREFIX_PATH="~/pfunit;~/"
cmake --build sfcio/build
- name: test
run: |
cd $GITHUB_WORKSPACE/sfcio/build
make test
run: ctest --test-dir sfcio/build --output-on-failure

0 comments on commit 46d7912

Please sign in to comment.