Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v2.8.0 #396

Merged
merged 55 commits into from
Jan 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
8bbd49c
Bump ini from 1.3.5 to 1.3.8
dependabot[bot] Dec 12, 2020
e0d3525
Merge pull request #387 from devicons/dependabot/npm_and_yarn/ini-1.3.8
Thomas-Boi Dec 12, 2020
4272e67
Moved gh pages into master branch
Thomas-Boi Dec 13, 2020
f2720f5
Moved index.html into docs/
Thomas-Boi Dec 13, 2020
31703d8
Move browerconfig and CNAME into docs/
Thomas-Boi Dec 14, 2020
99495cc
Added missing icons from the devicon.dev site
Thomas-Boi Dec 15, 2020
8ebba86
Merge pull request #394 from devicons/TB_ghPage
amacado Dec 15, 2020
ab0cba5
Add the public-upload-to-imgur action
Thomas-Boi Dec 19, 2020
f51bda7
Added pr comment action
Thomas-Boi Dec 19, 2020
426d950
Finalize new peek action workflow
Thomas-Boi Dec 19, 2020
4ec9d85
Updated the workflow yaml to use the new repo
Thomas-Boi Dec 28, 2020
3544e15
Merge pull request #398 from devicons/TB_actionTest
amacado Dec 28, 2020
f97406d
implementing method for copying the resulting build files (and source…
amacado Dec 28, 2020
843c073
use devicon icons for buttons
amacado Dec 28, 2020
3f38ec5
fetch latest release via github api and use it for showing the header…
amacado Dec 28, 2020
eb6884d
Added zoomed in snapshot for peek scripts
Thomas-Boi Dec 29, 2020
0c3fe80
close scope of icon styles
Dec 29, 2020
44617e7
Fix typo in icon-request issue template to add label automatically, C…
EnisMulic Dec 29, 2020
e5fd851
Fix markdown formating
EnisMulic Dec 29, 2020
cb03303
Merge pull request #406 from EnisMulic/fix/issue_template
amacado Dec 29, 2020
8a5ff05
Various bug fixes and reference update
Thomas-Boi Dec 29, 2020
c388503
Refactored take screenshot and remove color functions
Thomas-Boi Dec 29, 2020
a9eb51a
Various bug fixes and added ability to comment multiple files
Thomas-Boi Dec 30, 2020
c2e297b
fix ceylon and electron
Dec 30, 2020
6feea6f
fix ceylon and electron
Dec 30, 2020
0326a73
fix haskell
Dec 30, 2020
2dea2f4
Merge remote-tracking branch 'origin/develop' into amacado/feature/39…
amacado Dec 30, 2020
63fb4fd
resetting /docs/dist idea of storing icons in docs folder
amacado Dec 30, 2020
6e8588d
revert devicon.min.css
amacado Dec 30, 2020
d6cf3f5
Add new icon Bash (Original, Plain), Closes #303
EnisMulic Dec 30, 2020
c798e67
update resource links to raw githubusercontent
amacado Dec 30, 2020
3603b78
Remove unnecessary comments
EnisMulic Dec 30, 2020
c89b043
Add font info
EnisMulic Dec 30, 2020
1eee121
Merge pull request #403 from rawdanowiczdev/classes-to-fill
Thomas-Boi Dec 30, 2020
ca2f948
Merge pull request #401 from devicons/amacado/feature/395-auto-update…
Thomas-Boi Dec 30, 2020
a84cd46
Added comments and script now fail if can't find icon name
Thomas-Boi Dec 30, 2020
e51fb1c
Fixed error with logging
Thomas-Boi Dec 30, 2020
d7413b5
Updated CONTRIBUTING
Thomas-Boi Dec 30, 2020
799878e
Update handling outputs in build_icons.yml
Thomas-Boi Dec 30, 2020
34a1866
Merge pull request #412 from devicons/TB_peekUpgrade
Thomas-Boi Dec 30, 2020
c17037f
Merge branch 'develop' of https://github.com/devicons/devicon into de…
Thomas-Boi Dec 30, 2020
b2d7fc7
Updated CONTRIBUTING
Thomas-Boi Dec 30, 2020
33c56b2
Made eps requirements optional and clear up some terms
Thomas-Boi Dec 30, 2020
d217bcf
Update imgur action ref
Thomas-Boi Dec 30, 2020
aa8a10b
Merge branch 'develop' of https://github.com/devicons/devicon into fe…
EnisMulic Dec 31, 2020
860a9da
Merge develop
EnisMulic Dec 31, 2020
64585e9
new icon Bash (original, plain)
EnisMulic Dec 31, 2020
9671ffa
Merge upstream develop
EnisMulic Dec 31, 2020
0fb8473
Resolve merge conflict issues
EnisMulic Dec 31, 2020
fce491e
Fixed merge issue in CONTRIBUTING.md
Thomas-Boi Dec 31, 2020
6c01226
Changed return to sys.exit in python script to show error
Thomas-Boi Dec 31, 2020
d17eb46
Remove duplicate bash entry
EnisMulic Dec 31, 2020
1038b7a
Added color tab error handling and better logging
Thomas-Boi Jan 1, 2021
a0d90ea
Merge pull request #415 from EnisMulic/feature/icon/bash
amacado Jan 1, 2021
4c397cf
Merge pull request #416 from devicons/TB_contributing
amacado Jan 1, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/icon-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Icon request
about: Requesting a new icon or changes to an existing icon
title: 'Icon request: [NAME]'
labels: 'request: icon'
labels: 'request:icon'
assignees: ''

---
Expand Down
190 changes: 89 additions & 101 deletions .github/scripts/build_assets/SeleniumRunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,70 +89,54 @@ def upload_icomoon(self, icomoon_json_path: str):
:raises TimeoutException: happens when elements are not found.
"""
print("Uploading icomoon.json file...")
try:
self.click_hamburger_input()

# find the file input and enter the file path
import_btn = self.driver.find_element(By.XPATH, "(//li[@class='file'])[1]//input")
import_btn.send_keys(icomoon_json_path)
except SeleniumTimeoutException as e:
print(e.stacktrace)
print("Selenium timed out. Couldn't find import button.")
self.close()
raise e
except Exception as e:
self.close()
raise e
self.click_hamburger_input()

# find the file input and enter the file path
import_btn = self.driver.find_element(By.XPATH, "(//li[@class='file'])[1]//input")
import_btn.send_keys(icomoon_json_path)

try:
confirm_btn = WebDriverWait(self.driver, SeleniumRunner.MED_WAIT_IN_SEC).until(
ec.element_to_be_clickable((By.XPATH, "//div[@class='overlay']//button[text()='Yes']"))
)
confirm_btn.click()
except SeleniumTimeoutException as e:
print(e.stacktrace)
print("Cannot find the confirm button when uploading the icomoon.json",
"Ensure that the icomoon.json is in the correct format for Icomoon.io",
sep='\n')
self.close()
raise Exception("Cannot find the confirm button when uploading the icomoon.json" \
"Ensure that the icomoon.json is in the correct format for Icomoon.io")

print("JSON file uploaded.")

def upload_svgs(self, svgs: List[str]):
def upload_svgs(self, svgs: List[str], screenshot_folder: str=""):
"""
Upload the SVGs provided in folder_info
:param svgs: a list of svg Paths that we'll upload to icomoon.
:param screenshot_folder: the name of the screenshot_folder. If
the value is provided, it means the user want to take a screenshot
of each icon.
"""
try:
print("Uploading SVGs...")
print("Uploading SVGs...")

edit_mode_btn = self.driver.find_element_by_css_selector(
"div.btnBar button i.icon-edit"
)
edit_mode_btn.click()

self.click_hamburger_input()

for svg in svgs:
import_btn = self.driver.find_element_by_css_selector(
"li.file input[type=file]"
)
import_btn.send_keys(svg)
print(f"Uploaded {svg}")
self.test_for_possible_alert(self.SHORT_WAIT_IN_SEC, "Dismiss")
self.remove_color_from_icon()

# take a screenshot of the icons that were just added
self.driver.save_screenshot("new_icons.png");
self.click_hamburger_input()
select_all_button = WebDriverWait(self.driver, self.LONG_WAIT_IN_SEC).until(
ec.element_to_be_clickable((By.XPATH, "//button[text()='Select All']"))
edit_mode_btn = self.driver.find_element_by_css_selector(
"div.btnBar button i.icon-edit"
)
edit_mode_btn.click()

self.click_hamburger_input()

for i in range(len(svgs)):
import_btn = self.driver.find_element_by_css_selector(
"li.file input[type=file]"
)
select_all_button.click()
print("Finished uploading the svgs...")
except Exception as e:
self.close()
raise e
import_btn.send_keys(svgs[i])
print(f"Uploaded {svgs[i]}")
self.test_for_possible_alert(self.SHORT_WAIT_IN_SEC, "Dismiss")
self.click_on_just_added_icon(screenshot_folder, i)

# take a screenshot of the icons that were just added
new_icons_path = str(Path(screenshot_folder, "new_icons.png").resolve())
self.driver.save_screenshot(new_icons_path);

print("Finished uploading the svgs...")

def click_hamburger_input(self):
"""
Expand All @@ -161,20 +145,16 @@ def click_hamburger_input(self):
input two times before the menu appears.
:return: None.
"""
try:
hamburger_input = self.driver.find_element_by_xpath(
"(//i[@class='icon-menu'])[2]"
)
hamburger_input = self.driver.find_element_by_xpath(
"(//i[@class='icon-menu'])[2]"
)

menu_appear_callback = ec.element_to_be_clickable(
(By.CSS_SELECTOR, "h1 ul.menuList2")
)
menu_appear_callback = ec.element_to_be_clickable(
(By.CSS_SELECTOR, "h1 ul.menuList2")
)

while not menu_appear_callback(self.driver):
hamburger_input.click()
except Exception as e:
self.close()
raise e
while not menu_appear_callback(self.driver):
hamburger_input.click()

def test_for_possible_alert(self, wait_period: float, btn_text: str):
"""
Expand All @@ -191,22 +171,37 @@ def test_for_possible_alert(self, wait_period: float, btn_text: str):
)
dismiss_btn.click()
except SeleniumTimeoutException:
pass
pass # nothing found => everything is good

def click_on_just_added_icon(self, screenshot_folder: str, index: int):
"""
Click on the most recently added icon so we can remove the colors
and take a snapshot if needed.
"""
recently_uploaded_icon = WebDriverWait(self.driver, self.LONG_WAIT_IN_SEC).until(
ec.element_to_be_clickable((By.XPATH, "//div[@id='set0']//mi-box[1]//div"))
)
recently_uploaded_icon.click()

self.remove_color_from_icon()

if screenshot_folder:
screenshot_path = str(Path(screenshot_folder, f"screenshot_{index}.png").resolve())
self.driver.save_screenshot(screenshot_path)
print("Took screenshot and saved it at " + screenshot_path)

close_btn = self.driver \
.find_element_by_css_selector("div.overlayWindow i.icon-close")
close_btn.click()

def remove_color_from_icon(self):
"""
Remove the color from the most recent uploaded icon.
:return: None.
This is because some SVG have colors in them and we don't want to
force contributors to remove them in case people want the colored SVGs.
The color removal is also necessary so that the Icomoon-generated
icons fit within one font symbol/ligiature.
"""
try:
recently_uploaded_icon = WebDriverWait(self.driver, self.LONG_WAIT_IN_SEC).until(
ec.element_to_be_clickable((By.XPATH, "//div[@id='set0']//mi-box[1]//div"))
)
recently_uploaded_icon.click()
except Exception as e:
self.close()
raise e

try:
color_tab = WebDriverWait(self.driver, self.SHORT_WAIT_IN_SEC).until(
ec.element_to_be_clickable((By.CSS_SELECTOR, "div.overlayWindow i.icon-droplet"))
Expand All @@ -217,42 +212,35 @@ def remove_color_from_icon(self):
.find_element_by_css_selector("div.overlayWindow i.icon-droplet-cross")
remove_color_btn.click()
except SeleniumTimeoutException:
pass
except Exception as e:
self.close()
raise e

try:
close_btn = self.driver \
.find_element_by_css_selector("div.overlayWindow i.icon-close")
close_btn.click()
except Exception as e:
self.close()
raise e
pass # do nothing cause sometimes, the color tab doesn't appear in the site

def download_icomoon_fonts(self, zip_path: Path):
"""
Download the icomoon.zip from icomoon.io.
:param zip_path: the path to the zip file after it's downloaded.
"""
try:
print("Downloading Font files...")
self.driver.find_element_by_css_selector(
"a[href='#/select/font']"
).click()

self.test_for_possible_alert(self.MED_WAIT_IN_SEC, "Continue")
download_btn = WebDriverWait(self.driver, SeleniumRunner.LONG_WAIT_IN_SEC).until(
ec.presence_of_element_located((By.CSS_SELECTOR, "button.btn4 span"))
)
download_btn.click()
if self.wait_for_zip(zip_path):
print("Font files downloaded.")
else:
raise TimeoutError(f"Couldn't find {zip_path} after download button was clicked.")
except Exception as e:
self.close()
raise e
# select all the svgs so that the newly added svg are part of the collection
self.click_hamburger_input()
select_all_button = WebDriverWait(self.driver, self.LONG_WAIT_IN_SEC).until(
ec.element_to_be_clickable((By.XPATH, "//button[text()='Select All']"))
)
select_all_button.click()

print("Downloading Font files...")
font_tab = self.driver.find_element_by_css_selector(
"a[href='#/select/font']"
)
font_tab.click()

self.test_for_possible_alert(self.MED_WAIT_IN_SEC, "Continue")
download_btn = WebDriverWait(self.driver, SeleniumRunner.LONG_WAIT_IN_SEC).until(
ec.presence_of_element_located((By.CSS_SELECTOR, "button.btn4 span"))
)
download_btn.click()
if self.wait_for_zip(zip_path):
print("Font files downloaded.")
else:
raise TimeoutError(f"Couldn't find {zip_path} after download button was clicked.")

def wait_for_zip(self, zip_path: Path) -> bool:
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from pathlib import Path
from argparse import ArgumentParser
from build_assets.PathResolverAction import PathResolverAction

def get_commandline_args():

def get_selenium_runner_args(peek_mode=False):
parser = ArgumentParser(description="Upload svgs to Icomoon to create icon files.")

parser.add_argument("--headless",
Expand All @@ -26,8 +26,11 @@ def get_commandline_args():
action=PathResolverAction)

parser.add_argument("download_path",
help="The path where you'd like to download the Icomoon files to",
help="The download destination of the Icomoon files",
action=PathResolverAction)

if peek_mode:
parser.add_argument("--pr_title",
help="The title of the PR that we are peeking at")

return parser.parse_args()
21 changes: 21 additions & 0 deletions .github/scripts/build_assets/filehandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,24 @@ def rename_extracted_files(extract_path: str):
os.replace(dict_["old"], dict_["new"])

print("Files renamed")


def create_screenshot_folder(dir, screenshot_name: str="screenshots/"):
"""
Create a screenshots folder in the dir.
:param dir, the dir where we want to create the folder.
:param screenshot_name, the name of the screenshot folder.
:raise Exception if the dir provided is not a directory.
:return the string name of the screenshot folder.
"""
folder = Path(dir).resolve()
if not folder.is_dir():
raise Exception(f"This is not a dir: {str(folder)}. \ndir must be a valid directory")

screenshot_folder = Path(folder, screenshot_name)
try:
os.mkdir(screenshot_folder)
except FileExistsError:
print(f"{screenshot_folder} already exist. Script will do nothing.")
finally:
return str(screenshot_folder)
10 changes: 10 additions & 0 deletions .github/scripts/generate_screenshot_markdown.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import json
import os


if __name__ == "__main__":
img_urls_list = json.loads(os.environ["IMG_URLS"])
template = "![Detailed Screenshot]({})"
markdown = [template.format(img_url) for img_url in img_urls_list]
print("\n\n".join(markdown))

15 changes: 8 additions & 7 deletions .github/scripts/icomoon_build.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
from pathlib import Path
import sys
from selenium.common.exceptions import TimeoutException

# pycharm complains that build_assets is an unresolved ref
# don't worry about it, the script still runs
from build_assets.SeleniumRunner import SeleniumRunner
from build_assets import filehandler, util
from build_assets import filehandler, arg_getters


def main():
args = util.get_commandline_args()
args = arg_getters.get_selenium_runner_args()
new_icons = filehandler.find_new_icons(args.devicon_json_path, args.icomoon_json_path)
if len(new_icons) == 0:
print("No files need to be uploaded. Ending script...")
return
sys.exit("No files need to be uploaded. Ending script...")

# print list of new icons
print("List of new icons:", *new_icons, sep = "\n")
Expand All @@ -32,10 +32,11 @@ def main():
filehandler.rename_extracted_files(args.download_path)
print("Task completed.")
except TimeoutException as e:
print(e)
print(e.stacktrace)
sys.exit("Selenium Time Out Error: \n" + str(e))
except Exception as e:
sys.exit(e)
finally:
runner.close()
runner.close()


if __name__ == "__main__":
Expand Down
Loading