modernize with pyugprade #1224
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: tests | |
on: [push, pull_request] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: "3.12" | |
- name: Install dependencies | |
run: | | |
pip install --upgrade pip | |
pip install . | |
pip install -r requirements.txt | |
- name: flake8 | |
run: flake8 dedupe tests benchmarks/benchmarks | |
- name: isort | |
if: always() | |
run: isort --check-only . | |
- name: black | |
if: always() | |
run: black . --check | |
- name: mypy | |
if: always() | |
run: mypy | |
test: | |
timeout-minutes: 40 | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, macos-latest, ubuntu-latest] | |
python-version: [3.8, 3.9, "3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
pip install --upgrade pip | |
pip install -e . | |
- name: Install test dependencies | |
run: pip install -r requirements.txt | |
- name: pytest | |
run: pytest | |
- name: Code Coverage | |
uses: codecov/codecov-action@v4 | |
env: | |
OS: ${{ matrix.os }} | |
PYTHON: '3.7' | |
with: | |
env_vars: OS,PYTHON | |
- name: Integration tests | |
# Do everything twice: The first time is training and generates settings, | |
# the second time it tests using a static settings file. | |
run: | | |
python -m pip install ./benchmarks | |
python benchmarks/benchmarks/canonical.py | |
python benchmarks/benchmarks/canonical.py | |
python benchmarks/benchmarks/canonical_matching.py | |
python benchmarks/benchmarks/canonical_matching.py | |
python benchmarks/benchmarks/canonical_gazetteer.py | |
python benchmarks/benchmarks/canonical_gazetteer.py | |
settings_file_persists: | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout main | |
uses: actions/checkout@v2 | |
with: | |
ref: main | |
- uses: actions/setup-python@v2 | |
- name: Install dependencies | |
run: | | |
pip install --upgrade pip | |
pip install . | |
python -m pip install ./benchmarks | |
- name: Run on canonical on main | |
run: python benchmarks/benchmarks/canonical.py | |
- name: checkout this PR branch | |
uses: actions/checkout@v2 | |
with: | |
clean: false | |
- name: Install any new dependencies | |
run: pip install . | |
- name: Run on canonical with setting file created on main | |
run: python benchmarks/benchmarks/canonical.py | |
wheels: | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | |
needs: [test, lint, settings_file_persists] | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-latest, macos-latest, ubuntu-latest] | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-python@v2 | |
- name: Build wheels | |
uses: pypa/cibuildwheel@v2.19.1 | |
env: | |
CIBW_ARCHS_MACOS: x86_64 arm64 universal2 | |
- name: Build sdist | |
run: | | |
pip install build | |
python -m build --sdist | |
- name: Publish wheels to PyPI | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
pip install twine | |
twine upload --skip-existing wheelhouse/*.whl | |
twine upload dist/* | |
continue-on-error: true |