Skip to content

Commit

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

* update Intel.yml

* update Linux.yml

* update MacOS.yml

* update Spack.yml

* fix Linux.yml

* fix Intel.yml
  • Loading branch information
AlexanderRichert-NOAA authored Jul 1, 2024
1 parent a42285b commit 5e46d04
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 84 deletions.
37 changes: 8 additions & 29 deletions .github/workflows/Intel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,49 +12,28 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

# 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-openmp intel-oneapi-compiler-fortran-2023.2.1 intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic-2023.2.1
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
uses: actions/checkout@v4
with:
path: g2tmpl
submodules: true

- name: build
run: |
cd g2tmpl
mkdir build
cd build
${{ matrix.compilers }} cmake ..
make -j2 VERBOSE=1
cmake -B build
cmake --build build --parallel 2 --verbose
- name: test
run: |
cd $GITHUB_WORKSPACE/g2tmpl/build
ctest --verbose --output-on-failure --rerun-failed
ctest --test-dir build --verbose --output-on-failure --rerun-failed
19 changes: 6 additions & 13 deletions .github/workflows/Linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,19 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@v4
with:
path: g2tmpl
submodules: true

- name: build
run: |
cd g2tmpl
mkdir build
cd build
cmake ${{ matrix.config.options }} -DCMAKE_INSTALL_PREFIX=~/g2tmpl/install ..
make -j2 VERBOSE=1
cmake -B build ${{ matrix.config.options }} -DCMAKE_INSTALL_PREFIX=~/install
cmake --build build --parallel 2 --verbose
- name: test
run: |
set -x
cd $GITHUB_WORKSPACE/g2tmpl/build
ctest --verbose --output-on-failure --rerun-failed
make install
ctest --test-dir build --verbose --output-on-failure --rerun-failed
cmake --install build
if [ "${{ matrix.config.options }}" = "-DBUILD_SHARED_LIBS=ON" ]; then
ls -l ~/g2tmpl/install/lib/lib*.so || exit 1
ls -l ~/install/lib/lib*.so || exit 1
else
ls -l ~/g2tmpl/install/lib/lib*.a || exit 1
ls -l ~/install/lib/lib*.a || exit 1
fi
12 changes: 3 additions & 9 deletions .github/workflows/MacOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,13 @@ jobs:

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

- name: build
run: |
cd g2tmpl
mkdir build
cd build
cmake ..
make -j2
cmake -B build
cmake --build build --parallel 2 --verbose
- name: test
run: |
cd $GITHUB_WORKSPACE/g2tmpl/build
ctest --verbose --output-on-failure --rerun-failed
ctest --test-dir build --verbose --output-on-failure --rerun-failed
45 changes: 13 additions & 32 deletions .github/workflows/Spack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,43 +31,24 @@ jobs:

steps:

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

- 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 g2tmpl-env
spack env activate g2tmpl-env
cp $GITHUB_WORKSPACE/g2tmpl/spack/package.py $SPACK_ROOT/var/spack/repos/builtin/packages/g2tmpl/package.py
mv $GITHUB_WORKSPACE/g2tmpl $SPACK_ENV/g2tmpl
spack develop --no-clone g2tmpl@develop
spack add g2tmpl@develop%gcc@11
spack external find cmake gmake
spack concretize
# Run installation and run CTest suite
spack install --verbose --fail-fast --test root
# Run 'spack load' to check for obvious errors in setup_run_environment
spack load g2tmpl
- name: "Build Spack package"
uses: NOAA-EMC/ci-test-spack-package@develop
with:
package-name: g2tmpl
custom-recipe: spack/package.py
use-repo-cache: true
spack-compiler: gcc
repo-cache-key-suffix: ${{ matrix.os }}-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-g2tmpl
uses: actions/checkout@v4
with:
path: g2tmpl

- 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/g2tmpl/CMakeLists.txt) ; do
echo "Checking for presence of '$opt' CMake option in package.py"
grep -cP "define.+\b${opt}\b" $GITHUB_WORKSPACE/g2tmpl/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
2 changes: 1 addition & 1 deletion .github/workflows/developer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
gcovr --root .. -v --html-details --exclude ../tests --exclude CMakeFiles --print-summary -o test-coverage.html
- name: upload-test-coverage
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: g2tmpl-test-coverage
path: |
Expand Down

0 comments on commit 5e46d04

Please sign in to comment.