fix:校正文档错误 #194
Workflow file for this run
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
name: Unit Tests | |
on: | |
push: | |
branches: [ "**" ] | |
pull_request: | |
branches: [ "**" ] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
env: | |
HANLP_HOME: ${{ github.workspace }}/data | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-20.04, macos-latest, windows-latest ] | |
python-version: [ 3.6, 3.7, 3.8, 3.9, '3.10' ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache dependencies | |
id: cache-pip | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.pythonLocation }} | |
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }} | |
- if: ${{ steps.cache-pip.outputs.cache-hit != 'true' }} | |
name: Install dependencies | |
run: | | |
python -m pip install -e plugins/hanlp_trie | |
python -m pip install -e plugins/hanlp_common | |
python -m pip install -e . | |
python -m pip install pytest | |
- name: Cache data | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.HANLP_HOME }} | |
key: hanlp-data | |
- name: Test with pytest | |
run: | | |
pytest tests | |
pytest plugins/hanlp_trie/tests | |
deploy: | |
needs: build | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- 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 |