Skip to content

Misc fixes

Misc fixes #4061

Workflow file for this run

name: test
on:
push:
pull_request:
schedule:
- cron: '0 0 * * 2'
jobs:
test:
permissions:
contents: write
strategy:
matrix:
python-version: ['3.11', '3.12']
coverage: [false]
include:
- python-version: '3.11'
coverage: true
runs-on: ubuntu-latest
env:
TERM: xterm
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
- name: Install libs
run: |
sudo apt update
sudo apt install graphviz texlive-xetex texlive-fonts-recommended \
fonts-freefont-otf latexmk lmodern
sudo apt install libatlas-base-dev liblapack-dev gfortran
- name: Install dependencies
run: |
pip install -U pip setuptools wheel
pip install -U .[interactive,develop,gmpy,exports,docs]
- name: Install ~/.python_history
run: touch ~/.python_history
- name: Linting with flake8 and pylint
if: ${{ ! github.event_name.schedule }}
run: |
flake518
pylint diofant
- name: Run type checks with mypy
run: mypy diofant
- name: Tests
if: matrix.coverage == false
env:
PYTEST_ADDOPTS: --doctest-modules --color yes
run: pytest
- name: Coverage tests
if: matrix.coverage
env:
PYTEST_ADDOPTS: --color yes --cov diofant --cov-append -m "not slow and not xfail and not regression" --ignore docs
run: |
pytest
pip uninstall -y gmpy2 numpy IPython
DIOFANT_GROUND_TYPES='gmpy' pytest diofant/tests/domains
pytest diofant/tests/polys
pytest diofant/tests/external diofant/tests/utilities
pytest diofant/tests/test_cli.py
coverage html
coverage xml
- name: Upload coverage data
if: matrix.coverage
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
- name: Get version
id: release
run: |
export VERSION=$(python -c 'import diofant;print(diofant.__version__)')
echo ::set-output name=version::${VERSION}
echo ::set-output name=short_version::$(echo ${VERSION}|sed 's/\([0-9]\+\.[0-9]\+\).*$/\1/')
- name: Building docs
run: |
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
- name: Prepare update for docs on Github Pages
run: |
wget -q https://github.com/diofant/diofant.github.io/archive/master.zip
unzip -x master.zip
rsync -a --delete build/sphinx/html/ diofant.github.io-master/en/latest/
- name: Make packages
run: python -m build
- name: Archive production artifacts
uses: actions/upload-artifact@v4
if: matrix.coverage
with:
path: |
dist/
build/sphinx/html/
build/sphinx/latex/Diofant-*.pdf
coverage.xml
build/coverage/html/
- name: Upload docs to Github Pages
if: github.event_name == 'push' && matrix.coverage
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
external_repository: diofant/diofant.github.io
publish_branch: master
publish_dir: diofant.github.io-master
- name: Publish on Github Releases
uses: softprops/action-gh-release@v1
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && matrix.coverage
with:
files: |
dist/*
build/sphinx/latex/Diofant-*.pdf
draft: true
prerelease: true
name: "Diofant ${{ steps.release.outputs.version }}"
body: "See [release notes](https://diofant.readthedocs.io/\
en/latest/release/notes-${{ steps.release.outputs.short_version }}.html)."
token: ${{ secrets.RELEASES_DEPLOY_KEY }}
- name: Publish package on PyPI
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && matrix.coverage
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}