-
Notifications
You must be signed in to change notification settings - Fork 61
214 lines (212 loc) · 6.99 KB
/
ci.yaml
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
name: ci
on: [push, pull_request]
jobs:
examples:
runs-on: ubuntu-20.04
strategy:
fail-fast: False
matrix:
python-version:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get install libpython2.7 # required by paup
python -m pip install --upgrade pip
- name: Install paup
run: |
temp_dir=$(mktemp -d)
wget -P ${temp_dir} http://phylosolutions.com/paup-test/paup4a168_ubuntu64.gz
gunzip ${temp_dir}/paup4a168_ubuntu64.gz
chmod +x ${temp_dir}/paup4a168_ubuntu64
sudo mv ${temp_dir}/paup4a168_ubuntu64 /usr/local/bin/paup
echo "export DENDROPY_PAUP_EXECUTABLE_PATH=/usr/local/bin/paup" >> "${GITHUB_ENV}"
- name: Install dendropy
run: |
python -m pip install .
- name: Run examples
run: |
cd docs/source/examples
# only allow known failures
# and enforce removal of working examples from known failures
for f in *.py; do
echo "${f}"
if timeout 60 python "${f}" && ! grep -q "${f}" backlogged-fail-whitelist.txt; then
:
elif grep -q "${f}" backlogged-fail-whitelist.txt; then
:
else
echo FAIL "${f}"
exit 1
fi
done
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff==0.0.292
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with ruff
run: |
# stop the build if there are Python syntax errors or undefined names
./lint.sh
tests:
runs-on: ubuntu-20.04
strategy:
fail-fast: False
matrix:
python-version:
- "2.7"
- "3.5"
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
continue-on-error: true
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install python2 libpython2.7 # required by paup
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install paup
run: |
temp_dir=$(mktemp -d)
wget -P ${temp_dir} http://phylosolutions.com/paup-test/paup4a168_ubuntu64.gz
gunzip ${temp_dir}/paup4a168_ubuntu64.gz
chmod +x ${temp_dir}/paup4a168_ubuntu64
sudo mv ${temp_dir}/paup4a168_ubuntu64 /usr/local/bin/paup
echo "export DENDROPY_PAUP_EXECUTABLE_PATH=/usr/local/bin/paup" >> "${GITHUB_ENV}"
- name: Python2 compatibility workaround # TODO remove when Python2 compatibility dropped
if: matrix.python-version == '2.7'
run: |
rm tests/dendropy
curl --silent --show-error --retry 5 https://bootstrap.pypa.io/pip/2.7/get-pip.py | sudo python2
python2 -m pip install setuptools --upgrade
python2 setup.py test
- name: Test with setup.py
if: matrix.python-version != '2.7'
run: |
python setup.py test
coverage:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
- name: Setup Python
uses: actions/setup-python@master
with:
python-version: 3.8
- name: Install paup
run: |
sudo apt-get install libpython2.7 # required by paup
temp_dir=$(mktemp -d)
wget -P ${temp_dir} http://phylosolutions.com/paup-test/paup4a168_ubuntu64.gz
gunzip ${temp_dir}/paup4a168_ubuntu64.gz
chmod +x ${temp_dir}/paup4a168_ubuntu64
sudo mv ${temp_dir}/paup4a168_ubuntu64 /usr/local/bin/paup
echo "export DENDROPY_PAUP_EXECUTABLE_PATH=/usr/local/bin/paup" >> "${GITHUB_ENV}"
- name: Install coverage dependencies
run: |
python3 -m pip install pytest
python3 -m pip install pytest-cov
- name: Generate coverage report
run: |
python3 -m pytest tests --cov=tests/dendropy --cov-report=xml
- uses: codecov/codecov-action@v3
with:
flags: unittests # optional
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
packaging-bdist:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install build tools
run: python3 -m pip install pip setuptools wheel --upgrade
- name: Build bdist
run: |
python3 setup.py bdist_wheel
tree dist
- name: Upgrade pip
run: python3 -m pip install pip --upgrade
- name: Install from bdist
run: python3 -m pip install dist/*.whl
- name: Test install
run: |
find . -type f -name '*.py' -exec rm {} \;
python3 -c "import dendropy; print(dendropy.__version__)"
packaging-sdist:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install build tools
run: python3 -m pip install pip setuptools wheel --upgrade
- name: Build sdist
run: |
python3 setup.py sdist
tree dist
- name: Install from sdist
run: python3 -m pip install dist/*.tar.gz
- name: Test install
run: |
find . -type f -name '*.py' -exec rm {} \;
python3 -c "import dendropy; print(dendropy.__version__)"
packaging-source:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Upgrade pip
run: python3 -m pip install pip --upgrade
- name: Install from source
run: python3 -m pip install .
- name: Test install
run: |
find . -type f -name '*.py' -exec rm {} \;
python3 -c "import dendropy; print(dendropy.__version__)"
deploy:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs:
- examples
- lint
- tests
steps:
- uses: actions/checkout@v1
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- run: python setup.py sdist bdist_wheel
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}