Skip to content

Commit

Permalink
Add CI via GitHub Actions (#9)
Browse files Browse the repository at this point in the history
The version of inkscape available uses new commandline flags and
generates slightly different output, so the exports have been updated as
well.
  • Loading branch information
calcmogul authored Aug 14, 2024
1 parent 475fb59 commit d61e34a
Show file tree
Hide file tree
Showing 11 changed files with 452 additions and 496 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: CI

on: [push, pull_request]

jobs:
format:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install black
run: pip3 install black
- name: Run black
run: python3 -m black .
- name: Check output
run: git --no-pager diff --exit-code HEAD

export:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Install inkscape and imagemagick
run: |
sudo add-apt-repository ppa:inkscape.dev/stable
sudo apt-get update -q
sudo apt-get install inkscape imagemagick -y
- name: Run inkscape export
run: |
inkscape --version
./export.py
- name: Check output
# Ignore .svg files because Ubuntu 22.04 inkscape has round-off issues and
# .ico files because Ubuntu 22.04 ImageMagick gives different results
run: git --no-pager diff --exit-code HEAD -- . ':!ico' ':!svg'
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

16 changes: 7 additions & 9 deletions export.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,20 @@ def main():
subprocess.run(
[
"inkscape",
"-z",
"--file=" + svg[i],
"--export-plain-svg=" + plain_svg[i],
"--export-type=svg",
"--export-filename=" + plain_svg[i],
"--export-text-to-path",
svg[i],
]
)
print(" done.")

# Compile regexes
rgxes = [
re.compile('^\s+sodipodi:docname="((.|\n)*?")\n', re.M),
re.compile('^\s+inkscape:export="((.|\n)*?")\n', re.M),
re.compile('^\s+inkscape:version="((.|\n)*?")\n', re.M),
re.compile("^\s+<metadata\s+((.|\n)*?</metadata>)\n", re.M),
re.compile("^\s+<defs\s+((.|\n)*?/>)\n", re.M),
re.compile("^\s+<sodipodi:namedview\s+((.|\n)*?/>)\n", re.M),
re.compile(r'^\s+sodipodi:docname="((.|\n)*?")\n', re.M),
re.compile(r"^\s+<metadata\s+((.|\n)*?</metadata>)\n", re.M),
re.compile(r"^\s+<defs\s+((.|\n)*?/>)\n", re.M),
re.compile(r"^\s+<sodipodi:namedview\s+((.|\n)*?/>)\n", re.M),
]

# Remove excess metadata from Inkscape and plain SVGs
Expand Down
Binary file modified png/wpilib-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified png/wpilib-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions rasterize.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ def rasterize(svg, raster_extension, raster_sizes):
subprocess.run(
[
"inkscape",
"-z",
"--file=" + svg,
"--export-png=" + out_name,
"--export-type=png",
"--export-filename=" + out_name,
"--export-height=" + str(size),
svg,
]
)
except FileNotFoundError:
Expand Down
160 changes: 68 additions & 92 deletions svg/wpilib-horiz-indiv.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
184 changes: 68 additions & 116 deletions svg/wpilib-horiz-team.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
229 changes: 119 additions & 110 deletions svg/wpilib-vert-indiv.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
232 changes: 108 additions & 124 deletions svg/wpilib-vert-team.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
71 changes: 46 additions & 25 deletions svg/wpilib.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d61e34a

Please sign in to comment.