-
Notifications
You must be signed in to change notification settings - Fork 890
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add image diffs against previous build to CI results
- Loading branch information
Showing
2 changed files
with
26 additions
and
0 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,25 @@ | ||
#!/usr/bin/env python | ||
import os | ||
import subprocess | ||
import sys | ||
from pathlib import Path | ||
|
||
|
||
ROOT_DIR = Path(__file__).parent | ||
|
||
if os.environ.get('GITHUB_ACTION', '') == '': | ||
print('Not running when not in GitHub Actions.') | ||
sys.exit() | ||
|
||
gh_pages = ROOT_DIR.parent / 'pages' | ||
subprocess.run(['git', 'fetch', 'origin', 'gh-pages'], check=True) | ||
subprocess.run(['git', 'worktree', 'add', gh_pages, 'gh-pages'], check=True) | ||
|
||
for original in gh_pages.glob('*.png'): | ||
subprocess.run(['compare', | ||
original, | ||
ROOT_DIR / 'docs/_build/html' / original.name, | ||
ROOT_DIR / 'docs/_build/html' / f'{original.stem}-diff.png'], | ||
check=True) | ||
|
||
subprocess.run(['git', 'worktree', 'remove', gh_pages]) |