Skip to content

Commit 5fa3b6e

Browse files
authored
CI: Remove the deprecated cml-publish command from the dvc-diff workflow (#2559)
1 parent 43dc381 commit 5fa3b6e

1 file changed

Lines changed: 15 additions & 21 deletions

File tree

.github/workflows/dvc-diff.yml

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ jobs:
3232
- name: Setup continuous machine learning (CML)
3333
uses: iterative/setup-cml@v1.2.3
3434

35-
- name: Pull image data from cloud storage
36-
run: dvc pull --remote upstream
37-
3835
# workaround from https://github.com/iterative/cml/issues/1377
3936
- name: Setup NodeJS
4037
uses: actions/setup-node@v1
@@ -65,43 +62,40 @@ jobs:
6562
run: |
6663
echo -e "## Summary of changed images\n" > report.md
6764
echo -e "This is an auto-generated report of images that have changed on the DVC remote\n" >> report.md
65+
66+
# Pull image data from cloud storage
67+
dvc pull --remote upstream
6868
dvc diff --show-md main HEAD >> report.md
6969
7070
# Get just the filename of the added and modified image from the report
7171
awk 'NF==5 && NR>=7 && $2=="added" {print $4}' report.md > added_files.txt
7272
awk 'NF==5 && NR>=7 && $2=="modified" {print $4}' report.md > modified_files.txt
7373
74+
# Backup new images in the baseline-new directory
75+
mkdir pygmt/tests/baseline-new
76+
cp pygmt/tests/baseline/*.png pygmt/tests/baseline-new/
77+
# Pull images in the main branch from cloud storage
78+
git checkout main
79+
dvc pull --remote upstream
80+
7481
# Append each image to the markdown report
7582
echo -e "## Image diff(s)\n" >> report.md
7683
echo -e "<details>\n" >> report.md
7784
7885
# Added images
7986
echo -e "### Added images\n" >> report.md
8087
while IFS= read -r line; do
81-
echo -e "- $line \n" >> report.md
82-
cml-publish --title $line --md "$line" >> report.md < /dev/null
88+
echo -e "- $(basename $line) \n" >> report.md
89+
echo -e "![](${line/baseline/baseline-new})" >> report.md
8390
done < added_files.txt
8491
8592
# Modified images
8693
echo -e "### Modified images\n" >> report.md
87-
# Upload new images
88-
while IFS= read -r line; do
89-
cml-publish --title $line --md "$line" >> modified_images_new.md < /dev/null
90-
done < modified_files.txt
91-
92-
# Pull images in the main branch from cloud storage
93-
git checkout main
94-
dvc pull --remote upstream
95-
# Upload old images
96-
while IFS= read -r line; do
97-
cml-publish --title $line --md "$line" >> modified_images_old.md < /dev/null
98-
done < modified_files.txt
99-
100-
# Append image report for modified images
10194
echo -e "| Path | Old | New |" >> report.md
10295
echo -e "|---|---|---|" >> report.md
103-
paste modified_files.txt modified_images_old.md modified_images_new.md -d"|" |
104-
awk -F"|" 'function basename(file) {sub(".*/", "", file); return file} {printf("| %s | %s | %s |\n", basename($1), $2, $3)}' >> report.md
96+
while IFS= read -r line; do
97+
echo -e "| $(basename $line) | ![]($line) | ![](${line/baseline/baseline-new}) |" >> report.md
98+
done < modified_files.txt
10599
106100
echo -e "</details>\n" >> report.md
107101

0 commit comments

Comments
 (0)