Skip to content

Commit

Permalink
ci: add workflow to check and optimize svgs (#445)
Browse files Browse the repository at this point in the history
### Description

<!--
Summary of change.
Example: Add sepolia chain
-->

- Add workflow to trigger script to validate and optimize SVGs
- Add script to validate SVG and then optimize
- Added [SVGO library ](https://www.npmjs.com/package/svgo), which helps
optimize SVGs

PD: Many svgs were optimized, but it shouldn't trigger again since no
changes will be needed

(Tested with Max 20KBs but it should be 100 KBs)
![Screenshot 2024-12-23 at 7 48
03 AM](https://github.com/user-attachments/assets/8d3e2b4b-c863-49e1-82d4-893c58e99002)



### Backward compatibility
Yes

### Testing

CLI testing and testing in warp ui

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: xeno097 <[email protected]>
  • Loading branch information
3 people authored Dec 23, 2024
1 parent 207a4ff commit 36b4c5f
Show file tree
Hide file tree
Showing 256 changed files with 613 additions and 718 deletions.
5 changes: 5 additions & 0 deletions .changeset/nervous-needles-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/registry': minor
---

Add workflow to validate and optimize SVGs, update SVGs with optimized version
14 changes: 7 additions & 7 deletions .github/workflows/combine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ jobs:

- name: yarn-install
run: |
yarn install
CHANGES=$(git status -s)
if [[ ! -z $CHANGES ]]; then
echo "Changes found: $CHANGES"
git diff
exit 1
fi
yarn install
CHANGES=$(git status -s)
if [[ ! -z $CHANGES ]]; then
echo "Changes found: $CHANGES"
git diff
exit 1
fi
- name: foundry-install
uses: foundry-rs/foundry-toolchain@v1
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/optimize-svg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: optimize-svg

on:
pull_request:
# Allows you to run this workflow manually
workflow_dispatch:

jobs:
optimize:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref || 'main' }}
token: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/cache@v4
with:
path: |
**/node_modules
.yarn/cache
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('./yarn.lock') }}

- name: yarn-install
run: |
yarn install
CHANGES=$(git status -s)
if [[ ! -z $CHANGES ]]; then
echo "Changes found: $CHANGES"
git diff
exit 1
fi
- name: setup-node
uses: actions/setup-node@v3
with:
node-version: 20

- name: validate-optimize-svgs
run: |
node ./scripts/optimize-svg.js
- name: configure-git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: commit-changes
run: |
CHANGES=$(git status -s)
if [[ ! -z $CHANGES ]]; then
git add .
git commit -m "Optimize SVG files"
git push
else
echo "No changes to commit."
fi
2 changes: 1 addition & 1 deletion chains/abstracttestnet/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion chains/alephzeroevmmainnet/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion chains/alephzeroevmtestnet/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion chains/alfajores/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion chains/ancient8/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion chains/apechain/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 36b4c5f

Please sign in to comment.