From c2bb16d04b0a62313156c0e8374fe3009b002766 Mon Sep 17 00:00:00 2001 From: Cameron DeCoster Date: Tue, 21 Oct 2025 10:04:21 -0600 Subject: [PATCH 1/3] Add CircleCI image download script --- tasks/circleci_image_artifact_download.sh | 36 +++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 tasks/circleci_image_artifact_download.sh diff --git a/tasks/circleci_image_artifact_download.sh b/tasks/circleci_image_artifact_download.sh new file mode 100755 index 00000000000..a58d29e5e9e --- /dev/null +++ b/tasks/circleci_image_artifact_download.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +# Usage: $ ./circleci_image_artifact_download.sh JOB_NUMBER DEST_DIR + +# The job number is shown on the job page in the navigation breadcrumbs under 'Job': +# ... Job +# ... > test-baselines (123456) +# It's also shown in the URL: '.../jobs/123456/...' + +set -euo pipefail + +# Arguments +JOB_NUMBER="${1:-}" +DEST_DIR="${2:-.}" + +# Check if job number is provided +if [[ -z "$JOB_NUMBER" ]]; then + echo "CircleCI job number required. Usage: $0 [destination-directory]" + exit 1 +fi + +mkdir -p "$DEST_DIR" +cd "$DEST_DIR" + +# Get list of artifact URLs (filtering for .png files not containing 'diff') +artifact_urls=$(curl https://circleci.com/api/v2/project/github/plotly/plotly.js/$JOB_NUMBER/artifacts \ + | grep -oE "https.*png" \ + | grep -v "diff") + +# Download each artifact +echo "$artifact_urls" | while read -r url; do + echo "Downloading $url..." + curl -s -L -O "$url" +done + +echo "✅ All PNG artifacts saved to: $DEST_DIR" From 90d92e4e9a24b3178cb6486430a13a1cb2938114 Mon Sep 17 00:00:00 2001 From: Cameron DeCoster Date: Tue, 21 Oct 2025 10:05:41 -0600 Subject: [PATCH 2/3] Update CircleCI config to display message about using script --- .circleci/config.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4235b39f864..b884ecbab15 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -303,6 +303,7 @@ jobs: - run: name: Compare pixels command: .circleci/test.sh test-image ; find build -maxdepth 1 -type f -delete + - image-diff-message - store_artifacts: path: build destination: / @@ -317,6 +318,7 @@ jobs: - run: name: Compare pixels command: .circleci/test.sh test-image-virtual-webgl ; find build -maxdepth 1 -type f -delete + - image-diff-message - store_artifacts: path: build destination: / @@ -331,6 +333,7 @@ jobs: - run: name: Compare pixels command: .circleci/test.sh test-image ; find build -maxdepth 1 -type f -delete + - image-diff-message - store_artifacts: path: build destination: / @@ -345,6 +348,7 @@ jobs: - run: name: Compare pixels of mathjax v3 baselines command: .circleci/test.sh test-image-mathjax3 + - image-diff-message - store_artifacts: path: build destination: / @@ -515,6 +519,16 @@ jobs: - store_artifacts: path: topojson.tar +commands: + image-diff-message: + steps: + - run: + name: IMAGE DIFF DETECTED - SEE NOTE BELOW + when: on_fail + command: | + echo "Image Diff Detected: baselines may need to be updated. Use \"circleci_image_artifact_download.sh\" to download new baselines." + echo "Add the new images to \"test/image/baselines\" and commit them to this pull request." + workflows: version: 2 build-and-test: From a72ade5f2340ffae7c90033daa95bb1dcbee38c5 Mon Sep 17 00:00:00 2001 From: Cameron DeCoster Date: Tue, 21 Oct 2025 12:09:34 -0600 Subject: [PATCH 3/3] Update image diff notice text Co-authored-by: Emily KL <4672118+emilykl@users.noreply.github.com> --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b884ecbab15..458db3c69ea 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -526,8 +526,8 @@ commands: name: IMAGE DIFF DETECTED - SEE NOTE BELOW when: on_fail command: | - echo "Image Diff Detected: baselines may need to be updated. Use \"circleci_image_artifact_download.sh\" to download new baselines." - echo "Add the new images to \"test/image/baselines\" and commit them to this pull request." + echo "Image Diff Detected: baseline images may need to be updated. Run 'tasks/circleci_image_artifact_download.sh' to download the baseline images generated by this job." + echo "Add the new images to 'test/image/baselines/' and commit them to this pull request." workflows: version: 2