-
Notifications
You must be signed in to change notification settings - Fork 224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CI: Fix and simplify the dvc-diff workflow #2549
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b7ad43b
Add/remove/update baseline images for testing the dvc diff workflow
seisman bf5c6f6
Use node v16
seisman 8c88125
Use cml to create/update PR comment
seisman b34872a
Merge branch 'main' into fix-dvc-workflow
seisman befa95b
Merge branch 'main' into fix-dvc-workflow
michaelgrund 899ecbd
Update the report preview
seisman 9591d80
Merge branch 'main' into fix-dvc-workflow
seisman 4974805
Revert "Add/remove/update baseline images for testing the dvc diff wo…
seisman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,12 @@ jobs: | |
- name: Pull image data from cloud storage | ||
run: dvc pull --remote upstream | ||
|
||
# workaround from https://github.com/iterative/cml/issues/1377 | ||
- name: Setup NodeJS | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: '16' | ||
|
||
# Produce the markdown diff report, which should look like: | ||
# ## Summary of changed images | ||
# | ||
|
@@ -45,10 +51,17 @@ jobs: | |
# | 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 }} | ||
id: image-diff | ||
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 | ||
|
@@ -95,30 +108,5 @@ jobs: | |
# Mention git commit SHA in the report | ||
echo -e "Report last updated at commit ${{ github.event.pull_request.head.sha }}" >> report.md | ||
|
||
# Save the report content to the output parameter 'report' | ||
echo 'report<<EOF' >> $GITHUB_OUTPUT | ||
cat report.md >> $GITHUB_OUTPUT | ||
echo 'EOF' >> $GITHUB_OUTPUT | ||
|
||
- name: Find comment with image diff report | ||
uses: peter-evans/[email protected] | ||
id: fc | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
comment-author: 'github-actions[bot]' | ||
body-includes: 'This is an auto-generated report of images that have changed on the DVC remote' | ||
|
||
- name: Create comment with image diff report | ||
if: steps.fc.outputs.comment-id == '' | ||
uses: peter-evans/[email protected] | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
body: ${{ steps.image-diff.outputs.report }} | ||
|
||
- name: Update comment with new image diff report | ||
if: steps.fc.outputs.comment-id != '' | ||
uses: peter-evans/[email protected] | ||
with: | ||
comment-id: ${{ steps.fc.outputs.comment-id }} | ||
body: ${{ steps.image-diff.outputs.report }} | ||
edit-mode: replace | ||
# create/update PR comment | ||
cml comment update report.md | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice that this simplifies so many lines of code! |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could update the preview a little bit below here