Repository navigation
Check SVG optimization in the tests CI workflow with SVGO - #9361
Conversation
| "markdownlint": "markdownlint-cli2", | ||
| "markdownlint_fix": "markdownlint-cli2 --fix", | ||
| "rtlcss": "rtlcss -d p/themes/ && find p/themes/ -type f -name '*.rtl.rtl.css' -delete", | ||
| "svgo": "find p/ docs/ -name '*.svg' -exec svgo --multipass {} +", |
There was a problem hiding this comment.
It would be nice to avoid all the noise due to the unchanged files to focus on the changed ones.
Maybe something like that, but there is maybe a better approach:
| "svgo": "find p/ docs/ -name '*.svg' -exec svgo --multipass {} +", | |
| "svgo": "find p/ docs/ -name '*.svg' -exec svgo --multipass {} + | awk '/:$/{name=$0;next} /KiB/ && !/ - 0% /{print name; print}'", |
There was a problem hiding this comment.
I think I would slightly prefer some minor indenting such as --pretty --indent -1 to have nicer diffs in case of changes, and also to be a bit more readable, e.g. for reviews
| "svgo": "find p/ docs/ -name '*.svg' -exec svgo --multipass {} +", | |
| "svgo": "find p/ docs/ -name '*.svg' -exec svgo --multipass --pretty --indent -1 {} + | awk '/:$/{name=$0;next} /KiB/ && !/ - 0% /{print name; print}'", |
There was a problem hiding this comment.
I made the change, but somehow the CI output is the same as before. (I assume it's another GitHub bug/"intended behavior" and will be fine after merging)
It works locally though.
There was a problem hiding this comment.
I guess there is no easier way to hide the unchanged files: svg/svgo#2050
There was a problem hiding this comment.
What exactly does the optimization do btw? Some changes might not be worth it for losing the original path info.
There was a problem hiding this comment.
Yes, and with the indenting in place, I think they look ok. An open question would be about considering keeping the comments https://svgo.dev/docs/plugins/removeComments/
There was a problem hiding this comment.
Currently it would make no difference to disable that plugin, since we didn't have any comments in our SVGs.
There was a problem hiding this comment.
But I disabled it anyway in case we want to add any comments later: 424ad20
There was a problem hiding this comment.
I made the change, but somehow the CI output is the same as before. (I assume it's another GitHub bug/"intended behavior" and will be fine after merging)
Still happens in CI after merging
Co-authored-by: Alexandre Alapetite <[email protected]>
|
Should we use any other plugins than (and aside from the default preset: https://svgo.dev/docs/preset-default/#plugins-list) |
I was under the impression that something like https://svgo.dev/docs/plugins/cleanupAttrs/ was already done by default, but maybe worth checking |
|
Yes it's in the default preset |
| const copyIconSvg = document.querySelector('template#copy-svg-icon').innerHTML; | ||
| for (const el of document.querySelectorAll('div.highlight')) { |
There was a problem hiding this comment.
When I built the documentation locally, div.highlight wasn't outputted anywhere for some reason, so I was unable to test this change.
There was a problem hiding this comment.
Okay it was because I used Ruby v4, it works fine with Ruby v3.4.9
Probably it was because of this:
commonmarker-0.23.12 requires ruby version < 4.0, >= 2.6, which is incompatible with the current version, 4.0.7
I had Gemfile.lock update itself on Ruby v4:
diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock
index 5e4cf8060..c3e473eb9 100644
--- a/docs/Gemfile.lock
+++ b/docs/Gemfile.lock
@@ -10,7 +10,8 @@ GEM
execjs
coffee-script-source (1.12.2)
colorator (1.1.0)
- commonmarker (0.23.12)
+ commonmarker (0.21.1)
+ ruby-enum (~> 0.5)
concurrent-ruby (1.3.7)
csv (3.3.5)
em-websocket (0.5.3)
@@ -88,8 +89,9 @@ GEM
jekyll-coffeescript (2.0.0)
coffee-script (~> 2.2)
coffee-script-source (~> 1.12)
- jekyll-commonmark (1.4.0)
- commonmarker (~> 0.22)
+ jekyll-commonmark (1.3.1)
+ commonmarker (~> 0.14)
+ jekyll (>= 3.7, < 5.0)
jekyll-default-layout (0.1.5)
jekyll (>= 3.0, < 5.0)
jekyll-gist (1.5.0)
@@ -136,6 +138,8 @@ GEM
ffi (~> 1.0)
rexml (3.4.4)
rouge (4.7.0)
+ ruby-enum (0.9.0)
+ i18n
safe_yaml (1.0.5)
sass-embedded (1.99.0)
google-protobuf (~> 4.31)
There was a problem hiding this comment.
On Ruby v3, there is no issue even after a bundle update.
There was a problem hiding this comment.
Somehow it's working on Ruby v4 again now so the change is good I guess
This PR contains the following updates: | Package | Update | Change | |---|---|---| | [freshrss/freshrss](https://freshrss.org/) ([source](https://github.com/FreshRSS/FreshRSS)) | patch | `1.30.0-alpine` → `1.30.1-alpine` | --- ### Release Notes <details> <summary>FreshRSS/FreshRSS (freshrss/freshrss)</summary> ### [`v1.30.1`](https://github.com/FreshRSS/FreshRSS/blob/HEAD/CHANGELOG.md#2026-10-05-FreshRSS-1301) [Compare Source](FreshRSS/FreshRSS@1.30.0...1.30.1) - Deployment - Reword recommendations and explanations for *edge* (rolling release) vs. *latest* (versioned release) channels [#​9270](FreshRSS/FreshRSS#9270) - Security - Config + increase default values for search max length and depth [#​9280](FreshRSS/FreshRSS#9280) - Accept a trusted proxy address given without a subnet [#​9301](FreshRSS/FreshRSS#9301) - Warn during session regenerate fail [#​9311](FreshRSS/FreshRSS#9311), [#​9376](FreshRSS/FreshRSS#9376) - CI/CD add zizmor workflow for action security checks [#​9228](FreshRSS/FreshRSS#9228), [#​9331](FreshRSS/FreshRSS#9331) - Use PHP `#[\SensitiveParameter]` [#​9322](FreshRSS/FreshRSS#9322) - Reject token access (RSS/OPML export, feed refresh) for disabled accounts [#​9336](FreshRSS/FreshRSS#9336) - Require POST+CSRF for self-update mutations [#​9335](FreshRSS/FreshRSS#9335) - Make the login challenge nonce one-time [#​9334](FreshRSS/FreshRSS#9334) - Bound ZIP import against decompression bombs [#​9332](FreshRSS/FreshRSS#9332) - Rotate session ID on all authenticated transitions [#​9333](FreshRSS/FreshRSS#9333) - Minz: Remove vulnerable and unused code path for displaying errors [#​9395](FreshRSS/FreshRSS#9395) - Fix NAT64 feed fetching on IPv6-only hosts [#​9372](FreshRSS/FreshRSS#9372) - Bug fixes - Fix domain-wide `Retry-After` [#​9390](FreshRSS/FreshRSS#9390) - Fix muting of feeds gone with HTTP 410 [#​9391](FreshRSS/FreshRSS#9391) - Fix infinite redirect loop due to `SCRIPT_NAME` in `PATH_INFO` [#​9282](FreshRSS/FreshRSS#9282), [#​9287](FreshRSS/FreshRSS#9287) - Restore the automatic reading view after marking articles as read, while preserving explicit filters [#​9288](FreshRSS/FreshRSS#9288) - Fix adaptive reading state after marking articles read [#​9290](FreshRSS/FreshRSS#9290) - Fix regression sharing links [#​9303](FreshRSS/FreshRSS#9303) - Don’t disable anonymous refresh when anonymous feed access is disabled [#​9354](FreshRSS/FreshRSS#9354) - Fix regression with HTTPS proxies due to wrong TLS SNI resolution [#​9341](FreshRSS/FreshRSS#9341) - Better enforce limits for feeds and categories [#​9357](FreshRSS/FreshRSS#9357) - Fix JavaScript error when opening a label menu in sidebar [#​9377](FreshRSS/FreshRSS#9377) - Fix custom favicon with GReader API [#​9409](FreshRSS/FreshRSS#9409) - CLI - Add optional feed argument to `actualize-user.php` [#​9319](FreshRSS/FreshRSS#9319) - UI - Various UI and style improvements [#​9298](FreshRSS/FreshRSS#9298), [#​9369](FreshRSS/FreshRSS#9369), [#​9388](FreshRSS/FreshRSS#9388) - Extensions - Call `check_url_before_add` hook when previewing a feed [#​9343](FreshRSS/FreshRSS#9343) - I18n - Add Belarusian [#​9351](FreshRSS/FreshRSS#9351) - Improve German [#​9370](FreshRSS/FreshRSS#9370), [#​9385](FreshRSS/FreshRSS#9385) - Improve Italian [#​9370](FreshRSS/FreshRSS#9370) - Improve Japanese [#​9398](FreshRSS/FreshRSS#9398) - Improve Turkish [#​9349](FreshRSS/FreshRSS#9349) - Misc. - Check SVG optimization in the tests CI workflow with SVGO [#​9361](FreshRSS/FreshRSS#9361) - Move PHPUnit flags to a config file and use strictest failure mode [#​9374](FreshRSS/FreshRSS#9374) - Avoid writing to log files during unit tests [#​9373](FreshRSS/FreshRSS#9373) - Bump Ruby gems automatically with Dependabot for docs [#​9401](FreshRSS/FreshRSS#9401) - Update dev dependencies [#​9323](FreshRSS/FreshRSS#9323), [#​9324](FreshRSS/FreshRSS#9324), [#​9325](FreshRSS/FreshRSS#9325), [#​9326](FreshRSS/FreshRSS#9326), [#​9327](FreshRSS/FreshRSS#9327), [#​9328](FreshRSS/FreshRSS#9328), [#​9368](FreshRSS/FreshRSS#9368), [#​9378](FreshRSS/FreshRSS#9378), [#​9379](FreshRSS/FreshRSS#9379), [#​9380](FreshRSS/FreshRSS#9380), [#​9381](FreshRSS/FreshRSS#9381), [#​9402](FreshRSS/FreshRSS#9402), [#​9403](FreshRSS/FreshRSS#9403), [#​9404](FreshRSS/FreshRSS#9404), [#​9405](FreshRSS/FreshRSS#9405), [#​9406](FreshRSS/FreshRSS#9406), [#​9407](FreshRSS/FreshRSS#9407) </details> --- ### Configuration 📅 **Schedule**: (in timezone America/New_York) - Branch creation - At any time (no schedule defined) - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about these updates again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMzMuMCIsInVwZGF0ZWRJblZlciI6IjQ0LjEzMy4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJyZW5vdmF0ZS9jb250YWluZXIiLCJ0eXBlL3BhdGNoIl19--> Reviewed-on: https://git.greyrock.io/todd/home-ops/pulls/358
Because of the environment variable `CI=true` being passed in GitHub Actions to SVGO, it outputted colored text with ANSI escape sequences, which broke the awk 0% filtering (for unchanged files). Ref: #9361 (comment)
Previously it was only recommended by the documentation that SVG images should be optimized using SVGOMG, the web GUI version of https://github.com/svg/svgo (CLI)
Now all SVG images are optimized, and optimization is mandatory enforced by the tests CI workflow.
+ SVGs are sanitized of potentially malicious JS code using the https://svgo.dev/docs/plugins/removeScripts/ plugin