Skip to content

Commit eb3005f

Browse files
committed
Update SHORTFIN_IREE_GIT_TAG via script and workflow.
1 parent 81e381f commit eb3005f

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

.github/workflows/update_iree_requirement_pins.yml

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
${{ env.CURRENT_IREE_BASE_COMPILER_VERSION }} != ${{ env.LATEST_IREE_BASE_COMPILER_VERSION }} || \
3535
${{ env.CURRENT_IREE_BASE_RUNTIME_VERSION }} != ${{ env.LATEST_IREE_BASE_RUNTIME_VERSION }} || \
3636
${{ env.CURRENT_IREE_TURBINE_VERSION }} != ${{ env.LATEST_IREE_TURBINE_VERSION }}
37+
${{ env.CURRENT_SHORTFIN_IREE_GIT_TAG }} != ${{ env.LATEST_SHORTFIN_IREE_GIT_TAG }}
3738
uses: peter-evans/create-pull-request@67ccf781d68cd99b580ae25a5c18a1cc84ffff1f # v7.0.6
3839
with:
3940
token: ${{ secrets.GITHUB_TOKEN }}

build_tools/update_iree_requirement_pins.py

+28
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
REPO_ROOT = Path(__file__).parent.parent
3131
REQUIREMENTS_IREE_PINNED_PATH = REPO_ROOT / "requirements-iree-pinned.txt"
32+
SHORTFIN_CMAKELISTS_PATH = REPO_ROOT / "shortfin" / "CMakeLists.txt"
3233

3334

3435
def get_current_version(package_name):
@@ -82,12 +83,19 @@ def get_latest_version(package_name, extra_pip_args=[]):
8283
return version
8384

8485

86+
def get_current_git_tag():
87+
with open(SHORTFIN_CMAKELISTS_PATH, "r") as f:
88+
text = f.read()
89+
return re.findall('SHORTFIN_IREE_GIT_TAG "(.*)"', text)[0]
90+
91+
8592
def main():
8693
print("Updating IREE version pins!")
8794

8895
current_compiler_version = get_current_version("iree-base-compiler")
8996
current_runtime_version = get_current_version("iree-base-runtime")
9097
current_turbine_version = get_current_version("iree-turbine")
98+
current_git_tag = get_current_git_tag()
9199

92100
nightly_pip_args = [
93101
"--pre",
@@ -97,16 +105,22 @@ def main():
97105
latest_compiler_version = get_latest_version("iree-base-compiler", nightly_pip_args)
98106
latest_runtime_version = get_latest_version("iree-base-runtime", nightly_pip_args)
99107
latest_turbine_version = get_latest_version("iree-turbine", nightly_pip_args)
108+
# TODO(scotttodd): Get this from git? It should generally be in sync with
109+
# the python packages and follow a naming convention. If that isn't
110+
# true, such as right after a stable release, then this may break.
111+
latest_git_tag = f"iree-{latest_runtime_version}"
100112

101113
print("\n-------------------------------------------------------------------------")
102114
print("Current versions:")
103115
print(f" iree-base-compiler=={current_compiler_version}")
104116
print(f" iree-base-runtime=={current_runtime_version}")
105117
print(f" iree-turbine=={current_turbine_version}")
118+
print(f' SHORTFIN_IREE_GIT_TAG "{current_git_tag}"')
106119
print("Latest versions:")
107120
print(f" iree-base-compiler=={latest_compiler_version}")
108121
print(f" iree-base-runtime=={latest_runtime_version}")
109122
print(f" iree-turbine=={latest_turbine_version}")
123+
print(f' SHORTFIN_IREE_GIT_TAG "{latest_git_tag}"')
110124

111125
# Write to GitHub Actions environment variables for future steps to use if they want.
112126
github_env = os.getenv("GITHUB_ENV")
@@ -120,16 +134,19 @@ def main():
120134
f"CURRENT_IREE_BASE_RUNTIME_VERSION={current_runtime_version}", file=fh
121135
)
122136
print(f"CURRENT_IREE_TURBINE_VERSION={current_turbine_version}", file=fh)
137+
print(f"CURRENT_SHORTFIN_IREE_GIT_TAG={current_git_tag}", file=fh)
123138
print(
124139
f"LATEST_IREE_BASE_COMPILER_VERSION={latest_compiler_version}", file=fh
125140
)
126141
print(f"LATEST_IREE_BASE_RUNTIME_VERSION={latest_runtime_version}", file=fh)
127142
print(f"LATEST_IREE_TURBINE_VERSION={latest_turbine_version}", file=fh)
143+
print(f"LATEST_SHORTFIN_IREE_GIT_TAG={latest_git_tag}", file=fh)
128144

129145
if (
130146
current_compiler_version == latest_compiler_version
131147
and current_runtime_version == latest_runtime_version
132148
and current_turbine_version == latest_turbine_version
149+
and current_git_tag == latest_git_tag
133150
):
134151
print("Already using the latest versions, exiting")
135152
return
@@ -159,6 +176,17 @@ def main():
159176
with open(REQUIREMENTS_IREE_PINNED_PATH, "w") as f:
160177
f.write(text)
161178

179+
print(f"Editing git tag in '{SHORTFIN_CMAKELISTS_PATH}'")
180+
with open(SHORTFIN_CMAKELISTS_PATH, "r") as f:
181+
text = f.read()
182+
text = re.sub(
183+
'SHORTFIN_IREE_GIT_TAG ".*"',
184+
f'SHORTFIN_IREE_GIT_TAG "{latest_git_tag}"',
185+
text,
186+
)
187+
with open(SHORTFIN_CMAKELISTS_PATH, "w") as f:
188+
f.write(text)
189+
162190
print("-------------------------------------------------------------------------")
163191
print("Edits complete")
164192

0 commit comments

Comments
 (0)