|
| 1 | +name: Run tests with debug Python |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: [main] |
| 5 | + pull_request: |
| 6 | + |
| 7 | +jobs: |
| 8 | + test: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + env: |
| 11 | + PYTHON_VERSION: 3.14.6 |
| 12 | + steps: |
| 13 | + - name: Checkout |
| 14 | + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 |
| 15 | + |
| 16 | + - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 |
| 17 | + with: |
| 18 | + path: /opt/python-debug |
| 19 | + key: python-debug-${{ runner.os }}-${{ env.PYTHON_VERSION }} |
| 20 | + |
| 21 | + - name: Install build dependencies |
| 22 | + if: steps.cache.outputs.cache-hit != 'true' |
| 23 | + run: | |
| 24 | + sudo apt-get update |
| 25 | + sudo apt-get install -y build-essential libssl-dev zlib1g-dev \ |
| 26 | + libbz2-dev libreadline-dev libsqlite3-dev curl libncursesw5-dev \ |
| 27 | + xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev |
| 28 | +
|
| 29 | + - name: Build Python with Py_DEBUG |
| 30 | + if: steps.cache.outputs.cache-hit != 'true' |
| 31 | + run: | |
| 32 | + wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz |
| 33 | + tar -xzf Python-${PYTHON_VERSION}.tgz |
| 34 | + cd Python-${PYTHON_VERSION} |
| 35 | +
|
| 36 | + ./configure --with-pydebug --prefix=/opt/python-debug |
| 37 | + make -j4 |
| 38 | + sudo make install |
| 39 | +
|
| 40 | + - name: Create venv from debug Python |
| 41 | + run: | |
| 42 | + PYDBG_BIN="/opt/python-debug/bin/python3" |
| 43 | + "$PYDBG_BIN" -m venv .venv |
| 44 | + echo "$PWD/.venv/bin" >> "$GITHUB_PATH" |
| 45 | + echo "VIRTUAL_ENV=$PWD/.venv" >> "$GITHUB_ENV" |
| 46 | +
|
| 47 | + - name: Prepare |
| 48 | + run: | |
| 49 | + python -m pip install -r requirements.txt pytest |
| 50 | +
|
| 51 | + - name: Build |
| 52 | + run: | |
| 53 | + make cython |
| 54 | + pip install . |
| 55 | +
|
| 56 | + - name: Test (C extension) |
| 57 | + run: | |
| 58 | + pytest -v test |
| 59 | +
|
| 60 | + - name: Test (pure Python fallback) |
| 61 | + run: | |
| 62 | + MSGPACK_PUREPYTHON=1 pytest -v test |
0 commit comments