-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrate to makefile and add deduplicate task
Co-authored-by: John Kenny <[email protected]>
- Loading branch information
1 parent
78f50b2
commit e78f950
Showing
6 changed files
with
72 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[Makefile] | ||
indent_style = tab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
- name: Build test suite | ||
run: make build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/dist/ | ||
/svgs/ | ||
/filter.txt | ||
/*.tar.* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
clean: | ||
rm -rf dist | ||
rm -rf svgs | ||
rm -f oxygen-icons-*.tar.xz | ||
rm -f W3C_SVG_11_TestSuite.tar.gz | ||
|
||
fetch-w3c-test-suite: | ||
mkdir -p svgs/W3C_SVG_11_TestSuite | ||
wget https://www.w3.org/Graphics/SVG/Test/20110816/archives/W3C_SVG_11_TestSuite.tar.gz --no-clobber | ||
tar -tf W3C_SVG_11_TestSuite.tar.gz | grep -E '^svg/.+\.svgz?$$' > filter.txt | ||
tar -C svgs/W3C_SVG_11_TestSuite -xf W3C_SVG_11_TestSuite.tar.gz -T filter.txt | ||
rm filter.txt | ||
|
||
fetch-oxygen-icons: | ||
mkdir -p svgs | ||
wget https://download.kde.org/stable/frameworks/5.113/oxygen-icons-5.113.0.tar.xz --no-clobber | ||
tar -tf oxygen-icons-5.113.0.tar.xz | grep -E '\.svgz?$$' > filter.txt | ||
tar -C svgs -xf oxygen-icons-5.113.0.tar.xz -T filter.txt | ||
rm filter.txt | ||
|
||
normalize: | ||
find svgs -type l -delete | ||
find svgs -type f -name "*.svgz" -exec sh -c '7z e -so {} > $$(echo {} | sed s/\.svgz$$/\.svg/)' \; -delete | ||
find svgs -type f -exec bash -c 'if [ $$(file -bi {} | sed -e "s/.* charset=//") == 'utf-16le' ]; then echo "$$(iconv -f utf-16le -t utf-8 {})" > {}; fi' \; | ||
|
||
deduplicate: | ||
@find svgs -type f | while read FILE; \ | ||
do \ | ||
HASH=$$(sha1sum $$FILE | awk "{ print \$$1 }"); \ | ||
if echo $$HASHES | grep $$HASH -q; then \ | ||
rm $$FILE; \ | ||
else \ | ||
HASHES="$$HASHES $$HASH"; \ | ||
fi; \ | ||
done; | ||
|
||
package: | ||
mkdir -p dist | ||
tar czf dist/svgo-test-suite.tar.gz svgs/* | ||
|
||
build: | ||
make fetch-w3c-test-suite | ||
make fetch-oxygen-icons | ||
make normalize | ||
make deduplicate | ||
make package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters