-
Notifications
You must be signed in to change notification settings - Fork 2
130 lines (118 loc) · 4.39 KB
/
python-package.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
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