From 66f3dfb02c85cf0d9005d663d99165cb952076c0 Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Mon, 3 Jun 2024 08:13:30 -0700 Subject: [PATCH] CI updates (add EMC Actions; #31) * update Intel.yml * update main.yml * update Spack.yml * fix Spack.yml --- .github/workflows/Intel.yml | 48 ++++++++++--------------------------- .github/workflows/Spack.yml | 46 ++++++++++------------------------- .github/workflows/main.yml | 33 ++++++++++--------------- 3 files changed, 38 insertions(+), 89 deletions(-) diff --git a/.github/workflows/Intel.yml b/.github/workflows/Intel.yml index 9f6cefb..ccccd56 100644 --- a/.github/workflows/Intel.yml +++ b/.github/workflows/Intel.yml @@ -7,42 +7,29 @@ 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-dev-utilities intel-oneapi-mpi-devel intel-oneapi-openmp 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 }} @@ -50,28 +37,19 @@ jobs: - 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 - 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 + cmake --install pfunit/build - name: checkout uses: actions/checkout@v4 with: path: landsfcutil - submodules: true - name: build run: | - cd landsfcutil - mkdir build - cd build - ${{ matrix.compilers }} cmake .. -DENABLE_TESTS=ON -DCMAKE_PREFIX_PATH="~/pfunit" - make -j2 VERBOSE=1 + cmake -S landsfcutil -B landsfcutil/build -DENABLE_TESTS=ON -DCMAKE_PREFIX_PATH="~/pfunit" + cmake --build landsfcutil/build --parallel 2 --verbose - name: test - run: | - cd $GITHUB_WORKSPACE/landsfcutil/build - make test VERBOSE=1 + run: ctest --test-dir landsfcutil/build --verbose diff --git a/.github/workflows/Spack.yml b/.github/workflows/Spack.yml index 3029cbd..e52d0cc 100644 --- a/.github/workflows/Spack.yml +++ b/.github/workflows/Spack.yml @@ -24,29 +24,16 @@ jobs: runs-on: ${{ matrix.os }} steps: - - - name: checkout-landsfcutil - uses: actions/checkout@v4 - with: - path: landsfcutil - - 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 landsfcutil-env - spack env activate landsfcutil-env - cp $GITHUB_WORKSPACE/landsfcutil/spack/package.py $SPACK_ROOT/var/spack/repos/builtin/packages/landsfcutil/package.py - spack develop --no-clone --path $GITHUB_WORKSPACE/landsfcutil landsfcutil@develop - spack add landsfcutil@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 landsfcutil - ls $LANDSFCUTIL_LIB - ls $LANDSFCUTIL_LIB4 + - name: "Build Spack package" + uses: NOAA-EMC/ci-test-spack-package@develop + with: + package-name: landsfcutil + package-variants: +pfunit + custom-recipe: spack/package.py + spack-compiler: gcc + spack-externals: cmake gmake m4 python perl + repo-cache-key-suffix: ${{ matrix.os }}-1 # This job validates the Spack recipe by making sure each cmake build option is represented recipe-check: @@ -54,15 +41,8 @@ jobs: steps: - - name: checkout-landsfcutil - uses: actions/checkout@v4 - with: - path: landsfcutil - - 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(?!(DUMMY_ENTRY))[^ ]+' $GITHUB_WORKSPACE/landsfcutil/CMakeLists.txt) ; do - echo "Checking for presence of '$opt' CMake option in package.py" - grep -cP "define.+\b${opt}\b" $GITHUB_WORKSPACE/landsfcutil/spack/package.py - done + uses: NOAA-EMC/ci-check-spack-recipe@develop + with: + recipe-file: package/spack/package.py + cmakelists-txt: package/CMakeLists.txt diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9b7f055..a5fdb63 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,22 +3,22 @@ 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') }} @@ -26,28 +26,19 @@ jobs: - 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 + cmake --install pfunit/build - name: checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: path: landsfcutil - submodules: true - name: build run: | - cd landsfcutil - mkdir build - cd build - cmake .. -DENABLE_TESTS=ON -DCMAKE_PREFIX_PATH="~/pfunit;~/" - make -j2 + cmake -S landsfcutil -B landsfcutil/build -DENABLE_TESTS=ON -DCMAKE_PREFIX_PATH="~/pfunit;~/" + cmake --build landsfcutil/build --parallel 2 --verbose - name: test - run: | - cd $GITHUB_WORKSPACE/landsfcutil/build - make test \ No newline at end of file + run: ctest --test-dir landsfcutil/build --verbose