From 5e46d044b5034dda079ec41983a436cfda901f3f Mon Sep 17 00:00:00 2001 From: Alex Richert Date: Mon, 1 Jul 2024 15:52:56 -0700 Subject: [PATCH] CI updates (#133) * update developer.yml * update Intel.yml * update Linux.yml * update MacOS.yml * update Spack.yml * fix Linux.yml * fix Intel.yml --- .github/workflows/Intel.yml | 37 ++++++--------------------- .github/workflows/Linux.yml | 19 +++++--------- .github/workflows/MacOS.yml | 12 +++------ .github/workflows/Spack.yml | 45 ++++++++++----------------------- .github/workflows/developer.yml | 2 +- 5 files changed, 31 insertions(+), 84 deletions(-) diff --git a/.github/workflows/Intel.yml b/.github/workflows/Intel.yml index 8b97957..910f49f 100644 --- a/.github/workflows/Intel.yml +++ b/.github/workflows/Intel.yml @@ -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 diff --git a/.github/workflows/Linux.yml b/.github/workflows/Linux.yml index 93dc5a6..bdaae4e 100644 --- a/.github/workflows/Linux.yml +++ b/.github/workflows/Linux.yml @@ -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 diff --git a/.github/workflows/MacOS.yml b/.github/workflows/MacOS.yml index aaf10f8..e5b604e 100644 --- a/.github/workflows/MacOS.yml +++ b/.github/workflows/MacOS.yml @@ -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 diff --git a/.github/workflows/Spack.yml b/.github/workflows/Spack.yml index 8c3f7bb..e6916a8 100644 --- a/.github/workflows/Spack.yml +++ b/.github/workflows/Spack.yml @@ -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 diff --git a/.github/workflows/developer.yml b/.github/workflows/developer.yml index 09f5a56..84fa4f9 100644 --- a/.github/workflows/developer.yml +++ b/.github/workflows/developer.yml @@ -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: |