From f7544c28a8e3a3a125f55902b5aabbaf26fd8386 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Thu, 9 Jan 2025 09:00:24 -0700 Subject: [PATCH 01/12] added docs workflow --- .github/workflows/docs.yml | 160 +++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 000000000..86d0bf668 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,160 @@ +# This is a CI workflow for the fv3atm project. +# +# This workflow builds and tests the fv3atm library using GCC, and it tests +# different CMake build options. +# +# Alex Richert, 6 Dec 2023 + +name: GCC +on: + push: + branches: + - develop + pull_request: + branches: + - develop + +jobs: + build_spack: + runs-on: ubuntu-latest + + strategy: + matrix: + gcc_ver: ["12"] + mpi: ["mpich", "openmpi"] + + steps: + + - name: checkout-fv3atm + uses: actions/checkout@v4 + with: + path: ${{ github.workspace }}/fv3atm + submodules: recursive + + - name: install-cmake + run: | + cd ${{ github.workspace }} + curl -f -s -S -R -L https://github.com/Kitware/CMake/releases/download/v3.29.2/cmake-3.29.2-Linux-x86_64.tar.gz | tar -zx + echo "${{ github.workspace }}/cmake-3.29.2-linux-x86_64/bin" >> $GITHUB_PATH + + - name: cache-spack + id: cache-spack + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}/spack-develop + key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc${{ matrix.gcc_ver }}-${{ matrix.mpi }} + + # Building dependencies takes 40+ min + - name: spack-install + if: steps.cache-spack.outputs.cache-hit != 'true' + run: | + wget --no-verbose https://github.com/spack/spack/archive/refs/heads/develop.zip + unzip develop.zip -d ${GITHUB_WORKSPACE}/ &> unzip.out + . ${GITHUB_WORKSPACE}/spack-develop/share/spack/setup-env.sh + spack env create gcc${{ matrix.gcc_ver }} ${GITHUB_WORKSPACE}/fv3atm/ci/spack.yaml + spack env activate gcc${{ matrix.gcc_ver }} + spack compiler find | grep gcc@${{ matrix.gcc_ver }} + spack external find gmake cmake git git-lfs perl python ${{ matrix.mpi }} + spack config add "packages:all:require:['%gcc@${{ matrix.gcc_ver }}']" + spack config add "packages:mpi:require:'${{ matrix.mpi }}'" + spack concretize |& tee ${SPACK_ENV}/log.concretize + spack install -j2 --fail-fast + echo "spackrc=$?" >> ${GITHUB_ENV} + spack clean --all + + build_fv3atm: + needs: build_spack + runs-on: ubuntu-latest + + strategy: + matrix: + cmake_opts: ["-D32BIT=ON", "-D32BIT=OFF"] + gcc_ver: ["12"] + mpi: ["mpich", "openmpi"] + + steps: + + # Only do Doxygen and gcovr build for one job + - name: decide-doc-gcovr-build + run: | + if [[ "${{ matrix.cmake_opts }}" == "-D32BIT=ON" && "${{ matrix.gcc_ver }}" == 12 && "${{ matrix.mpi }}" == mpich ]]; then + echo 'devbuild=ON' | tee -a ${GITHUB_ENV} + echo 'gcov_cmake="-DCMAKE_Fortran_FLAGS=-fprofile-abs-path -fprofile-arcs -ftest-coverage -O0"' | tee -a ${GITHUB_ENV} + else + echo 'devbuild=OFF' | tee -a ${GITHUB_ENV} + fi + + - name: install-utilities + run: | + sudo apt-get install doxygen graphviz + python3 -m pip install gcovr + + - name: install-cmake + run: | + cd ${{ github.workspace }} + curl -f -s -S -R -L https://github.com/Kitware/CMake/releases/download/v3.29.2/cmake-3.29.2-Linux-x86_64.tar.gz | tar -zx + echo "${{ github.workspace }}/cmake-3.29.2-linux-x86_64/bin" >> $GITHUB_PATH + + - name: checkout-fv3atm + uses: actions/checkout@v4 + with: + path: ${{ github.workspace }}/fv3atm + submodules: recursive + + - name: cache-spack + id: cache-spack + uses: actions/cache/restore@v4 + with: + path: ${{ github.workspace }}/spack-develop + key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc${{ matrix.gcc_ver }}-${{ matrix.mpi }} + + - name: build-fv3atm + run: | + . ${GITHUB_WORKSPACE}/spack-develop/share/spack/setup-env.sh + spack env activate gcc${{ matrix.gcc_ver }} + spack load $(spack find --format "{name}") + cd ${GITHUB_WORKSPACE}/fv3atm + git clone https://github.com/NOAA-EMC/CMakeModules + git clone --recurse-submodules https://github.com/NOAA-PSL/stochastic_physics stochastic_physics_repo + mkdir ${GITHUB_WORKSPACE}/build + cd ${GITHUB_WORKSPACE}/build + export CC=mpicc + export CXX=mpicxx + export FC=mpif90 + cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} -DENABLE_DOCS=ON ${{ env.gcov_cmake }} + make -j2 + + - name: run-tests + run: | + cd $GITHUB_WORKSPACE/build + ctest -j2 --output-on-failure --rerun-failed + + - name: get-test-coverage + if: ${{ env.devbuild == 'ON' }} + run: | + cd $GITHUB_WORKSPACE/build + gcovr -r .. -v --html-details --gcov-executable gcov-12 --exclude $GITHUB_WORKSPACE/fv3atm/tests --exclude $GITHUB_WORKSPACE/fv3atm/stochastic_physics_repo --exclude $GITHUB_WORKSPACE/fv3atm/build/ccpp --exclude $GITHUB_WORKSPACE/fv3atm/ccpp/physics --exclude $GITHUB_WORKSPACE/fv3atm/ccpp/framework --exclude $GITHUB_WORKSPACE/fv3atm/atmos_cubed_sphere --exclude CMakeFiles --print-summary -o test-coverage.html + + - name: upload-test-coverage + uses: actions/upload-artifact@v4 + if: ${{ env.devbuild == 'ON' }} + with: + name: test-coverage-fv3atm-${{ github.sha }} + path: | + ${{ github.workspace }}/build/*.html + ${{ github.workspace }}/build/*.css + + - name: upload-docs + uses: actions/upload-artifact@v4 + if: ${{ env.devbuild == 'ON' }} + with: + name: docs-fv3atm + path: | + build/docs/html + + - name: debug-artifacts + uses: actions/upload-artifact@v4 + if: ${{ failure() }} + with: + name: ccpp_prebuild_logs-gcc${{ matrix.gcc_ver }}-${{ matrix.mpi }}-${{ matrix.cmake_opts }} + path: ${{ github.workspace }}/build/ccpp/ccpp_prebuild.* From 9e62e365efc9b68f92ddbeaaa2abbf638bd70749 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Thu, 9 Jan 2025 09:05:27 -0700 Subject: [PATCH 02/12] working on docs workflow --- .github/workflows/docs.yml | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 86d0bf668..7cd53b527 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -68,9 +68,9 @@ jobs: strategy: matrix: - cmake_opts: ["-D32BIT=ON", "-D32BIT=OFF"] + cmake_opts: ["-D32BIT=ON"] gcc_ver: ["12"] - mpi: ["mpich", "openmpi"] + mpi: ["mpich"] steps: @@ -87,7 +87,6 @@ jobs: - name: install-utilities run: | sudo apt-get install doxygen graphviz - python3 -m pip install gcovr - name: install-cmake run: | @@ -108,7 +107,7 @@ jobs: path: ${{ github.workspace }}/spack-develop key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc${{ matrix.gcc_ver }}-${{ matrix.mpi }} - - name: build-fv3atm + - name: docs-build-fv3atm run: | . ${GITHUB_WORKSPACE}/spack-develop/share/spack/setup-env.sh spack env activate gcc${{ matrix.gcc_ver }} @@ -124,26 +123,6 @@ jobs: cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} -DENABLE_DOCS=ON ${{ env.gcov_cmake }} make -j2 - - name: run-tests - run: | - cd $GITHUB_WORKSPACE/build - ctest -j2 --output-on-failure --rerun-failed - - - name: get-test-coverage - if: ${{ env.devbuild == 'ON' }} - run: | - cd $GITHUB_WORKSPACE/build - gcovr -r .. -v --html-details --gcov-executable gcov-12 --exclude $GITHUB_WORKSPACE/fv3atm/tests --exclude $GITHUB_WORKSPACE/fv3atm/stochastic_physics_repo --exclude $GITHUB_WORKSPACE/fv3atm/build/ccpp --exclude $GITHUB_WORKSPACE/fv3atm/ccpp/physics --exclude $GITHUB_WORKSPACE/fv3atm/ccpp/framework --exclude $GITHUB_WORKSPACE/fv3atm/atmos_cubed_sphere --exclude CMakeFiles --print-summary -o test-coverage.html - - - name: upload-test-coverage - uses: actions/upload-artifact@v4 - if: ${{ env.devbuild == 'ON' }} - with: - name: test-coverage-fv3atm-${{ github.sha }} - path: | - ${{ github.workspace }}/build/*.html - ${{ github.workspace }}/build/*.css - - name: upload-docs uses: actions/upload-artifact@v4 if: ${{ env.devbuild == 'ON' }} From e4312e2c3746082e689c9a3ad96ac6ea196956b0 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Thu, 9 Jan 2025 09:08:12 -0700 Subject: [PATCH 03/12] working on docs workflow --- .github/workflows/docs.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 7cd53b527..9785f2420 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,11 +1,10 @@ # This is a CI workflow for the fv3atm project. # -# This workflow builds and tests the fv3atm library using GCC, and it tests -# different CMake build options. +# This workflow builds the fv3atm doxygen documentation. # -# Alex Richert, 6 Dec 2023 +# Ed Hartnett, 1/9/25 -name: GCC +name: docs on: push: branches: @@ -21,7 +20,7 @@ jobs: strategy: matrix: gcc_ver: ["12"] - mpi: ["mpich", "openmpi"] + mpi: ["mpich"] steps: From 985fb35d4aaf398282a7eb0d34fdc02cb762e8f1 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Thu, 9 Jan 2025 09:40:39 -0700 Subject: [PATCH 04/12] working on docs workflow --- .github/workflows/docs.yml | 2 +- CMakeLists.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 9785f2420..72750c74a 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -119,7 +119,7 @@ jobs: export CC=mpicc export CXX=mpicxx export FC=mpif90 - cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} -DENABLE_DOCS=ON ${{ env.gcov_cmake }} + cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} -DENABLE_FV3ATM_DOCS=ON ${{ env.gcov_cmake }} make -j2 - name: upload-docs diff --git a/CMakeLists.txt b/CMakeLists.txt index cdf597df2..15e64d18b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,10 +4,10 @@ cmake_minimum_required(VERSION 3.19) # Handle user build options. -option(ENABLE_DOCS "Enable generation of doxygen-based documentation." OFF) +option(ENABLE_FV3ATM_DOCS "Enable generation of doxygen-based documentation." OFF) # Determine whether or not to generate documentation. -if(ENABLE_DOCS) +if(ENABLE_FV3ATM_DOCS) find_package(Doxygen REQUIRED) add_subdirectory(docs) endif() From 16f0e4d16a6e4071ae1acf4a091cd2e0859478ff Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Thu, 9 Jan 2025 09:46:56 -0700 Subject: [PATCH 05/12] working on docs workflow --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 15e64d18b..cef00a251 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,6 +8,7 @@ option(ENABLE_FV3ATM_DOCS "Enable generation of doxygen-based documentation." OF # Determine whether or not to generate documentation. if(ENABLE_FV3ATM_DOCS) + message(STATUS "We will build the fv3atm doxygen documentation.") find_package(Doxygen REQUIRED) add_subdirectory(docs) endif() From f3a4e3b5acccb600f3064ced7d55037f8c7ce4e2 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Thu, 9 Jan 2025 09:48:17 -0700 Subject: [PATCH 06/12] working on docs workflow --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 72750c74a..1bfe8e867 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -106,7 +106,7 @@ jobs: path: ${{ github.workspace }}/spack-develop key: spack-${{ hashFiles('fv3atm/ci/spack.yaml') }}-gcc${{ matrix.gcc_ver }}-${{ matrix.mpi }} - - name: docs-build-fv3atm + - name: docs-build run: | . ${GITHUB_WORKSPACE}/spack-develop/share/spack/setup-env.sh spack env activate gcc${{ matrix.gcc_ver }} From f1d136fcc5730efcf1265d35b2e381c1f5b12512 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Thu, 9 Jan 2025 09:53:44 -0700 Subject: [PATCH 07/12] working on docs workflow --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 1bfe8e867..f566b2b67 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -120,7 +120,7 @@ jobs: export CXX=mpicxx export FC=mpif90 cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} -DENABLE_FV3ATM_DOCS=ON ${{ env.gcov_cmake }} - make -j2 + make doxygen_doc - name: upload-docs uses: actions/upload-artifact@v4 From 021c008d3aeaf69d7adc5415169e4a0980d81b81 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Thu, 9 Jan 2025 09:59:07 -0700 Subject: [PATCH 08/12] working on docs workflow --- docs/CMakeLists.txt | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 6273869d8..17ed6c084 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -2,16 +2,12 @@ # # Ed Hartnett 12/28/23 -IF(ENABLE_DOCS) - - # Create doxyfile. - SET(abs_top_srcdir "${CMAKE_SOURCE_DIR}") - SET(abs_top_builddir "${CMAKE_BINARY_DIR}") - CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) - ADD_CUSTOM_TARGET(doxygen_doc ALL - ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Generating API Documentation with Doxygen" VERBATIM) - -ENDIF(ENABLE_DOCS) +# Create doxyfile. +SET(abs_top_srcdir "${CMAKE_SOURCE_DIR}") +SET(abs_top_builddir "${CMAKE_BINARY_DIR}") +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY) +ADD_CUSTOM_TARGET(doxygen_doc ALL + ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating API Documentation with Doxygen" VERBATIM) From 2afb99e8b5fd0050b476f70001604f254f747fa8 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Thu, 9 Jan 2025 10:15:46 -0700 Subject: [PATCH 09/12] working on docs workflow --- docs/Doxyfile.in | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in index d89e7145e..e882a5ced 100644 --- a/docs/Doxyfile.in +++ b/docs/Doxyfile.in @@ -865,7 +865,6 @@ WARN_LOGFILE = # Note: If this tag is empty the current directory is searched. INPUT = @abs_top_srcdir@/docs/user_guide.md \ - @abs_top_srcdir@ \ @abs_top_srcdir@/ccpp \ @abs_top_srcdir@/cpl \ @abs_top_srcdir@/io \ From 8ac47163dc6d97fbcc902d647ea24c7fbd4acb9c Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Thu, 9 Jan 2025 10:19:00 -0700 Subject: [PATCH 10/12] working on docs workflow --- .github/workflows/GCC.yml | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/GCC.yml b/.github/workflows/GCC.yml index 86d0bf668..4f8bbf7b5 100644 --- a/.github/workflows/GCC.yml +++ b/.github/workflows/GCC.yml @@ -74,8 +74,8 @@ jobs: steps: - # Only do Doxygen and gcovr build for one job - - name: decide-doc-gcovr-build + # Only do gcovr build for one job + - name: decide-gcovr-build run: | if [[ "${{ matrix.cmake_opts }}" == "-D32BIT=ON" && "${{ matrix.gcc_ver }}" == 12 && "${{ matrix.mpi }}" == mpich ]]; then echo 'devbuild=ON' | tee -a ${GITHUB_ENV} @@ -86,7 +86,6 @@ jobs: - name: install-utilities run: | - sudo apt-get install doxygen graphviz python3 -m pip install gcovr - name: install-cmake @@ -121,7 +120,7 @@ jobs: export CC=mpicc export CXX=mpicxx export FC=mpif90 - cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} -DENABLE_DOCS=ON ${{ env.gcov_cmake }} + cmake ${GITHUB_WORKSPACE}/fv3atm -DBUILD_TESTING=ON ${{ matrix.cmake_opts }} ${{ env.gcov_cmake }} make -j2 - name: run-tests @@ -144,14 +143,6 @@ jobs: ${{ github.workspace }}/build/*.html ${{ github.workspace }}/build/*.css - - name: upload-docs - uses: actions/upload-artifact@v4 - if: ${{ env.devbuild == 'ON' }} - with: - name: docs-fv3atm - path: | - build/docs/html - - name: debug-artifacts uses: actions/upload-artifact@v4 if: ${{ failure() }} From cd12513d2b51d68fb05a5a3136fc36cc12db8b24 Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Thu, 9 Jan 2025 11:22:27 -0700 Subject: [PATCH 11/12] improved documentation --- docs/Doxyfile.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in index e882a5ced..5c4a8b8f4 100644 --- a/docs/Doxyfile.in +++ b/docs/Doxyfile.in @@ -864,6 +864,10 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. +# Note EJH: Add @abs_top_srcdir@ after doxygenating those code +# files. The comments in one of them are activating a bug in doxygen +# and need to be cleaned up to get a doxygen build working. + INPUT = @abs_top_srcdir@/docs/user_guide.md \ @abs_top_srcdir@/ccpp \ @abs_top_srcdir@/cpl \ From 08947e7bd44cc214b96993e9fdb973ec01e153da Mon Sep 17 00:00:00 2001 From: Edward Hartnett Date: Thu, 9 Jan 2025 11:27:10 -0700 Subject: [PATCH 12/12] improved naming --- .github/workflows/docs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index f566b2b67..fbc145e65 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -61,7 +61,7 @@ jobs: echo "spackrc=$?" >> ${GITHUB_ENV} spack clean --all - build_fv3atm: + build_docs: needs: build_spack runs-on: ubuntu-latest