-
Notifications
You must be signed in to change notification settings - Fork 809
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!-- | ||
感谢您对 HanLP 感兴趣并贡献代码!您非常棒 ✨。 | ||
⚠️修改必须基于 dev 分支进行。 | ||
--> | ||
|
||
# 您的 Pull Request 标题 | ||
|
||
## 描述 | ||
|
||
请包含对此更改的简要概述以及修复的具体问题。还请包含相关的动机和背景说明。列出此更改所需的任何依赖项。 | ||
|
||
修复 #(issue) | ||
|
||
## 更改类型 | ||
|
||
请勾选所有相关选项并删除其他选项。 | ||
|
||
- [ ] Bug 修复(修复不会导致现有功能出问题的非破坏性更改) | ||
- [ ] 破坏性更改(修复或功能会导致现有功能无法按预期工作) | ||
- [ ] 新功能(添加不会破坏现有功能的新功能) | ||
- [ ] 此更改需要更新文档 | ||
|
||
## 测试方式 | ||
|
||
请描述您运行的测试,以验证更改是否有效。提供步骤以便我们复现测试。还请列出测试配置中的相关细节。 | ||
|
||
## 检查清单 | ||
|
||
请检查所有适用项。 | ||
|
||
- [ ] ⚠️更改 **必须** 基于 `dev` 分支,而非 `master` | ||
- [ ] 我已添加测试,证明我的修复是有效的或功能可以正常运行 | ||
- [ ] 新的和现有的单元测试在本地运行通过 | ||
- [ ] 我的代码符合该项目的样式规范 | ||
- [ ] 我在代码中添加了注释,特别是在难以理解的部分 | ||
- [ ] 我已对文档进行了相应更改 | ||
- [ ] 我的更改未产生新的警告 | ||
- [ ] 我已检查代码并纠正了任何拼写错误 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: Unit Tests | ||
|
||
on: | ||
push: | ||
branches: [ "**" ] | ||
pull_request: | ||
branches: [ "**" ] | ||
|
||
permissions: read-all | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ${{ matrix.os }} | ||
env: | ||
HANLP_STATIC_ROOT: ${{ github.workspace }}/data | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ ubuntu-latest, macos-latest, windows-latest ] | ||
python-version: [ 3.6, 3.7, 3.8, 3.9, '3.10', 3.11, 3.12, 3.13 ] | ||
exclude: | ||
# GHA doesn't list 3.6 for ubuntu-22.04 | ||
- os: ubuntu-latest | ||
python-version: "3.6" | ||
|
||
# MacOS 14.4.1 for arm64 doesn't support Python < 3.8 | ||
- os: macos-latest | ||
python-version: "3.6" | ||
- os: macos-latest | ||
python-version: "3.7" | ||
|
||
include: | ||
# GHA doesn't list 3.6 for ubuntu-22 | ||
- os: ubuntu-20.04 | ||
python-version: "3.6" | ||
|
||
# MacOS 13 required for Python < 3.8 | ||
- os: macos-13 | ||
python-version: "3.6" | ||
- os: macos-13 | ||
python-version: "3.7" | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
shell: bash | ||
run: | | ||
python -m pip install -e . | ||
python -m pip install pytest | ||
- name: Cache data | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ env.HANLP_STATIC_ROOT }} | ||
key: hanlp-data | ||
|
||
- name: Test with pytest | ||
shell: bash | ||
run: | | ||
pytest tests | ||
deploy: | ||
needs: build | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install setuptools wheel twine | ||
- name: Deploy to PyPI | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
python -m twine upload dist/* | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | ||
TWINE_REPOSITORY: pypi |