Files
pydantic/.github/workflows/ci.yml
T
dependabot[bot] bf5fdfc618 build(deps): bump black from 21.12b0 to 22.3.0 (#3950)
* build(deps): bump black from 21.12b0 to 22.3.0

Bumps [black](https://github.com/psf/black) from 21.12b0 to 22.3.0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](https://github.com/psf/black/commits/22.3.0)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* apply new black styles, fix docs

* try upgrading pip before fastapi tests

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
2022-04-02 08:35:55 +01:00

391 lines
9.1 KiB
YAML

name: CI
on:
push:
branches:
- master
tags:
- '**'
pull_request: {}
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up python
uses: actions/setup-python@v3
with:
python-version: 3.9
- name: install
run: |
make install-linting
pip freeze
- name: lint
run: make lint
- name: mypy
run: make mypy
- name: make history
run: python3 ./changes/make_history.py
- name: check dist
run: make check-dist
docs-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up python
uses: actions/setup-python@v3
with:
python-version: 3.8
- name: install
run: make install-docs
- name: build site
run: make docs
- name: Store docs site
uses: actions/upload-artifact@v2
with:
name: docs
path: site
test-linux:
name: test py${{ matrix.python-version }} on linux
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
env:
PYTHON: ${{ matrix.python-version }}
OS: ubuntu
steps:
- uses: actions/checkout@v3
- name: set up python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: install
run: |
make install-testing
pip freeze
- name: compile
run: |
make build-trace
python -c "import sys, pydantic; print('compiled:', pydantic.compiled); sys.exit(0 if pydantic.compiled else 1)"
ls -alh
ls -alh pydantic/
- run: mkdir coverage
- name: test compiled and deps
run: make test
env:
COVERAGE_FILE: coverage/.coverage.linux-py${{ matrix.python-version }}-cY-dY
CONTEXT: linux-py${{ matrix.python-version }}-compiled-yes-deps-yes
- name: uninstall deps
run: pip uninstall -y cython email-validator devtools python-dotenv
- name: test compiled without deps
run: make test
env:
COVERAGE_FILE: coverage/.coverage.linux-py${{ matrix.python-version }}-cY-dN
CONTEXT: linux-py${{ matrix.python-version }}-compiled-yes-deps-no
- name: remove compiled binaries
run: |
rm -r pydantic/*.so pydantic/*.c pydantic/__pycache__
ls -alh
ls -alh pydantic/
- name: test uncompiled without deps
run: make test
env:
COVERAGE_FILE: coverage/.coverage.linux-py${{ matrix.python-version }}-cN-dN
CONTEXT: linux-py${{ matrix.python-version }}-compiled-no-deps-no
- name: store coverage files
uses: actions/upload-artifact@v2
with:
name: coverage
path: coverage
test-windows-mac:
name: test py${{ matrix.python-version }} on ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos, windows]
python-version: ['3.7', '3.8', '3.9', '3.10']
env:
PYTHON: ${{ matrix.python-version }}
OS: ${{ matrix.os }}
COMPILED: no
DEPS: yes
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v3
- name: set up python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: install
run: make install-testing
- run: mkdir coverage
- name: test
run: make test
env:
COVERAGE_FILE: coverage/.coverage.${{ matrix.os }}-py${{ matrix.python-version }}
CONTEXT: ${{ matrix.os }}-py${{ matrix.python-version }}
- name: store coverage files
uses: actions/upload-artifact@v2
with:
name: coverage
path: coverage
test-old-mypy:
name: test mypy v${{ matrix.mypy-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
mypy-version: ['0.910', '0.920', '0.921']
steps:
- uses: actions/checkout@v3
- name: set up python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: install
run: |
make install-testing
pip freeze
- name: uninstall deps
run: pip uninstall -y mypy tomli toml
- name: install specific mypy version
run: pip install mypy==${{ matrix.mypy-version }}
- run: mkdir coverage
- name: run tests
run: pytest --cov=pydantic tests/mypy
env:
COVERAGE_FILE: coverage/.coverage.linux-py3.10-mypy${{ matrix.mypy-version }}
CONTEXT: linux-py3.10-mypy${{ matrix.mypy-version }}
- name: store coverage files
uses: actions/upload-artifact@v2
with:
name: coverage
path: coverage
coverage-combine:
needs: [test-linux, test-windows-mac, test-old-mypy]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
with:
python-version: '3.8'
- name: get coverage files
uses: actions/download-artifact@v2
with:
name: coverage
path: coverage
- run: pip install coverage
- run: ls -la
- run: coverage combine coverage
- run: coverage report
- run: coverage html --show-contexts
- name: Store coverage html
uses: actions/upload-artifact@v2
with:
name: coverage-html
path: htmlcov
test-fastapi:
name: test fastAPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- name: upgrade pip
run: pip install -U pip setuptools wheel
- name: install
run: make install-testing
- name: test
run: make test-fastapi
benchmark:
name: run benchmarks
runs-on: ubuntu-latest
env:
BENCHMARK_REPEATS: 1
steps:
- uses: actions/checkout@v3
- name: set up python
uses: actions/setup-python@v3
with:
python-version: '3.8'
- name: install and build
run: |
make build
make install-benchmarks
- run: make benchmark-pydantic
- run: make benchmark-all
- run: make benchmark-json
build:
name: build py3.${{ matrix.python-version }} on ${{ matrix.platform || matrix.os }}
needs: [lint, test-linux, test-windows-mac, test-old-mypy, test-fastapi, benchmark]
if: "success() && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master')"
strategy:
fail-fast: false
matrix:
os: [ubuntu , macos , windows]
python-version: ['7', '8', '9', '10']
include:
- os: ubuntu
platform: linux
- os: windows
ls: dir
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v3
- name: set up python
uses: actions/setup-python@v3
with:
python-version: '3.8'
- name: install
run: pip install -U twine setuptools wheel cibuildwheel
- name: build sdist
if: matrix.os == 'ubuntu' && matrix.python-version == '9'
run: python setup.py sdist bdist_wheel
env:
SKIP_CYTHON: 1
- name: build ${{ matrix.platform || matrix.os }} binaries
run: cibuildwheel --output-dir dist
env:
PIP: 'pip'
CIBW_BUILD: 'cp3${{ matrix.python-version }}-*'
CIBW_SKIP: '*-win32'
CIBW_PLATFORM: '${{ matrix.platform || matrix.os }}'
CIBW_BEFORE_BUILD: 'pip install -U cython'
CIBW_TEST_REQUIRES: 'pytest==6.2.5 pytest-mock==3.6.1'
CIBW_TEST_COMMAND: 'pytest {project}/tests'
CIBW_MANYLINUX_X86_64_IMAGE: 'manylinux2014'
CIBW_MANYLINUX_I686_IMAGE: 'manylinux2014'
CIBW_ARCHS_MACOS: 'x86_64 arm64'
CIBW_TEST_SKIP: '*-macosx_arm64' # see https://cibuildwheel.readthedocs.io/en/stable/faq/#universal2
# TODO build windows 32bit binaries
- name: list dist files
run: |
${{ matrix.ls || 'ls -lh' }} dist/
twine check dist/*
- name: Store dist artifacts
uses: actions/upload-artifact@v2
with:
name: pypi_files
path: dist
deploy:
name: Deploy
needs: build
if: "success() && startsWith(github.ref, 'refs/tags/')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: set up python
uses: actions/setup-python@v3
with:
python-version: '3.8'
- name: get dist artifacts
uses: actions/download-artifact@v2
with:
name: pypi_files
path: dist
- name: get docs
uses: actions/download-artifact@v2
with:
name: docs
path: site
- name: install
run: |
make install-docs
pip install -U twine
- name: twine check
run: |
twine check dist/*
ls -lh dist
- name: check tag
run: ./tests/check_tag.py
- name: upload to pypi
run: twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_token }}
- name: publish docs
run: make publish-docs
env:
NETLIFY: ${{ secrets.netlify_token }}