-
Notifications
You must be signed in to change notification settings - Fork 79
144 lines (118 loc) · 3.75 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
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 flake 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/[email protected]
- 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-*"
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" >> $GITHUB_ENV
- name: Build & Test Wheels
uses: pypa/[email protected]
- 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 }}