Skip to content

Figure.timestamp: Deprecate parameter 'justification' to 'justify' (remove in v0.13.0) #786

Figure.timestamp: Deprecate parameter 'justification' to 'justify' (remove in v0.13.0)

Figure.timestamp: Deprecate parameter 'justification' to 'justify' (remove in v0.13.0) #786

Workflow file for this run

# Report changes in test images
#
# This workflow checks for image diffs in a pull request and adds a GitHub
# comment showing the diff.
#
# It is triggered in a PR when any *.png.dvc files have been added, modified,
# or deleted. A GitHub comment will be published that contains a summary table
# of the images that have changed along with a visual report.
#
name: DVC image diff
on:
pull_request:
paths:
- 'pygmt/tests/baseline/*.png.dvc'
jobs:
dvc-diff:
name: DVC image diff
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
with:
# fetch all history so that dvc diff works
fetch-depth: 0
- name: Setup data version control (DVC)
uses: iterative/[email protected]
- name: Setup continuous machine learning (CML)
uses: iterative/[email protected]
# Produce the markdown diff report, which should look like:
# ## Summary of changed images
#
# This is an auto-generated report of images that have changed on the DVC remote
#
# | Status | Path |
# |----------|-------------------------------------|
# | added | pygmt/tests/baseline/test_image.png |
# | deleted | pygmt/tests/baseline/test_image2.png |
# | modified | pygmt/tests/baseline/test_image3.png |
#
# ## Image diff(s)
#
# <details>
# ...
# </details>
#
# Report last updated at commit abcdef
- name: Generate the image diff report
env:
repo_token: ${{ secrets.GITHUB_TOKEN }}
run: |
echo -e "## Summary of changed images\n" > report.md
echo -e "This is an auto-generated report of images that have changed on the DVC remote\n" >> report.md
# Pull image data from cloud storage
dvc pull --remote upstream
dvc diff --md main HEAD >> report.md
# Get just the filename of the added and modified image from the report
awk 'NF==5 && NR>=7 && $2=="added" {print $4}' report.md > added_files.txt
awk 'NF==5 && NR>=7 && $2=="modified" {print $4}' report.md > modified_files.txt
# Backup new images in the baseline-new directory
mkdir pygmt/tests/baseline-new
cp pygmt/tests/baseline/*.png pygmt/tests/baseline-new/
# Pull images in the main branch from cloud storage
git checkout main
dvc pull --remote upstream --force
# Append each image to the markdown report
echo -e "## Image diff(s)\n" >> report.md
echo -e "<details>\n" >> report.md
# Added images
echo -e "### Added images\n" >> report.md
while IFS= read -r line; do
echo -e "- $(basename $line) \n" >> report.md
echo -e "![](${line/baseline/baseline-new})" >> report.md
done < added_files.txt
# Modified images
echo -e "### Modified images\n" >> report.md
echo -e "| Path | Old | New |" >> report.md
echo -e "|---|---|---|" >> report.md
while IFS= read -r line; do
echo -e "| $(basename $line) | ![]($line) | ![](${line/baseline/baseline-new}) |" >> report.md
done < modified_files.txt
echo -e "</details>\n" >> report.md
# Mention git commit SHA in the report
echo -e "Report last updated at commit ${{ github.event.pull_request.head.sha }}" >> report.md
# create/update PR comment
cml comment update report.md