Skip to content

Use PEP 757 C-API to import/export ints #630

Use PEP 757 C-API to import/export ints

Use PEP 757 C-API to import/export ints #630

name: pip_install_gmpy2
on: [push, pull_request]
jobs:
osx:
strategy:
fail-fast: false
matrix:
python-version: [3.11, 3.12, 3.13]
os: [macos-12]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- run: pip install --upgrade pip
- run: pip --verbose install --editable .[tests]
- run: pytest test/
- run: PYTHONPATH=`pwd`/gmpy2 python test_cython/runtests.py
if: ${{ matrix.python-version != '3.13' }}
linux:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.11]
os: [ubuntu-22.04]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Libs
run: |
sudo apt-get update
sudo apt-get install libmpc-dev texlive texlive-latex-extra latexmk lcov
- name: Install dependencies
run: |
pip install --upgrade pip
pip --verbose install --editable .[docs,tests]
- name: Tests
run: |
pytest test/
PYTHONPATH=`pwd`/gmpy2 python test_cython/runtests.py
- name: Building docs
if: matrix.python-version == 3.11
run: |
sphinx-build --color -W --keep-going -b doctest docs build/sphinx/doctest
sphinx-build --color -W --keep-going -b html docs build/sphinx/html
sphinx-build --color -W --keep-going -b latex docs build/sphinx/latex
make -C build/sphinx/latex all-pdf
# XXX: why this doesn't work with pip install --editable above?
- name: Run coverage tests
run: |
pip uninstall -y gmpy2
python setup.py clean
CFLAGS="-coverage" python setup.py develop
pytest test/
PYTHONPATH=`pwd`/gmpy2 python test_cython/runtests.py
lcov --capture --directory . --no-external --output-file build/coverage.info
genhtml build/coverage.info --output-directory build/coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
gcov: true
gcov_include: src/*.c
gcov_args: --no-external
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
- name: Archive build artifacts
uses: actions/upload-artifact@v4
if: matrix.python-version == 3.11
with:
path: |
build/sphinx/doctest/
build/sphinx/html/
build/sphinx/latex/gmpy2.pdf
build/coverage/
windows:
strategy:
fail-fast: false
matrix:
os: [windows-2022]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: msys2 {0}
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
name: Setup msys2
with:
update: true
install: >-
gcc
gmp-devel
mpfr-devel
mpc-devel
python-setuptools
python-pip
- name: Build and run tests in venv
run: |
python -m venv .test-venv
source .test-venv/bin/activate
pip install --upgrade pip
pip --verbose install -e .[tests]
pytest test/
PYTHONPATH=`pwd`/gmpy2 python test_cython/runtests.py