Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 81 additions & 1 deletion .github/workflows/Spack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand All @@ -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
1 change: 1 addition & 0 deletions cmake/GNU.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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" )
Expand Down
Loading