tests for data_loading and part of loss_and_minimizer #112
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: CI | |
on: | |
push: | |
pull_request: | |
jobs: | |
python: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.13", "3.12", "3.11", "3.10", "3.9", "3.8"] | |
os: [ubuntu-latest, macos-13, macos-14] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install | |
run: | | |
pip install . | |
- name: Test with pytest | |
run: | | |
pip install pytest | |
pytest -v | |
- name: Pylint | |
run: | | |
pip install --upgrade pylint | |
pylint -E MDRefine | |
- name: Flake8 | |
run: | | |
pip install --upgrade flake8 | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 MDRefine bin --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | tee flake8_report.txt | |
- name: Upload flake8_report.txt to artifact | |
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
path: flake8_report.txt | |
name: flake8_report | |
- name: Doc | |
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' }} | |
run: | | |
pip install --upgrade pdoc3 jupyter nbconvert | |
pdoc3 -f --html -o doc/ MDRefine | |
( cd Examples && ./render.sh ) | |
mkdir doc/examples | |
cp Examples/*html doc/examples/ | |
( sudo apt-get install tree && cd doc/examples && tree -H '.' -L 1 --noreport --charset utf-8 > index.html ) | |
( sudo apt-get install pandoc texlive-xetex && pdoc3 -f --pdf MDRefine > MDRefine.md && pandoc --metadata=title:"MDRefine Documentation" --from=markdown+abbreviations+tex_math_single_backslash --pdf-engine=xelatex --toc --toc-depth=4 --output=doc/MDRefine.pdf MDRefine.md ) | |
- name: Upload doc to artifact | |
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
path: doc | |
name: doc | |
- name: Push doc to GitHub Pages | |
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' && github.ref == 'refs/heads/master' }} | |
env: | |
MDREFINE_DOC: ${{ secrets.MDREFINE_DOC }} | |
run: | | |
.ci/pushdoc | |
- name: Deploy PyPI | |
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' && startsWith(github.ref, 'refs/tags/') }} | |
env: | |
MDREFINE_PYPI: ${{ secrets.MDREFINE_PYPI }} | |
run: | | |
pip install twine setuptools | |
python setup.py sdist | |
python -m twine upload -u __token__ -p "$MDREFINE_PYPI" dist/*.tar.gz | |
conda: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-13, macos-14] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install conda | |
run: | | |
curl -LO https://raw.githubusercontent.com/GiovanniBussi/conda-ci/master/conda-ci | |
source ./conda-ci install | |
source ./conda-ci install-conda-build | |
- name: Build | |
run: | | |
source activate base | |
python make_conda_recipe.py | |
export CPU_COUNT=2 | |
conda-build -c conda-forge conda | |
rm -fr MDRefine # make sure this is not imported by mistake in tests | |
- name: Test 3.12 | |
run: | | |
source activate base | |
conda create -n py312 -c conda-forge -c local python=3.12 MDRefine pytest | |
source activate py312 | |
pytest -v | |
- name: Test 3.11 | |
run: | | |
source activate base | |
conda create -n py311 -c conda-forge -c local python=3.11 MDRefine pytest | |
source activate py311 | |
pytest -v | |
- name: Test 3.10 | |
run: | | |
source activate base | |
conda create -n py310 -c conda-forge -c local python=3.10 MDRefine pytest | |
source activate py310 | |
pytest -v | |
- name: Deploy conda | |
if: ${{ matrix.os == 'ubuntu-latest' && startsWith(github.ref, 'refs/tags/') }} | |
#env: | |
# CONDA_UPLOAD_TOKEN: ${{ secrets.CONDA_UPLOAD_TOKEN }} | |
run: | | |
#TODO | |
#source activate base | |
#anaconda -t $CONDA_UPLOAD_TOKEN upload -u bussilab -l main $CONDA_PREFIX/conda-bld/*/py-bussilab*.tar.bz2 --force | |