|
32 | 32 | - name: Setup continuous machine learning (CML) |
33 | 33 | uses: iterative/setup-cml@v1.2.3 |
34 | 34 |
|
35 | | - - name: Pull image data from cloud storage |
36 | | - run: dvc pull --remote upstream |
37 | | - |
38 | 35 | # workaround from https://github.com/iterative/cml/issues/1377 |
39 | 36 | - name: Setup NodeJS |
40 | 37 | uses: actions/setup-node@v1 |
@@ -65,43 +62,40 @@ jobs: |
65 | 62 | run: | |
66 | 63 | echo -e "## Summary of changed images\n" > report.md |
67 | 64 | 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 |
68 | 68 | dvc diff --show-md main HEAD >> report.md |
69 | 69 |
|
70 | 70 | # Get just the filename of the added and modified image from the report |
71 | 71 | awk 'NF==5 && NR>=7 && $2=="added" {print $4}' report.md > added_files.txt |
72 | 72 | awk 'NF==5 && NR>=7 && $2=="modified" {print $4}' report.md > modified_files.txt |
73 | 73 |
|
| 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 | +
|
74 | 81 | # Append each image to the markdown report |
75 | 82 | echo -e "## Image diff(s)\n" >> report.md |
76 | 83 | echo -e "<details>\n" >> report.md |
77 | 84 |
|
78 | 85 | # Added images |
79 | 86 | echo -e "### Added images\n" >> report.md |
80 | 87 | 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 "" >> report.md |
83 | 90 | done < added_files.txt |
84 | 91 |
|
85 | 92 | # Modified images |
86 | 93 | 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 |
101 | 94 | echo -e "| Path | Old | New |" >> report.md |
102 | 95 | 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) |  |  |" >> report.md |
| 98 | + done < modified_files.txt |
105 | 99 |
|
106 | 100 | echo -e "</details>\n" >> report.md |
107 | 101 |
|
|
0 commit comments