-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add sphinx gallery setup and first example to submit job
Signed-off-by: vsoch <[email protected]>
- Loading branch information
1 parent
aa8ac66
commit 067e7fc
Showing
22 changed files
with
1,134 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# This script checks that two directories are recursively equal | ||
# however we only care about name (existence) and timestamp. | ||
# Usage: | ||
# python .github/scripts/check_diff.py /tmp/auto_examples ./auto_examples | ||
|
||
import argparse | ||
import os | ||
import fnmatch | ||
|
||
|
||
def recursive_find(base, pattern="*.*"): | ||
""" | ||
Get a list of all files in a root. | ||
We need full and relative paths, so just assemble that. | ||
""" | ||
files = {} | ||
for root, _, filenames in os.walk(base): | ||
for filename in fnmatch.filter(filenames, pattern): | ||
fullpath = os.path.join(root, filename) | ||
relpath = os.path.relpath(fullpath, base) | ||
files[relpath] = fullpath | ||
return files | ||
|
||
|
||
def get_parser(): | ||
""" | ||
Get a parser to retrieve two directories. | ||
""" | ||
parser = argparse.ArgumentParser( | ||
description="🤒️ Not terribly accurate directory comparison tool." | ||
) | ||
parser.add_argument("dir_a", help="the first directory") | ||
parser.add_argument("dir_b", help="the second directory") | ||
return parser | ||
|
||
|
||
def main(): | ||
parser = get_parser() | ||
args = parser.parse_args() | ||
|
||
# Both directories must exist | ||
for dirname in args.dir_a, args.dir_b: | ||
if not os.path.exists(dirname): | ||
sys.exit(f"😢️ {dirname} does not exist.") | ||
|
||
print(f"🐨️ Checking for differences between {args.dir_a} and {args.dir_b}") | ||
|
||
# Lookup of relative -> fullpath | ||
files_a = recursive_find(args.dir_a) | ||
files_b = recursive_find(args.dir_b) | ||
|
||
# The relative paths should match | ||
A = set(files_a) | ||
B = set(files_b) | ||
if A.difference(B): | ||
sys.exit( | ||
f"😢️ Auto examples were not updated! Difference between sets:\n{A.difference(B)}" | ||
) | ||
|
||
# Now for each file check the size | ||
for key, file_a in files_a.items(): | ||
file_b = files_b[key] | ||
stat_a = os.stat(file_a) | ||
stat_b = os.stat(file_b) | ||
if stat_a.st_size != stat_b.st_size: | ||
sys.exit( | ||
f"😢️ Auto examples were not updated! Different size of {key}:\n{stat_a.st_size} vs. {stat_b.st_size}" | ||
) | ||
|
||
print(f"😃️ Yay! No differences between {args.dir_a} and {args.dir_b}") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,24 @@ jobs: | |
- run: git fetch origin master | ||
- uses: flux-framework/pr-validator@master | ||
|
||
check-examples: | ||
name: ensure latest examples built | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
fetch-depth: 0 | ||
|
||
- name: Build Docs and Check Files | ||
uses: devcontainers/[email protected] | ||
with: | ||
runCmd: | | ||
cp -R ./auto_examples /tmp/auto_examples | ||
flux start make html | ||
echo "Testing that you built the auto-examples, if this fails run flux start make html locally." | ||
python .github/scripts/check_diff.py /tmp/auto_examples ./auto_examples | ||
spelling: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.