Skip to content

Commit 82cd7f0

Browse files
committed
Merge remote-tracking branch 'origin/test-coast-dvc' into test-coast-dvc
2 parents 0a1c5e7 + bd3fc84 commit 82cd7f0

16 files changed

+135
-36
lines changed

.github/workflows/cache_data.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
steps:
2020
# Setup Miniconda
2121
- name: Setup Miniconda
22-
uses: conda-incubator/setup-miniconda@v2.0.1
22+
uses: conda-incubator/setup-miniconda@v2.1.0
2323
with:
2424
channels: conda-forge
2525
miniconda-version: "latest"

.github/workflows/ci_docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656

5757
# Setup Miniconda
5858
- name: Setup Miniconda
59-
uses: conda-incubator/setup-miniconda@v2.0.1
59+
uses: conda-incubator/setup-miniconda@v2.1.0
6060
with:
6161
activate-environment: pygmt
6262
python-version: ${{ matrix.python-version }}

.github/workflows/ci_tests.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676

7777
# Setup Miniconda
7878
- name: Setup Miniconda
79-
uses: conda-incubator/setup-miniconda@v2.0.1
79+
uses: conda-incubator/setup-miniconda@v2.1.0
8080
with:
8181
activate-environment: pygmt
8282
python-version: ${{ matrix.python-version }}
@@ -140,7 +140,7 @@ jobs:
140140

141141
# Upload coverage to Codecov
142142
- name: Upload coverage to Codecov
143-
uses: codecov/codecov-action@v1.2.2
143+
uses: codecov/codecov-action@v1.3.1
144144
with:
145145
file: ./coverage.xml # optional
146146
env_vars: OS,PYTHON,NUMPY

.github/workflows/ci_tests_dev.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373

7474
# Setup Miniconda
7575
- name: Setup Miniconda
76-
uses: conda-incubator/setup-miniconda@v2.0.1
76+
uses: conda-incubator/setup-miniconda@v2.1.0
7777
with:
7878
activate-environment: pygmt
7979
python-version: ${{ matrix.python-version }}

.github/workflows/dvc-diff.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Checks for image diffs in a Pull Request and adds a GitHub comment showing the diff
2+
name: DVC image diff
3+
4+
on:
5+
pull_request:
6+
paths:
7+
- 'pygmt/tests/baseline/*.png.dvc'
8+
9+
jobs:
10+
dvc-diff:
11+
name: DVC image diff
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/[email protected]
17+
with:
18+
# fetch all history so that dvc diff works
19+
fetch-depth: 0
20+
21+
- name: Setup data version control (DVC)
22+
uses: iterative/[email protected]
23+
24+
- name: Setup continuous machine learning (CML)
25+
uses: iterative/[email protected]
26+
27+
# Produce the markdown diff report, which should look like:
28+
# ## Summary of changed images
29+
#
30+
# This is an auto-generated report of images that have changed on the DVC remote
31+
#
32+
# | Status | Path |
33+
# |----------|-------------------------------------|
34+
# | added | pygmt/tests/baseline/test_image.png |
35+
- name: Put list of images that were added or changed into report
36+
run: |
37+
echo -e "## Summary of changed images\n" > report.md
38+
echo -e "This is an auto-generated report of images that have changed on the DVC remote\n" >> report.md
39+
dvc diff --show-md master HEAD >> report.md
40+
cat report.md
41+
42+
- name: Pull image data from cloud storage
43+
run: dvc pull --remote upstream
44+
45+
- name: Put image diff(s) into report
46+
env:
47+
repo_token: ${{ secrets.GITHUB_TOKEN }}
48+
id: image-diff
49+
run: |
50+
# Get just the filename of the changed image from the report
51+
awk 'NF==5 && NR>=7 {print $4}' report.md > diff_files.txt
52+
53+
# Append each image to the markdown report
54+
echo -e "## Image diff(s)\n" >> report.md
55+
echo -e "<details>\n" >> report.md
56+
57+
while IFS= read -r line; do
58+
echo -e "- $line \n" >> report.md
59+
cml-publish --title $line --md "$line" >> report.md < /dev/null
60+
done < diff_files.txt
61+
62+
echo -e "</details>\n" >> report.md
63+
64+
# Mention git commit SHA in the report
65+
echo -e "Report last updated at commit ${{ github.event.pull_request.head.sha }}" >> report.md
66+
67+
# Format report to escape newlines before publishing as GitHub comment
68+
report=$(cat report.md)
69+
report="${report//'%'/'%25'}"
70+
report="${report//$'\n'/'%0A'}"
71+
report="${report//$'\r'/'%0D'}"
72+
echo ::set-output name=report::$report
73+
74+
- name: Find comment with image diff report
75+
uses: peter-evans/[email protected]
76+
id: fc
77+
with:
78+
issue-number: ${{ github.event.pull_request.number }}
79+
comment-author: 'github-actions[bot]'
80+
body-includes: 'This is an auto-generated report of images that have changed on the DVC remote'
81+
82+
- name: Create comment with image diff report
83+
if: steps.fc.outputs.comment-id == ''
84+
uses: peter-evans/[email protected]
85+
with:
86+
issue-number: ${{ github.event.pull_request.number }}
87+
body: ${{ steps.image-diff.outputs.report }}
88+
89+
- name: Update comment with new image diff report
90+
if: steps.fc.outputs.comment-id != ''
91+
uses: peter-evans/[email protected]
92+
with:
93+
comment-id: ${{ steps.fc.outputs.comment-id }}
94+
body: ${{ steps.image-diff.outputs.report }}
95+
edit-mode: replace

MAINTENANCE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ There are 9 configuration files located in `.github/workflows`:
127127

128128
This workflow is triggered in a PR if the slash command `/format` is used.
129129

130+
10. `dvc-diff.yml` (Report changes to test images on dvc remote)
131+
132+
This workflow is triggered in a PR when any *.png.dvc files have been added,
133+
modified, or deleted. A GitHub comment will be published that contains a summary
134+
table of the images that have changed along with a visual report.
135+
130136
## Continuous Documentation
131137

132138
We use the [Vercel for GitHub](https://github.com/apps/vercel) App to preview changes
-66.5 KB
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
outs:
2+
- md5: 68c12988f1bb0dbc67da560fe4d51ea2
3+
size: 64936
4+
path: test_contour_from_file.png
-54.5 KB
Binary file not shown.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
outs:
2+
- md5: 7a8e0d23ce325cef3be12da033ab2602
3+
size: 75839
4+
path: test_contour_matrix.png

0 commit comments

Comments
 (0)