Skip to content

Commit

Permalink
ci: remove svgo
Browse files Browse the repository at this point in the history
Signed-off-by: Zxilly <[email protected]>
  • Loading branch information
Zxilly committed Aug 6, 2024
1 parent 76c02a9 commit 29bdada
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 39 deletions.
5 changes: 0 additions & 5 deletions .github/actions/setup-script/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,6 @@ runs:
run: |
poetry install
- name: Install svgo
if: ${{ inputs.report == 'true' }}
shell: bash
run: npm install -g svgo

- name: Install Go tools
shell: bash
if: ${{ inputs.coverage == 'true' }}
Expand Down
4 changes: 1 addition & 3 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,10 @@ python scripts/generate.py

Collect the test results and generate a report in GitHub Actions format.

Requires `svgo` to be installed to optimize the SVG files.

It uses service [Zxilly/data2image](https://github.com/Zxilly/data2image) to bypass
GitHub data-uri limit. This project was written in `Rust`.

The svg data was optimized with `svgo` then compressed with `zstd` and encoded with `base64`
The svg data was optimized then compressed with `zstd` and encoded with `base64`
for safe inclusion in the url.

```bash
Expand Down
2 changes: 0 additions & 2 deletions scripts/pgo.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ def merge_profiles():
if __name__ == '__main__':
shutil.rmtree(os.path.join(get_project_root(), "results"), ignore_errors=True)

tool.gsa.DISABLE_DRAW = True

with build_pgo_gsa() as gsa:
run_integration_tests("real", gsa)
merge_profiles()
15 changes: 14 additions & 1 deletion scripts/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions scripts/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ tqdm = "^4.66.5"
matplotlib = "3.9.0"
psutil = "^6.0.0"
markdown-strings = "^3.4.0"
scour = "^0.38.2"

[tool.poetry.group.research]
optional = true
Expand Down
3 changes: 0 additions & 3 deletions scripts/tool/gsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ def build_pgo_gsa():
os.remove(temp_binary)


DISABLE_DRAW = False


class GSAInstance:
def __init__(self, binary: str):
self.binary = binary
Expand Down
3 changes: 0 additions & 3 deletions scripts/tool/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import psutil

from .gsa import DISABLE_DRAW
from .matplotlib import draw_usage
from .utils import get_covdata_integration_dir, get_project_root

Expand All @@ -16,8 +15,6 @@ def run_process(
timeout=240,
profiler_dir: str = None,
draw: bool = False) -> [str, bytes | None]:
if DISABLE_DRAW:
draw = False

env = os.environ.copy()
env["GOCOVERDIR"] = get_covdata_integration_dir()
Expand Down
24 changes: 2 additions & 22 deletions scripts/tool/svgo.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,5 @@
import shutil
import subprocess


def require_svgo() -> str:
svgo = shutil.which("svgo")
if svgo is None:
raise Exception("svgo is required to optimize SVG files.")
return svgo
from scour import scour


def optimize_svg(d: str) -> str:
# svgo -i - -o -
return subprocess.check_output(
args=[
require_svgo(),
"-i",
"-",
"-o",
"-",
"--multipass",
],
input=d,
text=True,
)
return scour.scourString(d)

0 comments on commit 29bdada

Please sign in to comment.