Skip to content

Commit

Permalink
Add CI (#52)
Browse files Browse the repository at this point in the history
* add ci that is supposed to fail

* fix 安道爾
  • Loading branch information
eagleoflqj authored Aug 25, 2023
1 parent d71cde6 commit a18b099
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: CI

on:
push:
branches:
- master
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout last commit
uses: actions/checkout@v3
- name: Check format
run: python check.py
17 changes: 17 additions & 0 deletions check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import re

errors: list[tuple[str, int, str]] = []

for name in ('emoji_category.txt', 'emoji_word.txt'):
with open(f'opencc/{name}') as file:
lines = file.readlines()
for i, line in enumerate(lines):
match = re.match(r'(\S+)\t(\S+)( \S+)+', line)
if not match or match.group(1) != match.group(2):
errors.append((name, i + 1, line[:-1] if line.endswith('\n') else line))

if errors:
print('Format error')
for error in errors:
print(f'{error[0]}:{error[1]} {error[2]}')
exit(1)
2 changes: 1 addition & 1 deletion opencc/emoji_word.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,7 @@ X光 X光 🩻
安全帽 安全帽 ⛑️
安哥拉 安哥拉 🇦🇴
安圭拉 安圭拉 🇦🇮
安道爾 🇦🇩
安道爾 安道爾 🇦🇩
安地卡及巴布達 安地卡及巴布達 🇦🇬
安慰 安慰 🤗️
安提瓜和巴布達 安提瓜和巴布達 🇦🇬
Expand Down

0 comments on commit a18b099

Please sign in to comment.