From fcb13c6e4f54e2cbad80da94aeb912432cfaa949 Mon Sep 17 00:00:00 2001 From: Liren Tu Date: Tue, 7 Mar 2023 11:39:15 -0800 Subject: [PATCH 1/8] Add stoat --- .github/workflows/ci.yml | 9 +++++++++ .stoat/config.yaml | 11 +++++++++++ 2 files changed, 20 insertions(+) create mode 100644 .stoat/config.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e4beb97011..e4ce9ff8eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,11 @@ jobs: with: name: d2chaos path: ./d2chaos/out + + - name: Run Stoat Action + uses: stoat-dev/stoat-action@v0 + if: always() + nofixups: runs-on: ubuntu-latest steps: @@ -31,3 +36,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets._GITHUB_TOKEN }} DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} + + - name: Run Stoat Action + uses: stoat-dev/stoat-action@v0 + if: always() diff --git a/.stoat/config.yaml b/.stoat/config.yaml new file mode 100644 index 0000000000..43bd5cd561 --- /dev/null +++ b/.stoat/config.yaml @@ -0,0 +1,11 @@ +--- +version: 1 +enabled: true +plugins: + job_runtime: + enabled: true +# static_hosting: +# your_unique_id: +# metadata: +# name: "Name of artifact you're hosting, such as Code Coverage Report" +# path: path/from/git/root/to/directory/to/host From 7550cccb766eaa62b1cfd51336dc8f17058331f9 Mon Sep 17 00:00:00 2001 From: Liren Tu Date: Tue, 7 Mar 2023 11:45:11 -0800 Subject: [PATCH 2/8] Add image diff --- .stoat/config.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.stoat/config.yaml b/.stoat/config.yaml index 43bd5cd561..b020bbe474 100644 --- a/.stoat/config.yaml +++ b/.stoat/config.yaml @@ -4,6 +4,9 @@ enabled: true plugins: job_runtime: enabled: true + image_diff: + renderers: + image: d2renderers/d2sketch/testdata/app_shapes/sketch.exp.svg # static_hosting: # your_unique_id: # metadata: From 84d97ce913b6b964b78c0fd1c91b27aed7181c63 Mon Sep 17 00:00:00 2001 From: Liren Tu Date: Tue, 7 Mar 2023 11:45:19 -0800 Subject: [PATCH 3/8] Use dev branch --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e4ce9ff8eb..14ffc43eb4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: path: ./d2chaos/out - name: Run Stoat Action - uses: stoat-dev/stoat-action@v0 + uses: stoat-dev/stoat-action@liren/improve-image-diff if: always() nofixups: @@ -38,5 +38,5 @@ jobs: DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} - name: Run Stoat Action - uses: stoat-dev/stoat-action@v0 + uses: stoat-dev/stoat-action@liren/improve-image-diff if: always() From 81110adc89b1e53c5d8480b53c909c37de38e93b Mon Sep 17 00:00:00 2001 From: Liren Tu Date: Tue, 7 Mar 2023 11:47:08 -0800 Subject: [PATCH 4/8] Add same baseline for testing --- .stoat/config.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.stoat/config.yaml b/.stoat/config.yaml index b020bbe474..d55b8ac34f 100644 --- a/.stoat/config.yaml +++ b/.stoat/config.yaml @@ -7,6 +7,7 @@ plugins: image_diff: renderers: image: d2renderers/d2sketch/testdata/app_shapes/sketch.exp.svg + baseline: d2renderers/d2sketch/testdata/app_shapes/sketch.exp.svg # static_hosting: # your_unique_id: # metadata: From f632382cb941ddb0d3930ff584b529b4e455c97c Mon Sep 17 00:00:00 2001 From: Liren Tu Date: Tue, 7 Mar 2023 11:57:56 -0800 Subject: [PATCH 5/8] Fix typo in path --- .stoat/config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stoat/config.yaml b/.stoat/config.yaml index d55b8ac34f..a36c8bdc7f 100644 --- a/.stoat/config.yaml +++ b/.stoat/config.yaml @@ -6,8 +6,8 @@ plugins: enabled: true image_diff: renderers: - image: d2renderers/d2sketch/testdata/app_shapes/sketch.exp.svg - baseline: d2renderers/d2sketch/testdata/app_shapes/sketch.exp.svg + image: d2renderers/d2sketch/testdata/all_shapes/sketch.exp.svg + baseline: d2renderers/d2sketch/testdata/all_shapes/sketch.exp.svg # static_hosting: # your_unique_id: # metadata: From a4616fbe7ba4fd755508d0434784064636d4a35f Mon Sep 17 00:00:00 2001 From: Liren Tu Date: Tue, 7 Mar 2023 12:02:27 -0800 Subject: [PATCH 6/8] Add mock change --- d2renderers/d2svg/d2svg.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/d2renderers/d2svg/d2svg.go b/d2renderers/d2svg/d2svg.go index 2846c7587b..a9a437e390 100644 --- a/d2renderers/d2svg/d2svg.go +++ b/d2renderers/d2svg/d2svg.go @@ -1956,14 +1956,6 @@ func singleThemeRulesets(themeID int64) (rulesets string, err error) { } out += fmt.Sprintf(".sketch-overlay-%s{fill:url(#streaks-%s);mix-blend-mode:%s}", color.N7, lc, blendMode(lc)) - if theme.IsDark() { - out += fmt.Sprintf(".light-code{display: none}") - out += fmt.Sprintf(".dark-code{display: block}") - } else { - out += fmt.Sprintf(".light-code{display: block}") - out += fmt.Sprintf(".dark-code{display: none}") - } - return out, nil } From 5f05e59620f2abd54076fc7f3f782e1be5a7c2ff Mon Sep 17 00:00:00 2001 From: Liren Tu Date: Tue, 7 Mar 2023 12:05:12 -0800 Subject: [PATCH 7/8] Update workflow trigger --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 14ffc43eb4..adb86bd234 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,9 @@ name: ci -on: [push, pull_request] +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} cancel-in-progress: true From 15e4d0c61168577e42011de1953a958accb099e6 Mon Sep 17 00:00:00 2001 From: Liren Tu Date: Tue, 7 Mar 2023 12:09:39 -0800 Subject: [PATCH 8/8] Revert "Add mock change" This reverts commit a4616fbe7ba4fd755508d0434784064636d4a35f. --- d2renderers/d2svg/d2svg.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/d2renderers/d2svg/d2svg.go b/d2renderers/d2svg/d2svg.go index a9a437e390..2846c7587b 100644 --- a/d2renderers/d2svg/d2svg.go +++ b/d2renderers/d2svg/d2svg.go @@ -1956,6 +1956,14 @@ func singleThemeRulesets(themeID int64) (rulesets string, err error) { } out += fmt.Sprintf(".sketch-overlay-%s{fill:url(#streaks-%s);mix-blend-mode:%s}", color.N7, lc, blendMode(lc)) + if theme.IsDark() { + out += fmt.Sprintf(".light-code{display: none}") + out += fmt.Sprintf(".dark-code{display: block}") + } else { + out += fmt.Sprintf(".light-code{display: block}") + out += fmt.Sprintf(".dark-code{display: none}") + } + return out, nil }