Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(dist): fix distribution scripts, update validations #1553

Merged
merged 2 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions .github/workflows/compilers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -344,21 +344,23 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# one at a time
head="compat"
id=$(gh pr list -H $head -s open --json id -q ".[0].id")
[[ -n "${id// /}" ]] && (echo "PR already open"; exit 0) || (echo "opening PR")

# setup bot user
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"

# create new branch
now=$(date +'%Y-%m-%dT%H-%M-%S')
updated_branch="compat_$now"
default_branch="${{ github.event.repository.default_branch }}"
git switch -c "$updated_branch"
git switch -c "$head"

# commit wide CSVs and Markdown tables and push branch
# commit and push
git add DEVELOPER.md .github/compat/comp.csv .github/compat/test.csv
git commit -m "Update compatibility tables"
git push -u origin "$updated_branch"
git push -u origin "$head"

# open PR
cat <(echo '### Compile') <(echo) .github/compat/comp.md <(echo) <(echo '### Test') <(echo) .github/compat/test.md > compat.md
gh pr create -B "$default_branch" -H "$updated_branch" --title "Update compile/test compatibility tables" --body-file compat.md
gh pr create -B "${{ github.event.repository.default_branch }}" -H "$head" --title "Update compile/test compatibility tables" --body-file compat.md
40 changes: 20 additions & 20 deletions distribution/build_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,29 +304,29 @@ def build_distribution(
shutil.copy(_project_root_path / "code.json", output_path)

# full releases include examples, source code, makefiles and docs
if full:
# examples
setup_examples(
bin_path=output_path / "bin",
examples_path=output_path / "examples",
overwrite=overwrite,
)
if not full:
return

# examples
setup_examples(
bin_path=output_path / "bin",
examples_path=output_path / "examples",
overwrite=overwrite,
)

# copy source code files
copy_sources(output_path=output_path)
# copy source code files
copy_sources(output_path=output_path)

# build and copy makefiles
build_makefiles(output_path=output_path)
# build and copy makefiles
build_makefiles(output_path=output_path)

# docs
build_documentation(
bin_path=output_path / "bin",
output_path=output_path / "doc",
examples_repo_path=examples_repo_path,
# benchmarks_path=_benchmarks_path / "run-time-comparison.md",
full=full,
overwrite=overwrite,
)
# docs
build_documentation(
bin_path=output_path / "bin",
full=full,
output_path=output_path / "doc",
overwrite=overwrite,
)


@requires_exe("pdflatex")
Expand Down
7 changes: 3 additions & 4 deletions distribution/check_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,18 @@ def test_sources(dist_dir_path, releasemode, full):
if not full:
pytest.skip(reason="sources not included in minimal distribution")

assert (dist_dir_path / "meson.build").is_file()
assert (dist_dir_path / "meson.options").is_file()
assert (dist_dir_path / "src").is_dir()
assert (dist_dir_path / "src" / "mf6.f90").is_file()

version_file_path = dist_dir_path / "src" / "Utilities" / "version.f90"
assert version_file_path.is_file()

# find IDEVELOPMODE line
# check IDEVELOPMODE
lines = open(version_file_path, "r").read().splitlines()
pattern = ":: IDEVELOPMODE ="
line = next(iter([l for l in lines if pattern in l]), None)
assert line

# make sure IDEVELOPMODE was set correctly
idevelopmode = 0 if releasemode else 1
assert f"IDEVELOPMODE = {idevelopmode}" in line

Expand Down