mirror of
https://github.com/mii443/tokenizers.git
synced 2025-08-22 16:25:30 +00:00
* Upgrade pyo3 to 0.15 Rebase-conflicts-fixed-by: H. Vetinari <h.vetinari@gmx.com> * Upgrade pyo3 to 0.16 Rebase-conflicts-fixed-by: H. Vetinari <h.vetinari@gmx.com> * Install Python before running cargo clippy * Fix clippy warnings * Use `PyArray_Check` instead of downcasting to `PyArray1<u8>` * Enable `auto-initialize` of pyo3 to fix `cargo test --no-default-features` * Fix some test cases Why do they change? * Refactor and add SAFETY comments to `PyArrayUnicode` Replace deprecated `PyUnicode_FromUnicode` with `PyUnicode_FromKindAndData` Co-authored-by: messense <messense@icloud.com>
119 lines
3.0 KiB
YAML
119 lines
3.0 KiB
YAML
name: Python
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths-ignore:
|
|
- bindings/node/**
|
|
pull_request:
|
|
paths-ignore:
|
|
- bindings/node/**
|
|
|
|
jobs:
|
|
build_win_32:
|
|
name: Check it builds for Windows 32-bit
|
|
runs-on: windows-latest
|
|
strategy:
|
|
matrix:
|
|
python: ["3.7", "3.8", "3.9", "3.10"]
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v1
|
|
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable-i686-pc-windows-msvc
|
|
override: true
|
|
|
|
- name: Override toolchain
|
|
shell: bash
|
|
working-directory: ./bindings/python
|
|
run: echo "stable-i686-pc-windows-msvc" > rust-toolchain
|
|
|
|
|
|
- name: Install Python
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: ${{ matrix.python }}
|
|
architecture: x86
|
|
|
|
- name: Build
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: build
|
|
args: --manifest-path ./bindings/python/Cargo.toml
|
|
|
|
|
|
build_and_test:
|
|
name: Check everything builds & tests
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-18.04, macos-latest]
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v1
|
|
|
|
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
components: rustfmt, clippy
|
|
|
|
- name: Install Python
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: 3.9
|
|
architecture: "x64"
|
|
|
|
|
|
- name: Cache Cargo Registry
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: ~/.cargo/registry
|
|
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
# - name: Cache Cargo Build Target
|
|
# uses: actions/cache@v1
|
|
# with:
|
|
# path: ./bindings/python/target
|
|
# key: ${{ runner.os }}-cargo-python-build-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
- name: Lint with RustFmt
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
toolchain: stable
|
|
command: fmt
|
|
args: --manifest-path ./bindings/python/Cargo.toml -- --check
|
|
|
|
- name: Lint with Clippy
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: clippy
|
|
args: --manifest-path ./bindings/python/Cargo.toml --all-targets --all-features -- -D warnings
|
|
|
|
- name: Install
|
|
working-directory: ./bindings/python
|
|
run: |
|
|
python -m venv .env
|
|
source .env/bin/activate
|
|
pip install -U pip
|
|
pip install pytest requests setuptools_rust numpy pyarrow datasets
|
|
python setup.py develop
|
|
|
|
- name: Check style
|
|
working-directory: ./bindings/python
|
|
run: |
|
|
source .env/bin/activate
|
|
pip install black==20.8b1 click==8.0.4
|
|
make check-style
|
|
|
|
- name: Run tests
|
|
working-directory: ./bindings/python
|
|
run: |
|
|
source .env/bin/activate
|
|
make test
|