Skip to content

dev/sg: re-enable SVG lint in CI, migrate svgo.sh to go script

Administrator requested to merge svgo into main

Created by: bobheadxi

Re-enables svgo.sh, I think the issue was ultimately the second yarn install that runs after withYarnCache(). This PR removes that line, and along the way:

  • Migrate svgo.sh to Go script
  • Adds sg lint compatibility with sg -v lint to print reports even if they pass
  • Ensure lint runner uses cmd.App.Writer instead of os.Stdout directly for consistency
  • Adds root.Run(*run.Command) *run.Output (depends on https://github.com/sourcegraph/run/pull/15 currently)
  • Updates urfave/cli and sourcegraph/run

Follow-up to https://github.com/sourcegraph/sourcegraph/pull/35386

Test plan

CI fails, script fails locally with test diff:

➜  sourcegraph git:(main) ✗ go run ./dev/sg lint svg
👉 Running checks from target: svg
❌ SVG Compression (0s)
doc/integration/img/vim.svg: exit status 1

Found SVG optimizations. Please run 'yarn optimize-svg-assets ui/assets/img' and commit the result.
👉 Done running linters.
❌ failed linters: SVG Compression
exit status 1
image

Make a diff that doesn't fail:

➜  sourcegraph git:(svgo) ✗ go run ./dev/sg -v lint svg
👉 Running checks from target: svg
✅ SVG Compression (0s)
SVGs okay! (Checked: 1)
👉 Done running linters.

Merge request reports

Loading