Skip to content

Commit 376367e

Browse files
authored
Add git-fleximod ci test (#281)
Updates git-fleximod to v8.4 and adds the git-fleximod github workflow. Describe any changes made to build system: N/A Describe any changes made to the namelist: N/A List any changes to the defaults for the boundary datasets: N/A Describe any substantial timing or memory changes: N/A Code reviewed by: cacraigucar, mwaxmonsky, nusbaume List all existing files that have been modified, old files eliminated, new files added and describe the changes: A .github/workflows/fleximod_test.yaml derecho/intel/aux_cam: all tests pass derecho/gnu/aux_cam: all tests pass Summarize any changes to answers, i.e., what code configurations: N/A what platforms/compilers: N/A nature of change (roundoff; larger than roundoff but same climate; new climate): N/A
2 parents 8d71300 + 9fd0528 commit 376367e

File tree

6 files changed

+52
-20
lines changed

6 files changed

+52
-20
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
on:
2+
pull_request:
3+
jobs:
4+
fleximod-test:
5+
runs-on: ubuntu-latest
6+
strategy:
7+
matrix:
8+
# oldest supported and latest supported
9+
python-version: ["3.8", "3.x"]
10+
steps:
11+
- id: checkout-CESM
12+
uses: actions/checkout@v4
13+
- id: run-fleximod
14+
run: |
15+
$GITHUB_WORKSPACE/bin/git-fleximod update
16+
$GITHUB_WORKSPACE/bin/git-fleximod test
17+
18+

.lib/git-fleximod/git_fleximod/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import argparse
33
from git_fleximod import utils
44

5-
__version__ = "0.8.2"
5+
__version__ = "0.8.4"
66

77
def find_root_dir(filename=".gitmodules"):
88
""" finds the highest directory in tree

.lib/git-fleximod/git_fleximod/git_fleximod.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,18 +195,19 @@ def submodules_status(gitmodules, root_dir, toplevel=False, depth=0):
195195
submod = init_submodule_from_gitmodules(gitmodules, name, root_dir, logger)
196196

197197
result,n,l,t = submod.status()
198-
testfails += t
199-
localmods += l
200-
needsupdate += n
201198
if toplevel or not submod.toplevel():
202199
print(wrapper.fill(result))
203-
subdir = os.path.join(root_dir, submod.path)
204-
if os.path.exists(os.path.join(subdir, ".gitmodules")):
205-
submod = GitModules(logger, confpath=subdir)
206-
t,l,n = submodules_status(submod, subdir, depth=depth+1)
207200
testfails += t
208201
localmods += l
209202
needsupdate += n
203+
subdir = os.path.join(root_dir, submod.path)
204+
if os.path.exists(os.path.join(subdir, ".gitmodules")):
205+
gsubmod = GitModules(logger, confpath=subdir)
206+
t,l,n = submodules_status(gsubmod, subdir, depth=depth+1)
207+
if toplevel or not submod.toplevel():
208+
testfails += t
209+
localmods += l
210+
needsupdate += n
210211

211212
return testfails, localmods, needsupdate
212213

.lib/git-fleximod/git_fleximod/submodule.py

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def status(self):
9292
needsupdate = True
9393
else:
9494
result = f"e {self.name:>20} has no fxtag defined in .gitmodules{optional}"
95-
testfails = True
95+
testfails = False
9696
else:
9797
with utils.pushd(smpath):
9898
git = GitInterface(smpath, self.logger)
@@ -103,15 +103,23 @@ def status(self):
103103
needsupdate = True
104104
return result, needsupdate, localmods, testfails
105105
rurl = git.git_operation("ls-remote","--get-url").rstrip()
106-
line = git.git_operation("log", "--pretty=format:\"%h %d").partition('\n')[0]
106+
line = git.git_operation("log", "--pretty=format:\"%h %d\"").partition('\n')[0]
107107
parts = line.split()
108108
ahash = parts[0][1:]
109+
atag = None
109110
if len(parts) > 3:
110-
atag = parts[3][:-1]
111-
else:
112-
atag = None
111+
idx = 0
112+
while idx < len(parts)-1:
113+
idx = idx+1
114+
if parts[idx] == 'tag:':
115+
atag = parts[idx+1]
116+
while atag.endswith(')') or atag.endswith(',') or atag.endswith("\""):
117+
atag = atag[:-1]
118+
if atag == self.fxtag:
119+
break
120+
113121

114-
#print(f"line is {line} ahash is {ahash} atag is {atag}")
122+
#print(f"line is {line} ahash is {ahash} atag is {atag} {parts}")
115123
# atag = git.git_operation("describe", "--tags", "--always").rstrip()
116124
# ahash = git.git_operation("rev-list", "HEAD").partition("\n")[0]
117125

@@ -122,9 +130,11 @@ def status(self):
122130
if self.fxtag and atag == self.fxtag:
123131
result = f" {self.name:>20} at tag {self.fxtag}"
124132
recurse = True
125-
elif self.fxtag and ahash[: len(self.fxtag)] == self.fxtag:
133+
testfails = False
134+
elif self.fxtag and (ahash[: len(self.fxtag)] == self.fxtag or (self.fxtag.find(ahash)==0)):
126135
result = f" {self.name:>20} at hash {ahash}"
127136
recurse = True
137+
testfails = False
128138
elif atag == ahash:
129139
result = f" {self.name:>20} at hash {ahash}"
130140
recurse = True
@@ -133,14 +143,17 @@ def status(self):
133143
testfails = True
134144
needsupdate = True
135145
else:
136-
result = f"e {self.name:>20} has no fxtag defined in .gitmodules, module at {atag}"
137-
testfails = True
146+
if atag:
147+
result = f"e {self.name:>20} has no fxtag defined in .gitmodules, module at {atag}"
148+
else:
149+
result = f"e {self.name:>20} has no fxtag defined in .gitmodules, module at {ahash}"
150+
testfails = False
138151

139152
status = git.git_operation("status", "--ignore-submodules", "-uno")
140153
if "nothing to commit" not in status:
141154
localmods = True
142155
result = "M" + textwrap.indent(status, " ")
143-
156+
# print(f"result {result} needsupdate {needsupdate} localmods {localmods} testfails {testfails}")
144157
return result, needsupdate, localmods, testfails
145158

146159

.lib/git-fleximod/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "git-fleximod"
3-
version = "0.8.2"
3+
version = "0.8.4"
44
description = "Extended support for git-submodule and git-sparse-checkout"
55
authors = ["Jim Edwards <jedwards@ucar.edu>"]
66
maintainers = ["Jim Edwards <jedwards@ucar.edu>"]

.lib/git-fleximod/tbump.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
github_url = "https://github.com/jedwards4b/git-fleximod/"
33

44
[version]
5-
current = "0.8.2"
5+
current = "0.8.4"
66

77
# Example of a semver regexp.
88
# Make sure this matches current_version before

0 commit comments

Comments
 (0)