Skip to content

Don't fail when parsing types with invalid __parameters__ #932

Don't fail when parsing types with invalid __parameters__

Don't fail when parsing types with invalid __parameters__ #932

Workflow file for this run

name: Build and Test
on:
push:
branches: [main]
pull_request:
branches: [main]
paths-ignore:
- "docs/**"
- "benchmarks/**"
- "examples/**"
- ".github/**"
- "README.rst"
release:
types: [published]
jobs:
lint:
name: Lint and ruff code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Build msgspec and install dependencies
run: |
pip install coverage -e ".[test]"
- name: Run pre-commit hooks
uses: pre-commit/[email protected]
- name: mypy
run: pytest tests/test_mypy.py
- name: pyright
run: pytest tests/test_pyright.py
- name: doctests
run: pytest --doctest-modules msgspec
- name: Rebuild with sanitizers & coverage
env:
MSGSPEC_SANITIZE: "true"
MSGSPEC_COVERAGE: "true"
run: |
python setup.py clean --all
# I know this is deprecated, but I can't find a way to keep the build
# directory around anymore on new versions of setuptools
python setup.py develop
- name: Run tests with sanitizers
env:
PYTHONMALLOC: "malloc"
ASAN_OPTIONS: "detect_leaks=0"
run: |
LD_PRELOAD=`gcc -print-file-name=libasan.so` coverage run -m pytest -s -m "not mypy and not pyright"
- name: Generate coverage files
run: |
coverage xml
gcov -abcu `find build/ -name *.o`
- name: Upload Codecov
uses: codecov/codecov-action@v3
with:
files: coverage.xml,_core.c.gcov,atof.h.gcov,ryu.h.gcov
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-13, windows-latest]
env:
CIBW_TEST_REQUIRES: "pytest msgpack pyyaml tomli tomli_w"
CIBW_TEST_COMMAND: "pytest {project}/tests"
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-*"
CIBW_SKIP: "*-win32 *_i686 *_s390x *_ppc64le"
CIBW_ARCHS_MACOS: "x86_64 arm64"
CIBW_ARCHS_LINUX: "x86_64 aarch64"
CIBW_TEST_SKIP: "*_arm64 *-musllinux_*"
CIBW_ENVIRONMENT: "CFLAGS=-g0"
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Set up Environment
if: github.event_name != 'release'
run: |
echo "CIBW_SKIP=${CIBW_SKIP} *-musllinux_* cp39-*_aarch64 cp311-*_aarch64 cp312-*_aarch64 cp313-*_aarch64" >> $GITHUB_ENV
- name: Build & Test Wheels
uses: pypa/[email protected]
- name: Upload artifact
uses: actions/upload-artifact@v4
if: github.event_name == 'release' && github.event.action == 'published'
with:
name: artifact-wheels
path: ./wheelhouse/*.whl
build_sdist:
name: Build Source Distribution
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Build source distribution
run: python setup.py sdist
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: artifact-sdist
path: dist/*.tar.gz
upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v4
with:
merge-multiple: true
path: dist
pattern: artifact-*
- uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}