flip build order so that main build is first #30
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.12", "3.11", "3.10", "3.9"] | |
os: [ubuntu-latest, macos-12, 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: Pyflakes | |
run: | | |
pip install --upgrade pyflakes | |
pyflakes MDRefine | |
- 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@v3 | |
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 ) | |
tar czf doc.tgz doc/ | |
- name: Upload doc to artifact | |
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12' }} | |
uses: actions/upload-artifact@v3 | |
with: | |
path: doc.tgz | |
name: doc | |
- 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 | |
python setup.py sdist | |
python -m twine upload -u __token__ -p "$MDREFINE_PYPI" dist/MDRefine-*.tar.gz | |
conda: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-12, 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.9 | |
run: | | |
source activate base | |
conda create -n py39 -c conda-forge -c local python=3.9 MDRefine pytest | |
source activate py39 | |
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: 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.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: 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 | |