Skip to content

Commit

Permalink
Test on other OSs, remove CI benchmarks (pydantic#366)
Browse files Browse the repository at this point in the history
* Test on other OSes, remove benchmarks

* fix pytest-speed for 3.7

* remove windows xfail, revert pyproject changes

* uprev pytest, pytest-pretty

* add print to windows

* more eprints

* remove test-os py cache

* remove extra prints

* revert xfail

* remove pytest-speed on codspeed ci

* install ptyest-benchmark with codspeed

* clear codspeed cache
  • Loading branch information
samuelcolvin committed Jan 22, 2023
1 parent 8f42a9a commit 57109a8
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 77 deletions.
66 changes: 0 additions & 66 deletions .github/workflows/benchmarks.yml

This file was deleted.

43 changes: 39 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
- '**'
pull_request: {}

env:
COLUMNS: 120

jobs:
test-cpython:
name: test ${{ matrix.python-version }} rust ${{ matrix.rust-toolchain }}
Expand Down Expand Up @@ -152,6 +155,38 @@ jobs:

- run: pytest

test-os:
name: test on ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]

runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v3

- name: cache rust
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}-v1

- name: set up python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- run: pip install -r tests/requirements.txt

- run: pip install -e .
env:
RUST_BACKTRACE: 1

- run: pip freeze

- run: pytest

lint:
runs-on: ubuntu-latest

Expand Down Expand Up @@ -202,7 +237,7 @@ jobs:
- run: npm run lint

bench:
# run the rust benchmarks
name: rust benchmarks
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -271,7 +306,7 @@ jobs:
# https://github.com/marketplace/actions/alls-green#why used for branch protection checks
check:
if: always()
needs: [test-cpython, test-pypy, lint, bench, build-wasm-emscripten]
needs: [test-cpython, test-pypy, test-os, lint, bench, build-wasm-emscripten]
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
Expand Down Expand Up @@ -374,7 +409,7 @@ jobs:

- run: ${{ matrix.ls || 'ls -lh' }} dist/

- run: twine check dist/*
- run: twine check --strict dist/*

- uses: actions/upload-artifact@v3
with:
Expand Down Expand Up @@ -521,7 +556,7 @@ jobs:
name: pypi_files
path: dist

- run: twine check dist/*
- run: twine check --strict dist/*

- name: upload to pypi
run: twine upload dist/*
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,22 @@ jobs:
with:
path: ${{ env.pythonLocation }}
key: >
py
py-v2
${{ env.pythonLocation }}
${{ hashFiles('tests/requirements.txt') }}
${{ hashFiles('pyproject.toml') }}
- run: pip install -r tests/requirements.txt
if: steps.cache-py.outputs.cache-hit != 'true'

- run: pip install pytest-codspeed~=1.2.0
- run: pip uninstall pytest-speed -y
if: steps.cache-py.outputs.cache-hit != 'true'

- run: pip install pytest-codspeed~=1.2.0 pytest-benchmark==4.0.0
if: steps.cache-py.outputs.cache-hit != 'true'

- run: rm rust-toolchain

- name: install rust stable
uses: dtolnay/rust-toolchain@stable

Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ except ValidationError as e:
Pydantic-core is currently around 17x faster than pydantic standard.
See [`tests/benchmarks/`](./tests/benchmarks/) for details.

Benchmarks overtime can be seen [here](https://pydantic.github.io/pydantic-core/dev/bench/).

This relative performance will be less impressive for small models but could be significantly move impressive
for deeply nested models.

Expand Down
6 changes: 3 additions & 3 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
coverage==7.0.5
dirty-equals==0.5.0
hypothesis==6.63.0
pytest==7.1.2
pytest-benchmark==4.0.0
pytest==7.2.1
pytest-speed==0.3.5
pytest-mock==3.10.0
pytest-pretty==0.0.1
pytest-pretty==1.0.1
pytest-timeout==2.1.0
pydantic==1.10.4;python_version>="3.8"
pytz==2022.7.1

0 comments on commit 57109a8

Please sign in to comment.