Skip to content

Commit

Permalink
add ci that is supposed to fail
Browse files Browse the repository at this point in the history
  • Loading branch information
eagleoflqj committed Aug 25, 2023
1 parent d71cde6 commit 94787f9
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
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)

0 comments on commit 94787f9

Please sign in to comment.