diff --git a/.github/workflows/Intel.yml b/.github/workflows/Intel.yml index cb10432..d18802c 100644 --- a/.github/workflows/Intel.yml +++ b/.github/workflows/Intel.yml @@ -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-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 }} + key: pfunit-${{ runner.os }}-${{ matrix.compilers }}-1 - 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 -B pfunit/build -S pfunit -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: gfsio - submodules: true - name: build run: | - cd gfsio - mkdir build - cd build - ${{ matrix.compilers }} cmake .. -DENABLE_TESTS=ON -DCMAKE_PREFIX_PATH="~/pfunit" - make -j2 VERBOSE=1 + cmake -B build -DENABLE_TESTS=ON -DCMAKE_PREFIX_PATH="~/pfunit" + cmake --build build --parallel 2 --verbose - name: test run: | - cd $GITHUB_WORKSPACE/gfsio/build - make test VERBOSE=1 + ctest --test-dir build --verbose diff --git a/.github/workflows/Spack.yml b/.github/workflows/Spack.yml index abecc5d..75d6bed 100644 --- a/.github/workflows/Spack.yml +++ b/.github/workflows/Spack.yml @@ -25,28 +25,16 @@ jobs: steps: - - name: checkout-gfsio - uses: actions/checkout@v4 - with: - path: gfsio - - - 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 gfsio-env - spack env activate gfsio-env - cp $GITHUB_WORKSPACE/gfsio/spack/package.py $SPACK_ROOT/var/spack/repos/builtin/packages/gfsio/package.py - spack develop --no-clone --path $GITHUB_WORKSPACE/gfsio gfsio@develop - spack add gfsio@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 gfsio - ls $GFSIO_LIB - ls $GFSIO_LIB4 + - name: "Build Spack package" + uses: NOAA-EMC/ci-test-spack-package@develop + with: + package-name: gfsio + package-variants: +pfunit + custom-recipe: spack/package.py + use-repo-cache: true + spack-compiler: gcc + spack-externals: cmake gmake perl python + 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 +42,8 @@ jobs: steps: - - name: checkout-gfsio - uses: actions/checkout@v4 - with: - path: gfsio - - 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/gfsio/CMakeLists.txt) ; do - echo "Checking for presence of '$opt' CMake option in package.py" - grep -cP "define.+\b${opt}\b" $GITHUB_WORKSPACE/gfsio/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 b475940..d925459 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,51 +3,41 @@ on: [push, pull_request] jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest env: - FC: gfortran-9 - CC: gcc-9 + FC: gfortran + CC: gcc 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 }}-gcc + key: pfunit-${{ runner.os }}-gcc-1 - 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 -B pfunit/build -S pfunit -DSKIP_MPI=YES -DSKIP_ESMF=YES -DSKIP_FHAMCREST=YES -DCMAKE_INSTALL_PREFIX=~/pfunit + cmake --build pfunit/build --verbose + cmake --install pfunit/build - name: checkout - uses: actions/checkout@v2 - with: - path: gfsio - submodules: true + uses: actions/checkout@v4 - name: build run: | - cd gfsio - mkdir build - cd build - cmake .. -DENABLE_TESTS=ON -DCMAKE_PREFIX_PATH="~/pfunit;~/" - make -j2 + cmake -B build -DENABLE_TESTS=ON -DCMAKE_PREFIX_PATH="~/pfunit" + cmake --build build --parallel 2 --verbose - name: test run: | - cd $GITHUB_WORKSPACE/gfsio/build - make test + cmake --build build --target test --verbose