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

CI misc improvements #296

Merged
merged 54 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
54182de
refactor to use f-strings
justinlaughlin Jul 23, 2024
2bdf1b7
fix some typos
justinlaughlin Jul 23, 2024
6646eaf
add requirements.txt
justinlaughlin Jul 23, 2024
f6b6fe4
add fail-fast:false to strategy so tests always complete
justinlaughlin Jul 23, 2024
9682049
update workflow to use requirements.txt
justinlaughlin Jul 23, 2024
3e48920
fix a couple more typos
justinlaughlin Jul 23, 2024
112ec9f
try adding macos-13 to see if it is more stable
justinlaughlin Jul 24, 2024
677bf57
removed .saved from name and fix a typo in an unused function
justinlaughlin Jul 24, 2024
5187edb
update name in cmakelists
justinlaughlin Jul 24, 2024
424d285
cleanup. move unused code to test_cmd.py
justinlaughlin Jul 24, 2024
7673158
update baseline_name
justinlaughlin Jul 24, 2024
03a6793
revert adding macos-13
justinlaughlin Jul 24, 2024
3fbf597
try forcing build on macos to see if it helps with stability
justinlaughlin Jul 24, 2024
2f05fce
(wip) implementing image diff
justinlaughlin Jul 24, 2024
f3a51d2
image diff implemented
justinlaughlin Jul 24, 2024
8f17c63
runner.os should be matrix.os
justinlaughlin Jul 24, 2024
741c23a
testing... remove macos-latest from cache step
justinlaughlin Jul 24, 2024
1853226
try adding image diff to ci driver
justinlaughlin Jul 24, 2024
d12eaa8
remove unnecessary (?) extra tar command in test GLVis (cmake/linux)
justinlaughlin Jul 24, 2024
6cb85f4
update ci script to upload image diff in tarball
justinlaughlin Jul 24, 2024
eaacb1b
update image diff so zoom/pan is syncronized
justinlaughlin Jul 24, 2024
7cdd418
for now, also generate image diff for 'zoom' tests so we know its wor…
justinlaughlin Jul 24, 2024
00a5413
A try to fix MacOS runners.
najlkin Jul 24, 2024
21a446f
Another try to fix MacOS runners.
najlkin Jul 24, 2024
a033fb4
A safer try for MacOS.
najlkin Jul 24, 2024
81df60b
Revert "A safer try for MacOS."
najlkin Jul 24, 2024
c8fc30d
Revert "Another try to fix MacOS runners."
najlkin Jul 24, 2024
6433a9d
Revert "A try to fix MacOS runners."
najlkin Jul 24, 2024
4497f4d
Fixed init of the main thread.
najlkin Jul 24, 2024
85360c7
add type hinting and only generate artifacts on test failure
justinlaughlin Jul 25, 2024
8be84a0
revert force build for macos
justinlaughlin Jul 25, 2024
e1e3bcd
typo
justinlaughlin Jul 25, 2024
3d63020
cleanup
justinlaughlin Jul 25, 2024
8629302
make sure exist_ok=True
justinlaughlin Jul 25, 2024
9cf8f95
change subplot titles
justinlaughlin Jul 25, 2024
73b28a1
use source= argument for generating html files
justinlaughlin Jul 25, 2024
caaf323
remove dir structure from tarball
justinlaughlin Jul 25, 2024
0d1407a
Merge branch 'master' into ci-misc-improvements
justinlaughlin Jul 25, 2024
2d5c224
fix tarball
justinlaughlin Jul 25, 2024
00c02c1
change behavior to always generate diff pngs. generate html on failures
justinlaughlin Jul 25, 2024
582fd25
fix path for tarball
justinlaughlin Jul 25, 2024
c3dfcdb
fix erroneous extra extension
justinlaughlin Jul 25, 2024
b56afa3
typo
justinlaughlin Jul 25, 2024
8073132
index bug
justinlaughlin Jul 25, 2024
3408a23
use old glvis/data hash for illustration
justinlaughlin Jul 25, 2024
11784ae
change subtitles to image_names
justinlaughlin Jul 25, 2024
e91ab56
revert the glvis/data hash even further for testing
justinlaughlin Jul 25, 2024
6eeda89
include_plotlyjs='cdn' makes html much smaller but requires internet
justinlaughlin Jul 25, 2024
1dea37d
since file is small now, always generate diff plot
justinlaughlin Jul 25, 2024
f2b0788
change glvis/data back to latest version
justinlaughlin Jul 25, 2024
92d9ec6
Merge branch 'master' into ci-misc-improvements
tzanio Aug 10, 2024
58cb4fe
New line
tzanio Aug 13, 2024
4b41c58
update data to most recent
justinlaughlin Aug 13, 2024
a6ff194
update changelog
justinlaughlin Aug 13, 2024
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
3 changes: 2 additions & 1 deletion .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ env:
jobs:
builds-and-tests:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
target: [dbg, opt]
Expand Down Expand Up @@ -230,7 +231,7 @@ jobs:
if: matrix.build-system == 'cmake'
run: |
python -m pip install --upgrade pip
pip install scikit-image
python -m pip install -r glvis/tests/requirements.txt

- name: setup Linux testing dependencies
if: matrix.build-system == 'cmake' && matrix.os == 'ubuntu-latest'
Expand Down
36 changes: 18 additions & 18 deletions tests/glvis_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,31 +72,31 @@ def compare_images(baseline_file, output_file, expect_fail=False):
print("[FAIL] Differences were not detected in the control case.")
else:
print("[PASS] Images match.")
print(" actual ssim = {}, cutoff = {}".format(ssim, cutoff_ssim))
print(f" actual ssim = {ssim}, cutoff = {cutoff_ssim}")
return ssim >= cutoff_ssim if not expect_fail else ssim < cutoff_ssim

# Function to test a given glvis command with a variety of key-based commands.
# Not currently in use.
def test_case(exec_path, exec_args, baseline, t_group, t_name, cmd):
print("Testing {0}:{1}...".format(t_group, t_name))
print(f"Testing {t_group}:{t_name}..."))
najlkin marked this conversation as resolved.
Show resolved Hide resolved
full_screenshot_cmd = cmd + screenshot_keys
cmd = "{0} {1} -k \"{2}\"".format(exec_path, exec_args, full_screenshot_cmd)
print("Exec: {}".format(cmd))
cmd = f"{exec_path} {exec_args} -k \"{full_screenshot_cmd}\""
print(f"Exec: {cmd}")
ret = os.system(cmd + " > /dev/null 2>&1")
if ret != 0:
print("[FAIL] GLVis exited with error code {}.".format(ret))
print(f"[FAIL] GLVis exited with error code {ret}.")
return False
if not os.path.exists(t_group):
os.mkdir(t_group)
output_name = "{0}/{1}.png".format(t_group, t_name)
output_name = f"{t_group}/{t_name}.png"

ret = os.system("mv {0} {1}".format(screenshot_file, output_name))
ret = os.system(f"mv {screenshot_file} {output_name}")
if ret != 0:
print("[FAIL] Could not move output image: exit code {}.".format(ret))
print(f"[FAIL] Could not move output image: exit code {ret}.")
return False

if baseline:
baseline_name = "{0}/test.{1}.png".format(baseline, test_name)
baseline_name = f"{baseline}/test.{test_name}.png"
return compare_images(baseline_name, output_name)
else:
print("[IGNORE] No baseline exists to compare against.")
Expand All @@ -106,35 +106,35 @@ def test_stream(exec_path, exec_args, save_file, baseline):
if exec_args is None:
exec_args = ""
test_name = os.path.basename(save_file)
print("Testing {}...".format(save_file))
print(f"Testing {save_file}...")

# Create new stream file with command to screenshot and close
stream_data = None
with open(save_file) as in_f:
stream_data = in_f.read()

output_name = "test.{}.png".format(test_name)
output_name_fail = "test.fail.{}.png".format(test_name)
output_name = f"test.{test_name}.png"
output_name_fail = f"test.fail.{test_name}.png"
tmp_file = "test.saved"
with open(tmp_file, 'w') as out_f:
out_f.write(stream_data)
out_f.write("\nwindow_size 800 600")
out_f.write("\nscreenshot {}".format(output_name))
out_f.write(f"\nscreenshot {output_name}")
# Zooming in should create some difference in the images
out_f.write("\nkeys *")
out_f.write("\nscreenshot {}".format(output_name_fail))
out_f.write(f"\nscreenshot {output_name_fail}")
out_f.write("\nkeys q")

# Run GLVis with modified stream file
cmd = "{0} {1} -saved {2}".format(exec_path, exec_args, tmp_file)
print("Exec: {}".format(cmd))
cmd = f"{exec_path} {exec_args} -saved {tmp_file}"
print(f"Exec: {cmd}")
ret = os.system(cmd)
if ret != 0:
print("[FAIL] GLVis exited with error code {}.".format(ret))
print(f"[FAIL] GLVis exited with error code {ret}.")
return False

if baseline:
baseline_name = "{0}/test.{1}.png".format(baseline, test_name)
baseline_name = f"{baseline}/test.{test_name}.png")
test_baseline = compare_images(baseline_name, output_name)
test_control = compare_images(baseline_name, output_name_fail,
expect_fail=True)
Expand Down
3 changes: 3 additions & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
scikit-image
plotly
numpy >= 1.20.0, < 2.0.0
Loading