Skip to content

Commit 4cc6ac8

Browse files
authored
ci(dist): fix distribution scripts, update validations (#1553)
* fix build_docs() usage in build_dist.py * check meson.options exists in check_dist.py * misc: only one compiler compatibility PR at a time * minor cleanup
1 parent 657b2b9 commit 4cc6ac8

File tree

3 files changed

+32
-31
lines changed

3 files changed

+32
-31
lines changed

.github/workflows/compilers.yml

+9-7
Original file line numberDiff line numberDiff line change
@@ -344,21 +344,23 @@ jobs:
344344
env:
345345
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
346346
run: |
347+
# one at a time
348+
head="compat"
349+
id=$(gh pr list -H $head -s open --json id -q ".[0].id")
350+
[[ -n "${id// /}" ]] && (echo "PR already open"; exit 0) || (echo "opening PR")
351+
347352
# setup bot user
348353
git config user.name "github-actions[bot]"
349354
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
350355
351356
# create new branch
352-
now=$(date +'%Y-%m-%dT%H-%M-%S')
353-
updated_branch="compat_$now"
354-
default_branch="${{ github.event.repository.default_branch }}"
355-
git switch -c "$updated_branch"
357+
git switch -c "$head"
356358
357-
# commit wide CSVs and Markdown tables and push branch
359+
# commit and push
358360
git add DEVELOPER.md .github/compat/comp.csv .github/compat/test.csv
359361
git commit -m "Update compatibility tables"
360-
git push -u origin "$updated_branch"
362+
git push -u origin "$head"
361363
362364
# open PR
363365
cat <(echo '### Compile') <(echo) .github/compat/comp.md <(echo) <(echo '### Test') <(echo) .github/compat/test.md > compat.md
364-
gh pr create -B "$default_branch" -H "$updated_branch" --title "Update compile/test compatibility tables" --body-file compat.md
366+
gh pr create -B "${{ github.event.repository.default_branch }}" -H "$head" --title "Update compile/test compatibility tables" --body-file compat.md

distribution/build_dist.py

+20-20
Original file line numberDiff line numberDiff line change
@@ -304,29 +304,29 @@ def build_distribution(
304304
shutil.copy(_project_root_path / "code.json", output_path)
305305

306306
# full releases include examples, source code, makefiles and docs
307-
if full:
308-
# examples
309-
setup_examples(
310-
bin_path=output_path / "bin",
311-
examples_path=output_path / "examples",
312-
overwrite=overwrite,
313-
)
307+
if not full:
308+
return
309+
310+
# examples
311+
setup_examples(
312+
bin_path=output_path / "bin",
313+
examples_path=output_path / "examples",
314+
overwrite=overwrite,
315+
)
314316

315-
# copy source code files
316-
copy_sources(output_path=output_path)
317+
# copy source code files
318+
copy_sources(output_path=output_path)
317319

318-
# build and copy makefiles
319-
build_makefiles(output_path=output_path)
320+
# build and copy makefiles
321+
build_makefiles(output_path=output_path)
320322

321-
# docs
322-
build_documentation(
323-
bin_path=output_path / "bin",
324-
output_path=output_path / "doc",
325-
examples_repo_path=examples_repo_path,
326-
# benchmarks_path=_benchmarks_path / "run-time-comparison.md",
327-
full=full,
328-
overwrite=overwrite,
329-
)
323+
# docs
324+
build_documentation(
325+
bin_path=output_path / "bin",
326+
full=full,
327+
output_path=output_path / "doc",
328+
overwrite=overwrite,
329+
)
330330

331331

332332
@requires_exe("pdflatex")

distribution/check_dist.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,18 @@ def test_sources(dist_dir_path, releasemode, full):
7575
if not full:
7676
pytest.skip(reason="sources not included in minimal distribution")
7777

78+
assert (dist_dir_path / "meson.build").is_file()
79+
assert (dist_dir_path / "meson.options").is_file()
7880
assert (dist_dir_path / "src").is_dir()
7981
assert (dist_dir_path / "src" / "mf6.f90").is_file()
80-
8182
version_file_path = dist_dir_path / "src" / "Utilities" / "version.f90"
8283
assert version_file_path.is_file()
8384

84-
# find IDEVELOPMODE line
85+
# check IDEVELOPMODE
8586
lines = open(version_file_path, "r").read().splitlines()
8687
pattern = ":: IDEVELOPMODE ="
8788
line = next(iter([l for l in lines if pattern in l]), None)
8889
assert line
89-
90-
# make sure IDEVELOPMODE was set correctly
9190
idevelopmode = 0 if releasemode else 1
9291
assert f"IDEVELOPMODE = {idevelopmode}" in line
9392

0 commit comments

Comments
 (0)