Skip to content

Commit f09c7e2

Browse files
authored
Add --release option for script to update dependencies (#6033)
Added the new command line option `--release` to the script `update_dependencies.py` which automatically uses the version tag (e.g., `25.07`) instead of the commit hash to replace the commit field in the dependencies file.
1 parent d522b81 commit f09c7e2

File tree

4 files changed

+42
-12
lines changed

4 files changed

+42
-12
lines changed

Docs/source/maintenance/release.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ The script ``update_dependencies.py`` from `Tools/Release/update_dependencies.py
1919
--pyamrex Update pyAMReX only
2020
--picsar Update PICSAR only
2121
--warpx Update WarpX only
22+
--release New release
2223
2324
Create a new WarpX release
2425
--------------------------
@@ -34,6 +35,7 @@ In order to create a GitHub release, you need to:
3435
The script above can be used to update the core dependencies of WarpX and the WarpX version.
3536

3637
For a WarpX release, ideally a *git tag* of AMReX & PICSAR shall be used instead of an unnamed commit.
38+
This can be done by running the script above with the command line option ``--release``.
3739

3840
Then open a PR, wait for tests to pass and then merge.
3941

Tools/Release/releasePR.py

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,11 @@ def concat_answers(answers):
7474
answers = concat_answers(["y", AMReX_version, AMReX_version, "y"])
7575

7676
process = subprocess.Popen(
77-
[Path(REPO_DIR).joinpath("Tools/Release/update_dependencies.py"), "--amrex"],
77+
[
78+
Path(REPO_DIR).joinpath("Tools/Release/update_dependencies.py"),
79+
"--amrex",
80+
"--release",
81+
],
7882
stdin=subprocess.PIPE,
7983
stdout=subprocess.PIPE,
8084
stderr=subprocess.PIPE,
@@ -97,7 +101,11 @@ def concat_answers(answers):
97101
answers = concat_answers(["y", PICSAR_version, PICSAR_version, "y"])
98102

99103
process = subprocess.Popen(
100-
[Path(REPO_DIR).joinpath("Tools/Release/update_dependencies.py"), "--picsar"],
104+
[
105+
Path(REPO_DIR).joinpath("Tools/Release/update_dependencies.py"),
106+
"--picsar",
107+
"--release",
108+
],
101109
stdin=subprocess.PIPE,
102110
stdout=subprocess.PIPE,
103111
stderr=subprocess.PIPE,
@@ -120,7 +128,11 @@ def concat_answers(answers):
120128
answers = concat_answers(["y", pyAMReX_version, pyAMReX_version, "y"])
121129

122130
process = subprocess.Popen(
123-
[Path(REPO_DIR).joinpath("Tools/Release/update_dependencies.py"), "--pyamrex"],
131+
[
132+
Path(REPO_DIR).joinpath("Tools/Release/update_dependencies.py"),
133+
"--pyamrex",
134+
"--release",
135+
],
124136
stdin=subprocess.PIPE,
125137
stdout=subprocess.PIPE,
126138
stderr=subprocess.PIPE,
@@ -142,7 +154,11 @@ def concat_answers(answers):
142154
answers = concat_answers(["y", WarpX_version_yr, WarpX_version_mn, "", "", "y"])
143155

144156
process = subprocess.Popen(
145-
[Path(REPO_DIR).joinpath("Tools/Release/update_dependencies.py"), "--warpx"],
157+
[
158+
Path(REPO_DIR).joinpath("Tools/Release/update_dependencies.py"),
159+
"--warpx",
160+
"--release",
161+
],
146162
stdin=subprocess.PIPE,
147163
stdout=subprocess.PIPE,
148164
stderr=subprocess.PIPE,
@@ -174,14 +190,15 @@ def concat_answers(answers):
174190
f"""Prepare the {datetime.now().strftime("%B")} release of WarpX:
175191
```bash
176192
# update dependencies
177-
./Tools/Release/update_dependencies.py --amrex
178-
./Tools/Release/update_dependencies.py --picsar # no changes, still {PICSAR_version}
179-
./Tools/Release/update_dependencies.py --pyamrex
193+
./Tools/Release/update_dependencies.py --amrex --release
194+
./Tools/Release/update_dependencies.py --picsar --release # no changes, still {PICSAR_version}
195+
./Tools/Release/update_dependencies.py --pyamrex --release
180196
# bump version number
181-
./Tools/Release/update_dependencies.py --warpx
197+
./Tools/Release/update_dependencies.py --warpx --release
182198
```
183199
184-
Following this workflow: https://warpx.readthedocs.io/en/latest/maintenance/release.html
200+
This pull request was created with the script `./Tools/Release/releasePR.py`,
201+
following the instructions described in https://warpx.readthedocs.io/en/latest/maintenance/release.html#create-a-new-warpx-release.
185202
""",
186203
"--label",
187204
"component: documentation",

Tools/Release/update_dependencies.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,18 @@ def update(args):
6363
repo_commit = repo_gh.json()["sha"]
6464
# set new repository version
6565
repo_version = datetime.date.today().strftime("%y.%m")
66+
# use version tag for new release
67+
new_commit = repo_version if args.release else repo_commit
6668
# update repository commit
6769
if repo_name != "warpx":
6870
print(f"- old commit: {dependencies_data[commit_key]}")
69-
print(f"- new commit: {repo_commit}")
71+
print(f"- new commit: {new_commit}")
7072
proceed = input("Do you want to continue? [y/n] ")
7173
if proceed not in ["y", "Y"]:
7274
print("Skipping commit update...")
7375
else:
7476
print("Updating commit...")
75-
dependencies_data[f"commit_{repo_name}"] = repo_commit
77+
dependencies_data[f"commit_{repo_name}"] = new_commit
7678
# update repository version
7779
print(f"- old version: {dependencies_data[version_key]}")
7880
print(f"- new version: {repo_version}")
@@ -124,6 +126,14 @@ def update(args):
124126
dest="warpx",
125127
)
126128

129+
# add arguments: release option
130+
parser.add_argument(
131+
"--release",
132+
help="New release",
133+
action="store_true",
134+
dest="release",
135+
)
136+
127137
# parse arguments
128138
args = parser.parse_args()
129139

Tools/Release/weeklyUpdate.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ def concat_answers(answers):
168168
./Tools/Release/update_dependencies.py --picsar
169169
```
170170
171-
This pull request was created with this script: `./Tools/Release/weeklyUpdate.py`
171+
This pull request was created with the script `./Tools/Release/weeklyUpdate.py`,
172+
following the instructions described in https://warpx.readthedocs.io/en/latest/maintenance/release.html#update-warpx-core-dependencies.
172173
""",
173174
"--label",
174175
"component: documentation",

0 commit comments

Comments
 (0)