File tree Expand file tree Collapse file tree 3 files changed +39
-4
lines changed
Expand file tree Collapse file tree 3 files changed +39
-4
lines changed Original file line number Diff line number Diff line change 1717 - name : Install pre-commit
1818 run : |
1919 pip install pre-commit
20-
2120 - name : Run lint via pre-commit
2221 run : |
2322 pre-commit run --all-files
23+
24+ - name : Check advection code consistency
25+ run : |
26+ ./.github/workflows/scripts/ensure_xppm_yppm_consistency.sh
Original file line number Diff line number Diff line change 11#! /bin/bash
22#
3- # Script to convert xppm.py/xtp_u.py into yppm/ytp_v.py. Can be deleted once we
4- # have a way to use the same codebase for x-direction and y-direction advection.
3+ # Script to automatically convert `xppm.py` and `xtp_u.py` into `yppm.py` and
4+ # `ytp_v.py` respectively. We use it as part of the linting workflow in the CI
5+ # to ensure these files stay in sync.
56#
7+ # This script (and the corresponding linting workflow) can be deleted once we
8+ # have a way to use the same codebase for x-direction and y-direction advection.
69
7- set -e -x
10+ set -e
811
12+ # Copy XPPM codes into YPPM files
913cp pyFV3/stencils/xppm.py pyFV3/stencils/yppm.py
1014cp pyFV3/stencils/xtp_u.py pyFV3/stencils/ytp_v.py
1115
16+ # Fixup YPPM code
1217for fname in pyFV3/stencils/yppm.py pyFV3/stencils/ytp_v.py
1318do
1419 sed -i ' s/ub/vb/g' $fname
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Call the automatic conversion
4+ ./.github/workflows/scripts/convert_xppm_yppm.sh
5+
6+ # Check for uncommitted changes in the working tree
7+ if [ -n " $( git status --porcelain) " ]; then
8+ echo " It looks like x-direction and y-direction advection are out of sync. We found uncommitted"
9+ echo " changes in working tree after YPPM was generated from XPPM sources. Please ensure to make"
10+ echo " symmetrical changes to XPPM and YPPM codes."
11+ echo " "
12+ echo " If this is a false positive, please fix \" .github/workflows/scripts/convert_xppm_yppm.sh\" "
13+ echo " or re-evaluate the need for this part of the linting workflow."
14+ echo " "
15+ echo " git status"
16+ echo " ----------"
17+ git status
18+ echo " "
19+ echo " git diff"
20+ echo " --------"
21+ git --no-pager diff
22+ echo " "
23+
24+ exit 1
25+ else
26+ echo " XPPM and YPPM are in sync."
27+ fi
You can’t perform that action at this time.
0 commit comments