Fix module init for Python 3.12 #773
Workflow file for this run
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: 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@v2 | |
- name: Install Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: "3.10" | |
- name: Build msgspec and install dependencies | |
run: | | |
pip install coverage -e ".[test]" | |
- name: Run pre-commit hooks | |
uses: pre-commit/action@v3.0.0 | |
- name: mypy | |
run: pytest tests/test_mypy.py | |
- name: pyright | |
run: pytest tests/test_pyright.py | |
- 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-20.04, macos-11, windows-2019] | |
env: | |
CIBW_TEST_REQUIRES: "pytest msgpack pyyaml tomli tomli_w" | |
CIBW_TEST_COMMAND: "pytest {project}/tests" | |
CIBW_BUILD: "cp38-* cp39-* cp310-* cp311-* cp312-*" | |
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@v2 | |
- 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_* cp38-*_aarch64 cp39-*_aarch64 cp311-*_aarch64 cp312-*_aarch64" >> $GITHUB_ENV | |
- name: Build & Test Wheels | |
uses: pypa/cibuildwheel@v2.16.1 | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
if: github.event_name == 'release' && github.event.action == 'published' | |
with: | |
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@v2 | |
- name: Install Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Build source distribution | |
run: python setup.py sdist | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
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@v2 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@master | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |