Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bash linting to CI. Cleanup .sh scripts a bit. Address .sh bugs. Adds -v Verbose option. (#2218) Remove nowarn Intel compiler flag #2225

Merged
merged 76 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
02e289a
merge conflict through keeping upstream changes
BrianCurtis-NOAA Feb 22, 2024
59af98f
Address conflicts
BrianCurtis-NOAA Mar 6, 2024
bb77df4
Add super linter GH action
BrianCurtis-NOAA Mar 6, 2024
1b3001c
Remove some directories from being linted, for now
BrianCurtis-NOAA Mar 6, 2024
b6ece82
not sure if this is the right fix, but making sure exclude path works OK
BrianCurtis-NOAA Mar 6, 2024
44f2394
Maybe this is the way
BrianCurtis-NOAA Mar 6, 2024
7a29daa
Let's only check shell for now, but keep all options available for fu…
BrianCurtis-NOAA Mar 6, 2024
409117f
updated to skip directories
BrianCurtis-NOAA Mar 6, 2024
0dd460c
updated to skip directories try 2
BrianCurtis-NOAA Mar 6, 2024
af16d59
updated to skip directories try 3
BrianCurtis-NOAA Mar 6, 2024
e4edbc9
updated to skip directories try 4
BrianCurtis-NOAA Mar 6, 2024
d8f4680
updated to skip directories try 5
BrianCurtis-NOAA Mar 6, 2024
0f17662
cleanup rt.sh to pass shellcheck
BrianCurtis-NOAA Mar 8, 2024
978a86b
Update shell scripts to meet linter standards and address bugs associ…
BrianCurtis-NOAA Mar 21, 2024
689a697
Bring in less hard coded values for ecflow_run
BrianCurtis-NOAA Mar 22, 2024
c9b216b
Address merge conflicts
BrianCurtis-NOAA Mar 22, 2024
4b2a3d9
ecflow counter was off, would error out but not report anything
BrianCurtis-NOAA Mar 26, 2024
ce128f5
Not test opnReqTest stuff yet, needs work
BrianCurtis-NOAA Mar 26, 2024
b134a0d
rt.sh only verbose on request, cleanup more linting issues, make rt.s…
BrianCurtis-NOAA Mar 26, 2024
4f1855f
Trying to update superlinter to ignore any opnReqTests stuff
BrianCurtis-NOAA Mar 26, 2024
ef4d7c6
Don't parse atparse.bash
BrianCurtis-NOAA Mar 26, 2024
d2eb5d2
Add linter rules path to superlinter
BrianCurtis-NOAA Mar 26, 2024
9d61ef8
Trying something else for linter
BrianCurtis-NOAA Mar 27, 2024
868e34e
Maybe this time?
BrianCurtis-NOAA Mar 27, 2024
8a91d7f
Still not quite right, maybe this
BrianCurtis-NOAA Mar 27, 2024
c3b49a7
just guessing at this point
BrianCurtis-NOAA Mar 27, 2024
d997293
just guessing at this point #2
BrianCurtis-NOAA Mar 27, 2024
f88c535
Maybe just maybe?
BrianCurtis-NOAA Mar 27, 2024
b8b92bc
Ok this is working now, yay!
BrianCurtis-NOAA Mar 27, 2024
050a450
RT Utils updates with set -e
BrianCurtis-NOAA Mar 28, 2024
ad602af
Adjust for merge conflicts and fix issue with wcoss2 ssh test
BrianCurtis-NOAA Mar 28, 2024
cae2a1d
Need to make CMAKE_FLAGS into array for build.sh, fixes to exit prope…
BrianCurtis-NOAA Mar 29, 2024
206bbf4
Missing a couple quotes in build script
BrianCurtis-NOAA Mar 29, 2024
ac26b77
Update .gitmodules
DusanJovic-NOAA Apr 1, 2024
527dcd6
Update FV3
DusanJovic-NOAA Apr 1, 2024
c8681a8
Update stochastic_physics
DusanJovic-NOAA Apr 1, 2024
45378a9
Fix merge conflict
BrianCurtis-NOAA Apr 1, 2024
e9f3431
Fix shellcheck errors from recent merge
BrianCurtis-NOAA Apr 1, 2024
39c9ff2
Remove -nowarn from cmake/Intel.cmake
DusanJovic-NOAA Apr 1, 2024
1aacae5
Update stochastic_physics
DusanJovic-NOAA Apr 1, 2024
055fc55
Add ability to stop ecflow server ONLY if we start it with rt.sh, cha…
BrianCurtis-NOAA Apr 1, 2024
5058c4f
We should check for DISKNM/STMP/PTMP existing before moving too far i…
BrianCurtis-NOAA Apr 1, 2024
258c458
Fix some wording in echos, add more case statements, rework ecflow/ro…
BrianCurtis-NOAA Apr 1, 2024
eae7670
Touchup some files, add a little more verbosity for non-verbose runs
BrianCurtis-NOAA Apr 3, 2024
31d0be9
Fix logic so quota and timeout issues are identified
BrianCurtis-NOAA Apr 3, 2024
b7e64f6
Getting ready for PR
BrianCurtis-NOAA Apr 3, 2024
72e123e
Merge branch 'ufs-community:develop' into cleanup_scripts
BrianCurtis-NOAA Apr 3, 2024
968ca9a
Address merge conflict
BrianCurtis-NOAA Apr 4, 2024
8a68fdf
superlinter wants default branch origin/develop
BrianCurtis-NOAA Apr 4, 2024
42b47a7
Get rid of a bunch of commented out code, and small errors noticed in PR
BrianCurtis-NOAA Apr 4, 2024
f252b3d
Hera Log + test_changes.list
BrianCurtis-NOAA Apr 4, 2024
097b1df
Merge conflict with log
BrianCurtis-NOAA Apr 5, 2024
2b36094
Merge conflict fixed
BrianCurtis-NOAA Apr 11, 2024
ed55171
Merge branch 'develop' of github.com:ufs-community/ufs-weather-model …
BrianCurtis-NOAA Apr 15, 2024
e99222f
Merge branch 'develop' of github.com:ufs-community/ufs-weather-model …
BrianCurtis-NOAA Apr 15, 2024
2cf6c8f
Update FV3
DusanJovic-NOAA Apr 15, 2024
b097b0d
Merge remote-tracking branch 'origin/develop' into remove_nowarn
DusanJovic-NOAA Apr 15, 2024
c2da8e4
Merge branch 'remove_nowarn' of github.com:DusanJovic-NOAA/ufs-weathe…
BrianCurtis-NOAA Apr 15, 2024
684ddd6
Hera: No BL Change, test_changes.list addition
BrianCurtis-NOAA Apr 15, 2024
8d4fcd6
add hera RT log passed
FernandoAndrade-NOAA Apr 15, 2024
922b350
add gaea RT log passed
FernandoAndrade-NOAA Apr 15, 2024
53a8818
add orion RT logs: passed
zach1221 Apr 16, 2024
7a9cbc9
add hercules RT logs: passed
zach1221 Apr 16, 2024
585c66e
add jet RT log passed
FernandoAndrade-NOAA Apr 16, 2024
61ca0a2
Fixed issue with qstat on pbs scheduler in rt_utils
BrianCurtis-NOAA Apr 16, 2024
d5f1957
remove atmaq compile and follow up PR to re-enable test and compile
BrianCurtis-NOAA Apr 16, 2024
c3e85c9
WCOSS2 RT Log: Passed
BrianCurtis-NOAA Apr 16, 2024
06d66ee
Update to derecho pbs issues, pbs doesn't fail in a nice way, need to…
BrianCurtis-NOAA Apr 16, 2024
d43ccd1
Merge branch 'cleanup_scripts' of github.com:BrianCurtis-NOAA/ufs-wea…
BrianCurtis-NOAA Apr 16, 2024
9fd79a4
Update opnReqTest export RTVERBOSE variable
zach1221 Apr 16, 2024
c3606d7
add control_p8 ORT logs: passed
zach1221 Apr 16, 2024
5b03825
add regional_control ORT logs: passed
zach1221 Apr 16, 2024
1d53bb5
add cpld_control ORT logs: passed
zach1221 Apr 16, 2024
cddc583
add derecho RT logs: passed
zach1221 Apr 16, 2024
39021f1
Update FV3 hash and revert the FV3 .gitmodule
BrianCurtis-NOAA Apr 17, 2024
22e6274
Update stochastic_physics hash and revert its .gitmodules
BrianCurtis-NOAA Apr 17, 2024
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
37 changes: 37 additions & 0 deletions .github/workflows/superlinter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Super-Linter

on:
push: null
pull_request: null

jobs:
build:
name: Lint
runs-on: ubuntu-latest

permissions:
contents: read
packages: read
statuses: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Super-Linter
uses: super-linter/[email protected]
env:
LINTER_RULES_PATH: /
DEFAULT_BRANCH: origin/develop
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FILTER_REGEX_EXCLUDE: .*(tests/fv3_conf/.*|tests/ci/.*|tests/auto/.*|tests/auto-jenkins/.*|tests/opnReqTests/.*|tests/opnReqTest|tests/atparse.bash).*
VALIDATE_BASH: true
BASH_SEVERITY: style
#VALIDATE_GITHUB_ACTIONS: true
#VALIDATE_LUA: true
#VALIDATE_MARKDOWN: true
#VALIDATE_PYTHON_PYLINT: true
#VALIDATE_YAML: true
16 changes: 16 additions & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Global settings for Shellcheck (https://github.com/koalaman/shellcheck)
enable=all

external-sources=true

# Disable variable referenced but not assigned
disable=SC2154

# Disable following non-constant source
disable=SC1090

# Disable non-existent binary
disable=SC1091

# Disable -p -m only applies to deepest directory
disable=SC2174
2 changes: 1 addition & 1 deletion FV3
24 changes: 16 additions & 8 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,29 @@
#!/bin/bash
set -eu

if [[ $(uname -s) == Darwin ]]; then
readonly UFS_MODEL_DIR=$(cd "$(dirname "$(greadlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P)
uname_s=$(uname -s)
if [[ ${uname_s} == Darwin ]]; then
UFS_MODEL_DIR=$(greadlink -f -n "${BASH_SOURCE[0]}")
UFS_MODEL_DIR=$(dirname "${UFS_MODEL_DIR}")
UFS_MODEL_DIR=$(cd "${UFS_MODEL_DIR}" && pwd -P)
else
readonly UFS_MODEL_DIR=$(cd "$(dirname "$(readlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P)
UFS_MODEL_DIR=$(readlink -f -n "${BASH_SOURCE[0]}")
UFS_MODEL_DIR=$(dirname "${UFS_MODEL_DIR}")
UFS_MODEL_DIR=$(cd "${UFS_MODEL_DIR}" && pwd -P)
fi
echo "UFS MODEL DIR: ${UFS_MODEL_DIR}"
readonly UFS_MODEL_DIR

export CC=${CC:-mpicc}
export CXX=${CXX:-mpicxx}
export FC=${FC:-mpif90}

BUILD_DIR=${BUILD_DIR:-${UFS_MODEL_DIR}/build}
mkdir -p ${BUILD_DIR}
mkdir -p "${BUILD_DIR}"

cd ${BUILD_DIR}
cmake ${UFS_MODEL_DIR} ${CMAKE_FLAGS}
cd "${BUILD_DIR}"
ARR_CMAKE_FLAGS=()
for i in ${CMAKE_FLAGS}; do ARR_CMAKE_FLAGS+=("${i}") ; done
cmake "${UFS_MODEL_DIR}" "${ARR_CMAKE_FLAGS[@]}"
# Turn off OpenMP threading for parallel builds
# to avoid exhausting the number of user processes
OMP_NUM_THREADS=1 make -j ${BUILD_JOBS:-4} VERBOSE=${BUILD_VERBOSE:-}
OMP_NUM_THREADS=1 make -j "${BUILD_JOBS:-4}" "VERBOSE=${BUILD_VERBOSE:-1}"
8 changes: 7 additions & 1 deletion cmake/Intel.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -traceback -fpp -fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -nowarn -sox -align array64byte -qno-opt-dynamic-align")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -traceback -fpp -fno-alias -auto -safe-cray-ptr -ftz -assume byterecl -sox -align array64byte -qno-opt-dynamic-align")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -qno-opt-dynamic-align -sox -fp-model source")

# warning #5462: Global name too long.
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -diag-disable 5462")

# remark #7712: This variable has not been used.
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -diag-disable 7712")

if(CMAKE_Platform STREQUAL "derecho.intel")
set(CMAKE_Fortran_LINK_FLAGS "-Wl,--copy-dt-needed-entries")
endif()
Expand Down
97 changes: 49 additions & 48 deletions tests/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,73 +7,82 @@ function trim {
var="${var#"${var%%[![:space:]]*}"}"
# remove trailing whitespace characters
var="${var%"${var##*[![:space:]]}"}"
echo -n "$var"
echo -n "${var}"
}

SECONDS=0

if [[ $(uname -s) == Darwin ]]; then
readonly MYDIR=$(cd "$(dirname "$(greadlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P)
uname_s=$(uname -s)
if [[ ${uname_s} == Darwin ]]; then
greadlnk=$(greadlink -f -n "${BASH_SOURCE[0]}" )
MYDIR=$(cd "$(dirname "${greadlnk}" )" && pwd -P)
else
readonly MYDIR=$(cd "$(dirname "$(readlink -f -n "${BASH_SOURCE[0]}" )" )" && pwd -P)
readlnk=$(readlink -f -n "${BASH_SOURCE[0]}" )
MYDIR=$(cd "$(dirname "${readlnk}" )" && pwd -P)
fi
readonly MYDIR

# ----------------------------------------------------------------------
# Parse arguments.

readonly ARGC=$#

if [[ $ARGC -lt 2 ]]; then
echo "Usage: $0 MACHINE_ID [ MAKE_OPT [ COMPILE_ID ] [ RT_COMPILER ] [ clean_before ] [ clean_after ] ]"
if [[ ${ARGC} -lt 2 ]]; then
echo "Usage: $0 MACHINE_ID [ MAKE_OPT ] [ COMPILE_ID ] [ RT_COMPILER ] [ clean_before ] [ clean_after ]"
echo Valid MACHINE_IDs:
echo $( ls -1 ../cmake/configure_* | sed s:.*configure_::g | sed s:\.cmake:: ) | fold -sw72
echostuff=$( ls -1 ../cmake/configure_* )
echostuff=${echostuff/:.*configure_::g}
echostuff=${echostuff/:\.cmake::}
echostuff=$( fold -sw72 <<< "${echostuff}" )
exit 1
else
MACHINE_ID=$1
MAKE_OPT=${2:-}
COMPILE_ID=${3:+_$3}
COMPILE_ID=${3:+$3}
RT_COMPILER=${4:-intel}
clean_before=${5:-YES}
clean_after=${6:-YES}
fi

BUILD_NAME=fv3${COMPILE_ID}
BUILD_NAME=fv3_${COMPILE_ID}

PATHTR=${PATHTR:-$( cd ${MYDIR}/.. && pwd )}
PATHTR=${PATHTR:-$( cd "${MYDIR}/.." && pwd )}
BUILD_DIR=${BUILD_DIR:-$(pwd)/build_${BUILD_NAME}}

# ----------------------------------------------------------------------
# Make sure we have reasonable number of threads.

if [[ $MACHINE_ID == derecho ]]; then
if [[ ${MACHINE_ID} == derecho ]]; then
BUILD_JOBS=${BUILD_JOBS:-3}
fi

BUILD_JOBS=${BUILD_JOBS:-8}

hostname
#hostname

set +x
if [[ $MACHINE_ID == macosx ]] || [[ $MACHINE_ID == linux ]]; then
source $PATHTR/modulefiles/ufs_${MACHINE_ID}.${RT_COMPILER}
else
# Activate lua environment for gaea c5
if [[ $MACHINE_ID == gaea ]]; then
module reset
fi
# Load fv3 module
module use $PATHTR/modulefiles
modulefile="ufs_${MACHINE_ID}.${RT_COMPILER}"
module load $modulefile
module list
fi
case ${MACHINE_ID} in
macosx|linux)
source "${PATHTR}/modulefiles/ufs_${MACHINE_ID}.${RT_COMPILER}"
;;
*)
# Activate lua environment for gaea c5
if [[ ${MACHINE_ID} == gaea ]]; then
module reset
fi
# Load fv3 module
module use "${PATHTR}/modulefiles"
modulefile="ufs_${MACHINE_ID}.${RT_COMPILER}"
module load "${modulefile}"
module list
esac
set -x

echo "Compiling ${MAKE_OPT} into $BUILD_NAME.exe on $MACHINE_ID"
echo "Compiling ${MAKE_OPT} into ${BUILD_NAME}.exe on ${MACHINE_ID}"

# set CMAKE_FLAGS based on $MAKE_OPT

CMAKE_FLAGS=$MAKE_OPT
CMAKE_FLAGS=${MAKE_OPT}
CMAKE_FLAGS+=" -DMPI=ON"

if [[ ${MAKE_OPT} == *-DDEBUG=ON* ]]; then
Expand All @@ -87,15 +96,11 @@ fi

# Check if suites argument is provided or not
set +ex
TEST=$( echo $MAKE_OPT | grep -e "-DCCPP_SUITES=" )
if [[ $? -eq 0 ]]; then
SUITES=$( echo $MAKE_OPT | sed 's/.*-DCCPP_SUITES=//' | sed 's/ .*//' )
echo "Compiling suites ${SUITES}"
fi
SUITES=$(grep -Po "\-DCCPP_SUITES=\K[^ ]*" <<< "${MAKE_OPT}")
export SUITES
set -ex

# Valid applications

if [[ "${MAKE_OPT}" == *"-DAPP=S2S"* ]]; then
CMAKE_FLAGS+=" -DMOM6SOLO=ON"
fi
Expand All @@ -104,31 +109,27 @@ if [[ "${MAKE_OPT}" == *"-DAPP=NG-GODAS"* ]]; then
CMAKE_FLAGS+=" -DMOM6SOLO=ON"
fi

CMAKE_FLAGS=$(trim "${CMAKE_FLAGS}")
CMAKE_FLAGS=$(set -e; trim "${CMAKE_FLAGS}")
echo "CMAKE_FLAGS = ${CMAKE_FLAGS}"

if [ $clean_before = YES ] ; then
rm -rf ${BUILD_DIR}
fi
[[ ${clean_before} = YES ]] && rm -rf "${BUILD_DIR}"

export BUILD_VERBOSE=1
export BUILD_DIR
export BUILD_JOBS
export CMAKE_FLAGS

bash -x ${PATHTR}/build.sh
bash -x "${PATHTR}/build.sh"

mv ${BUILD_DIR}/ufs_model ${PATHTR}/tests/${BUILD_NAME}.exe
if [[ $MACHINE_ID == linux ]]; then
cp ${PATHTR}/modulefiles/ufs_${MACHINE_ID}.${RT_COMPILER} ${PATHTR}/tests/modules.${BUILD_NAME}
mv "${BUILD_DIR}/ufs_model" "${PATHTR}/tests/${BUILD_NAME}.exe"
if [[ ${MACHINE_ID} == linux ]]; then
cp "${PATHTR}/modulefiles/ufs_${MACHINE_ID}.${RT_COMPILER}" "${PATHTR}/tests/modules.${BUILD_NAME}"
else
cp ${PATHTR}/modulefiles/ufs_${MACHINE_ID}.${RT_COMPILER}.lua ${PATHTR}/tests/modules.${BUILD_NAME}.lua
cp "${PATHTR}/modulefiles/ufs_${MACHINE_ID}.${RT_COMPILER}.lua" "${PATHTR}/tests/modules.${BUILD_NAME}.lua"
fi

if [ $clean_after = YES ] ; then
rm -rf ${BUILD_DIR}
fi
[[ ${clean_after} == YES ]] && rm -rf "${BUILD_DIR}"

elapsed=$SECONDS
echo "Elapsed time $elapsed seconds. Compiling ${CMAKE_FLAGS} finished"
echo "Compile ${COMPILE_ID/#_} elapsed time $elapsed seconds. ${CMAKE_FLAGS}" > compile${COMPILE_ID}_time.log
elapsed=${SECONDS}
echo "Elapsed time ${elapsed} seconds. Compiling ${CMAKE_FLAGS} finished"
echo "Compile ${COMPILE_ID} elapsed time ${elapsed} seconds. ${CMAKE_FLAGS}" > "compile_${COMPILE_ID}_time.log"
Loading
Loading