Skip to content

Commit a7619e2

Browse files
committed
Add try-except in icomoon_upload. Workflow will also upload geckodriver.log as an artifact for debugging purpose
1 parent dcdcc60 commit a7619e2

4 files changed

Lines changed: 32 additions & 18 deletions

File tree

.github/scripts/build_assets/filehandler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def get_svgs_paths(new_icons: List[dict], icons_folder_path: str) -> List[str]:
5959
if not folder_path.is_dir():
6060
raise ValueError(f"Invalid path. This is not a directory: {folder_path}.")
6161

62+
# TODO: remove the try-except when the devicon.json is upgraded
6263
try:
6364
aliases = icon_info["aliases"]
6465
except KeyError:

.github/scripts/icomoon_upload.py

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from pathlib import Path
22
from argparse import ArgumentParser
3+
from selenium.common.exceptions import TimeoutException
34

45
# pycharm complains that build_assets is an unresolved ref
56
# don't worry about it, the script still runs
@@ -42,20 +43,25 @@ def main():
4243
print("No files need to be uploaded. Ending script...")
4344
return
4445

45-
runner = SeleniumRunner(args.icomoon_json_path, args.download_path,
46-
args.geckodriver_path, args.headless)
47-
runner.upload_icomoon()
48-
svgs = filehandler.get_svgs_paths(new_icons, args.icons_folder_path)
49-
runner.upload_svgs(svgs)
50-
51-
52-
zip_name = "devicon-v1.0.zip"
53-
zip_path = Path(args.download_path, zip_name)
54-
runner.download_icomoon_fonts(zip_path)
55-
filehandler.extract_files(str(zip_path), args.download_path)
56-
filehandler.rename_extracted_files(args.download_path)
57-
runner.close()
58-
print("Task completed.")
46+
try:
47+
runner = SeleniumRunner(args.icomoon_json_path, args.download_path,
48+
args.geckodriver_path, args.headless)
49+
runner.upload_icomoon()
50+
svgs = filehandler.get_svgs_paths(new_icons, args.icons_folder_path)
51+
runner.upload_svgs(svgs)
52+
53+
54+
zip_name = "devicon-v1.0.zip"
55+
zip_path = Path(args.download_path, zip_name)
56+
runner.download_icomoon_fonts(zip_path)
57+
filehandler.extract_files(str(zip_path), args.download_path)
58+
filehandler.rename_extracted_files(args.download_path)
59+
runner.close()
60+
print("Task completed.")
61+
except TimeoutException as e:
62+
print(e)
63+
print(e.stacktrace)
64+
runner.close()
5965

6066

6167
if __name__ == "__main__":

.github/scripts/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
selenium
1+
selenium==3.141.0

.github/workflows/build_icons.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ name: Build Icons
22
on:
33
pull_request:
44
branches:
5-
- build-integrate
5+
- master
6+
push:
7+
branches:
8+
- master
69
jobs:
710
build:
811
name: Get Fonts From Icomoon
@@ -23,9 +26,13 @@ jobs:
2326
run: >
2427
python ./.github/scripts/icomoon_upload.py
2528
./.github/scripts/build_assets/geckodriver-v0.27.0-win64/geckodriver.exe
26-
./icomoon.json ./devicon.json ./icons ./built_files --headless
29+
./icomoon.json ./devicon.json ./icons ./ --headless
30+
- name: Upload geckodriver.log for debugging purposes
31+
uses: actions/upload-artifact@v2
32+
with:
33+
path: ./geckodriver.log
2734
- name: Commit changes
2835
uses: stefanzweifel/git-auto-commit-action@v4
2936
with:
3037
commit_message: Built new icons, icomoon.json and devicon.css
31-
branch: action-fix
38+
branch: build-integrate

0 commit comments

Comments
 (0)