diff --git a/.github/workflows/Spack.yml b/.github/workflows/Spack.yml index 10ea64e897..a7c8b23ed6 100644 --- a/.github/workflows/Spack.yml +++ b/.github/workflows/Spack.yml @@ -20,7 +20,7 @@ jobs: os: "ubuntu-24.04", app: "S2SWA", ccpp_suites: "FV3_GFS_v17_coupled_p8,FV3_GFS_v17_coupled_p8_ugwpv1", - other-variants: ' ^esmf@8.8.0', + other-variants: ' +debug ^esmf@8.8.0', } - { os: "ubuntu-24.04", @@ -57,6 +57,18 @@ jobs: # Set to save to a different cache key than the restored one (in order to add new packages etc.). # Be sure to unset it after a new cache is generated or a new one will be created each time! repo-save-key-suffix: '' + # Add verbose to see compiler warnings in the console + spack-install-flags: -v + + - name: "Upload Spack Build Logs" + if: always() # Run this even if the build fails + uses: actions/upload-artifact@v4 + with: + name: spack-build-logs-${{ matrix.config.app }} + path: | + **/spack-build-out.txt + **/spack-build-env.txt + **/spack-configure-args.txt # The recipe-check job validates the Spack recipe by making sure each CMake # build option is represented. If this check fails due to the addition of a @@ -73,3 +85,71 @@ jobs: with: recipe-file: package/spack/package.py cmakelists-txt: package/CMakeLists.txt + + # Add job for reviewdog to check legacy or new warnings + reviewdog-warnings: + name: Check Compiler Warnings + runs-on: ubuntu-latest + needs: [Spack] + # success() || failure() ensures it runs if Spack fails, but safely skips if you cancel the workflow + if: success() || failure() + + permissions: + contents: read + pull-requests: write + checks: write # REQUIRED for the github-check reporter + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Setup Reviewdog + uses: reviewdog/action-setup@v1 + with: + reviewdog_version: latest + + - name: Download All Spack Build Logs + uses: actions/download-artifact@v4 + with: + pattern: spack-build-logs-* + # Note: merge-multiple is removed. Logs will safely stay in their own subfolders. + path: ./spack-logs + + - name: Debug Downloaded Artifacts + run: | + echo "=== What spack-logs files are in download? ===" + find ./spack-logs -type f + + - name: Run Reviewdog + env: + REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # 1. Stitch and clean the logs, saving them to a temporary file + find ./spack-logs -type f -name "*build-out*" -exec cat {} + | \ + awk '/^\/.*:[0-9]+:([0-9]+:)?/ { loc=$1 } /^[Ww]arning:/ { if(loc!="") { print loc " " $0; loc="" } }' | \ + sed 's|.*/spack-devpkg-ufs-weather-model/||' > cleaned_warnings.txt + + # 2. Generate the full "Checks" tab summary + cat cleaned_warnings.txt | reviewdog \ + -name="Legacy Warnings Summary" \ + -reporter=github-check \ + -level=warning \ + -fail-level=none \ + -efm="%f:%l:%c: Warning: %m" \ + -efm="%f:%l:%c: warning: %m" \ + -efm="%f:%l: Warning: %m" \ + -efm="%f:%l: warning: %m" + + # 3. Post inline PR comments for NEW warnings if pull request + if [ "${{ github.event_name }}" == "pull_request" ]; then + cat cleaned_warnings.txt | reviewdog \ + -name="New PR Warnings" \ + -reporter=github-pr-review \ + -filter-mode=added \ + -fail-level=any \ + -level=warning \ + -efm="%f:%l:%c: Warning: %m" \ + -efm="%f:%l:%c: warning: %m" \ + -efm="%f:%l: Warning: %m" \ + -efm="%f:%l: warning: %m" + fi diff --git a/cmake/GNU.cmake b/cmake/GNU.cmake index 29ccc20fab..54c4d567f0 100644 --- a/cmake/GNU.cmake +++ b/cmake/GNU.cmake @@ -12,6 +12,7 @@ endif() if(DEBUG) add_definitions(-DDEBUG) set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -O0 -fno-unsafe-math-optimizations -frounding-math -fsignaling-nans -ffpe-trap=invalid,zero,overflow -fbounds-check") + set(CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -Wall -Wextra -Wimplicit-interface") # https://github.com/ufs-community/ufs-weather-model/issues/2155 if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND ${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "arm64") set( CMAKE_Fortran_FLAGS_DEBUG "${CMAKE_Fortran_FLAGS_DEBUG} -mcmodel=small" )