Skip to content

Commit 9c6bfdb

Browse files
amacadotylensthilaireEnisMulicThomas-BoiTh1nkK1D
authored
Release 2.9.0 (#485)
* Create eleventy-original.svg * Create eleventy-plain.svg * Update devicon.json * Update eleventy-plain.svg * Update eleventy-original.svg * new icon: sqlalchemy (plain, original, original-workmark) * Add font aliase for sqlalchemy * new icon: microsoftsqlserver (plain, plain-wordmark) (#427) * new icon sqlserver (plain, plain-woodmark) * Update icons/sqlserver/sqlserver-plain-wordmark.svg Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com> * Update icons/sqlserver/sqlserver-plain.svg Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com> * Update devicon.json Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com> * Update devicon.json Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com> * Rename sqlserver icons to microsoftsqlserver Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com> * new icon: kubernetes (plain, plain-wordmark) (#424) * new icon: kubernetes (plain, plain-wordmark) * Update icons/kubernetes/kubernetes-plain.svg Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com> * Update icons/kubernetes/kubernetes-plain-wordmark.svg Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com> Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com> * new icon: rocksdb (plain) (#423) * new icon: rocksdb (plain) * Update icons/rocksdb/rocksdb-plain.svg Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com> Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com> * new icon: googlecloud (original, original-wordmark, plain, plain-wordmark) (#428) * new icon: googlecloud (plain, plain-wordmark, original, original-wordmark) * Update icons/googlecloud/googlecloud-plain.svg Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com> * Update icons/googlecloud/googlecloud-original-wordmark.svg Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com> * Update icons/googlecloud/googlecloud-original.svg Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com> * Fix google cloud icons * Fix googlecloud original * Remove fill redefinition from google cloud original * Fix googlecloud alignment (Test) * Fix googlecloud alignment (test) * Fix googlecloud alignment (test) Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com> * new icon: objectivec (plain) (#425) * new icon: objectivec (plain) * Update icons/objectivec/objectivec-plain.svg Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com> Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com> * new icon uwsgi (original, plain) * Cleanup uwsgi icons * Update devicon.json Co-authored-by: Thomas Bui <43018778+Thomas-Boi@users.noreply.github.com> * Add adobe XD line icon * Add xd-plain and eps file * Clean up xd svg file * Update devicon.json * new icon: firebase (plain, plain-wordmark) (#461) * add icon Firebase (plain, plain-wordmark), Closes #204 * new icon: firebase (plain, plain-wordmark) * update icons * Add plain-wordmark to firebase fonts * new icon: flask (original, original-wordmark) (#463) * Cleanup flask icon * Improve flask icons * Update icons/flask/flask-original-wordmark.svg Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com> Co-authored-by: moghya <sawantshubham571@gmail.com> Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com> * Update devicon.json * Fixed an error with devicon.json * Added check script for the icons and fix icons with fill or viewBox issues (#460) * Added script to check svg fill and viewBox * Fix cucumber-plain-wordmark * Fix various fill and viewBox issues in svgs * Added check for height and width attr * Added check_svgs workflow * Fix an issue where the error is not log properly * Added on push for testing * Updated trigger so it now runs whenever PR is update * Added sleep to script to make logs nicer * Added script that create env var * Updated the github_env to accomodate ubuntu * Change format of log and allow filehandler to return Path * Updated logging messages * Updated refs for the checkout action * Make logging nicer * Updated fix messaging so it's more clear * fix icons: icons/cucumber/cucumber-plain-wordmark.svg, icons/intellij/intellij-plain-wordmark.svg, icons/jenkins/jenkins-plain.svg, icons/twitter/twitter-original.svg, icons/yunohost/yunohost-plain.svg * Fix the ref issue of the checkout action and sqlalchemy (#472) * Remove head_ref from checkout action * Fixed the svg errs in sqlalchemy * Create a monthly script that checks all svgs * Python now print traceback * Updated file names in check_svgs_on_pr * Remove deprecated and unused svg syntax Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com> * Remove deprecated and unused svg syntax Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com> * Update svg fill, remove unused class * Change comment action to a new action * Add guideline about squash merging As the result of discussion #470 update guidelines with squash merging * Redo the workflow archs so we can comment on pr * Moved check_svgs_monthly to draft * Added working workflow file * Changed to file read action * new icon: appwrite (plain, original, wordmark) (#371) * Added Appwrite icon * Fixed wrong JSON input * Fixed JSON style * Fixed indent * Update devicon.json Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com> * Update devicon.json Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com> * Update devicon.json Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com> Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com> * bot:build new icons, icomoon.json and devicon.css (#486) * fix bash-plain (#451) (#453) Co-authored-by: Enis Mulić <enis.s.mulic@gmail.com> * Built new icons, icomoon.json and devicon.css Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com> Co-authored-by: Enis Mulić <enis.s.mulic@gmail.com> Co-authored-by: amacado <amacado@users.noreply.github.com> * Removed 'default fall back icon' from build_icons.yml Co-authored-by: Tylen St Hilaire <28753109+tylensthilaire@users.noreply.github.com> Co-authored-by: Enis Mulić <enis.s.mulic@gmail.com> Co-authored-by: Thomas Bui <43018778+Thomas-Boi@users.noreply.github.com> Co-authored-by: Withee Poositasai <witheep@gmail.com> Co-authored-by: moghya <sawantshubham571@gmail.com> Co-authored-by: Thomas Bui <thomasbui198@gmail.com> Co-authored-by: Eldad A. Fux <eldad.fux@gmail.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: amacado <amacado@users.noreply.github.com>
1 parent c5378d6 commit 9c6bfdb

65 files changed

Lines changed: 4396 additions & 457 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
from typing import List
2+
3+
# abandoned since it's not too hard to check devicon objects using our eyes
4+
# however, still keep in case we need it in the future
5+
6+
def check_devicon_objects(icons: List[dict]):
7+
"""
8+
Check that the devicon objects added is up to standard.
9+
"""
10+
err_msgs = []
11+
for icon in icons:
12+
if type(icon["name"]) != str:
13+
err_msgs.append("'name' must be a string, not: " + str(icon["name"]))
14+
15+
try:
16+
for tag in icon["tags"]:
17+
if type(tag) != str:
18+
raise TypeError()
19+
except TypeError:
20+
err_msgs.append("'tags' must be an array of strings, not: " + str(icon["tags"]))
21+
break
22+
23+
24+
if type(icon["versions"]["svg"]) != list or len(icon["versions"]["svg"]) == 0:
25+
err_msgs.append("Icon name must be a string")
26+
27+
if type(icon["versions"]["font"]) != list or len(icon["versions"]["svg"]) == 0:
28+
err_msgs.append("Icon name must be a string")
29+
30+
if type(icon["color"]) != str or "#" not in icon["color"]:
31+
err_msgs.append("'color' must be a string in the format '#abcdef'")
32+
33+
if type(icon["aliases"]) != list:
34+
err_msgs.append("'aliases' must be an array of dicts")
35+
36+
if len(err_msgs) > 0:
37+
raise Exception("Error found in devicon.json: \n" + "\n".join(err_msgs))
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import traceback
2+
import sys
3+
4+
# pycharm complains that build_assets is an unresolved ref
5+
# don't worry about it, the script still runs
6+
from build_assets import filehandler, arg_getters
7+
from build_assets import util
8+
9+
10+
def main():
11+
"""
12+
Check the quality of the svgs of the whole icons folder.
13+
"""
14+
args = arg_getters.get_check_svgs_monthly_args()
15+
16+
try:
17+
devicon_json = filehandler.get_json_file_content(args.devicon_json_path)
18+
svgs = filehandler.get_svgs_paths(devicon_json, args.icons_folder_path)
19+
util.check_svgs(svgs)
20+
print("All SVGs found were good. Task completed.")
21+
except Exception as e:
22+
util.exit_with_err(e)
23+
24+
25+
if __name__ == "__main__":
26+
main()
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Check SVGs Monthly
2+
on: workflow_dispatch
3+
# schedule:
4+
# - cron: '0 0 1 * *'
5+
jobs:
6+
check_develop:
7+
name: Check the SVGs' quality in the `develop` branch
8+
runs-on: ubuntu-18.04
9+
steps:
10+
11+
- uses: actions/checkout@v2
12+
with:
13+
ref: develop
14+
15+
- uses: actions/setup-python@v2
16+
with:
17+
python-version: 3.8
18+
19+
- name: Install dependencies
20+
run: python -m pip install --upgrade pip
21+
22+
- name: Run the check_svg script
23+
run: >
24+
python ./.github/scripts/check_svgs_monthly.py ./devicon.json ./icons
25+
26+
check_master:
27+
name: Check the SVGs' quality in the `master` branch
28+
runs-on: ubuntu-18.04
29+
steps:
30+
31+
- uses: actions/checkout@v2 # check out default branch, which is master
32+
33+
- uses: actions/setup-python@v2
34+
with:
35+
python-version: 3.8
36+
37+
- name: Install dependencies
38+
run: python -m pip install --upgrade pip
39+
40+
- name: Run the check_svg script
41+
run: >
42+
python ./.github/scripts/check_svgs_monthly.py ./icomoon.json ./devicon.json ./icons

.github/scripts/build_assets/drafts/peek_icons imgur.yml renamed to .github/drafts/peek_icons imgur.yml

File renamed without changes.

.github/scripts/build_assets/arg_getters.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44

55
def get_selenium_runner_args(peek_mode=False):
6+
"""
7+
Get the commandline arguments for the icomoon_peek.py and
8+
icomoon_build.py.
9+
"""
610
parser = ArgumentParser(description="Upload svgs to Icomoon to create icon files.")
711

812
parser.add_argument("--headless",
@@ -33,4 +37,34 @@ def get_selenium_runner_args(peek_mode=False):
3337
parser.add_argument("--pr_title",
3438
help="The title of the PR that we are peeking at")
3539

40+
return parser.parse_args()
41+
42+
43+
def get_check_svgs_on_pr_args():
44+
"""
45+
Get the commandline arguments for the check_svgs_on_pr.py.
46+
"""
47+
parser = ArgumentParser(description="Check the SVGs to ensure their attributes are correct. Run whenever a PR is opened")
48+
parser.add_argument("files_added_json_path",
49+
help="The path to the files_added.json created by the gh-action-get-changed-files@2.1.4",
50+
action=PathResolverAction)
51+
52+
parser.add_argument("files_modified_json_path",
53+
help="The path to the files_modified.json created by the gh-action-get-changed-files@2.1.4",
54+
action=PathResolverAction)
55+
return parser.parse_args()
56+
57+
58+
def get_check_svgs_monthly_args():
59+
"""
60+
Get the commandline arguments for the check_svgs_monthly.py.
61+
"""
62+
parser = ArgumentParser(description="Check the SVGs to ensure their attributes are correct. Run monthly.")
63+
parser.add_argument("devicon_json_path",
64+
help="The path to the devicon.json",
65+
action=PathResolverAction)
66+
67+
parser.add_argument("icons_folder_path",
68+
help="The path to the icons folder",
69+
action=PathResolverAction)
3670
return parser.parse_args()

.github/scripts/build_assets/filehandler.py

Lines changed: 97 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,16 @@
66
import re
77

88

9-
def find_new_icons(devicon_json_path: str, icomoon_json_path: str) -> List[dict]:
9+
def find_new_icons(devicon_json_path: str, icomoon_json_path: str):
1010
"""
1111
Find the newly added icons by finding the difference between
1212
the devicon.json and the icomoon.json.
1313
:param devicon_json_path, the path to the devicon.json.
1414
:param icomoon_json_path: a path to the iconmoon.json.
1515
:return: a list of the new icons as JSON objects.
1616
"""
17-
with open(devicon_json_path) as json_file:
18-
devicon_json = json.load(json_file)
19-
20-
with open(icomoon_json_path) as json_file:
21-
icomoon_json = json.load(json_file)
17+
devicon_json = get_json_file_content(devicon_json_path)
18+
icomoon_json = get_json_file_content(icomoon_json_path)
2219

2320
new_icons = []
2421
for icon in devicon_json:
@@ -28,7 +25,17 @@ def find_new_icons(devicon_json_path: str, icomoon_json_path: str) -> List[dict]
2825
return new_icons
2926

3027

31-
def is_not_in_icomoon_json(icon, icomoon_json) -> bool:
28+
def get_json_file_content(json_path: str):
29+
"""
30+
Get the json content of the json_path.
31+
:param: json_path, the path to the json file.
32+
:return: a dict representing the file content.
33+
"""
34+
with open(json_path) as json_file:
35+
return json.load(json_file)
36+
37+
38+
def is_not_in_icomoon_json(icon, icomoon_json):
3239
"""
3340
Checks whether the icon's name is not in the icomoon_json.
3441
:param icon: the icon object we are searching for.
@@ -44,12 +51,16 @@ def is_not_in_icomoon_json(icon, icomoon_json) -> bool:
4451
return True
4552

4653

47-
def get_svgs_paths(new_icons: List[dict], icons_folder_path: str) -> List[str]:
54+
def get_svgs_paths(new_icons: List[dict], icons_folder_path: str,
55+
icon_versions_only: bool=False, as_str: bool=True):
4856
"""
4957
Get all the suitable svgs file path listed in the devicon.json.
5058
:param new_icons, a list containing the info on the new icons.
5159
:param icons_folder_path, the path where the function can find the
5260
listed folders.
61+
:param icon_versions_only, whether to only get the svgs that can be
62+
made into an icon.
63+
:param: as_str, whether to add the path as a string or as a Path.
5364
:return: a list of svg file paths that can be uploaded to Icomoon.
5465
"""
5566
file_paths = []
@@ -59,27 +70,56 @@ def get_svgs_paths(new_icons: List[dict], icons_folder_path: str) -> List[str]:
5970
if not folder_path.is_dir():
6071
raise ValueError(f"Invalid path. This is not a directory: {folder_path}.")
6172

62-
# TODO: remove the try-except when the devicon.json is upgraded
63-
try:
64-
aliases = icon_info["aliases"]
65-
except KeyError:
66-
aliases = [] # create empty list of aliases if not provided in devicon.json
73+
if icon_versions_only:
74+
get_icon_svgs_paths(folder_path, icon_info, file_paths, as_str)
75+
else:
76+
get_all_svgs_paths(folder_path, icon_info, file_paths, as_str)
77+
return file_paths
78+
79+
80+
def get_icon_svgs_paths(folder_path: Path, icon_info: dict,
81+
file_paths: List[str], as_str: bool):
82+
"""
83+
Get only the svg file paths that can be made into an icon from the icon_info.
84+
:param: folder_path, the folder where we can find the icons.
85+
:param: icon_info, an icon object in the devicon.json.
86+
:param: file_paths, an array containing all the file paths found.
87+
:param: as_str, whether to add the path as a string or as a Path.
88+
"""
89+
aliases = icon_info["aliases"]
90+
91+
for font_version in icon_info["versions"]["font"]:
92+
# if it's an alias, we don't want to make it into an icon
93+
if is_alias(font_version, aliases):
94+
print(f"Skipping this font since it's an alias: {icon_info['name']}-{font_version}.svg")
95+
continue
6796

68-
for font_version in icon_info["versions"]["font"]:
69-
# if it's an alias, we don't want to make it into an icon
70-
if is_alias(font_version, aliases):
71-
print(f"Not exist {icon_info['name']}-{font_version}.svg")
72-
continue
97+
file_name = f"{icon_info['name']}-{font_version}.svg"
98+
path = Path(folder_path, file_name)
7399

74-
file_name = f"{icon_info['name']}-{font_version}.svg"
75-
path = Path(folder_path, file_name)
100+
if path.exists():
101+
file_paths.append(str(path) if as_str else path)
102+
else:
103+
raise ValueError(f"This path doesn't exist: {path}")
76104

77-
if path.exists():
78-
file_paths.append(str(path))
79-
else:
80-
raise ValueError(f"This path doesn't exist: {path}")
81105

82-
return file_paths
106+
def get_all_svgs_paths(folder_path: Path, icon_info: dict,
107+
file_paths: List[str], as_str: bool):
108+
"""
109+
Get all the svg file paths of an icon.
110+
:param: folder_path, the folder where we can find the icons.
111+
:param: icon_info, an icon object in the devicon.json.
112+
:param: file_paths, an array containing all the file paths found.
113+
:param: as_str, whether to add the path as a string or as a Path.
114+
"""
115+
for font_version in icon_info["versions"]["svg"]:
116+
file_name = f"{icon_info['name']}-{font_version}.svg"
117+
path = Path(folder_path, file_name)
118+
119+
if path.exists():
120+
file_paths.append(str(path) if as_str else path)
121+
else:
122+
raise ValueError(f"This path doesn't exist: {path}")
83123

84124

85125
def is_alias(font_version: str, aliases: List[dict]):
@@ -166,3 +206,35 @@ def create_screenshot_folder(dir, screenshot_name: str="screenshots/"):
166206
print(f"{screenshot_folder} already exist. Script will do nothing.")
167207
finally:
168208
return str(screenshot_folder)
209+
210+
def get_added_modified_svgs(files_added_json_path: str,
211+
files_modified_json_path: str):
212+
"""
213+
Get the svgs added and modified from the files_changed_json_path.
214+
:param: files_added_json_path, the path to the files_added.json created by the gh-action-get-changed-files@2.1.4
215+
:param: files_modified_json_path, the path to the files_modified.json created by the gh-action-get-changed-files@2.1.4
216+
:return: a list of the svg file paths that were added/modified in this pr as Path.
217+
"""
218+
files_added = get_json_file_content(files_added_json_path)
219+
files_modified = get_json_file_content(files_modified_json_path)
220+
221+
svgs = []
222+
for file in files_added:
223+
path = Path(file)
224+
if path.suffix.lower() == ".svg":
225+
svgs.append(path)
226+
227+
for file in files_modified:
228+
path = Path(file)
229+
if path.suffix.lower() == ".svg":
230+
svgs.append(path)
231+
232+
return svgs
233+
234+
235+
def write_to_file(path: str, value: any):
236+
"""
237+
Write the value to a JSON file.
238+
"""
239+
with open(path, "w") as file:
240+
file.write(value)

0 commit comments

Comments
 (0)