-
Notifications
You must be signed in to change notification settings - Fork 6
207 lines (201 loc) · 7.72 KB
/
python_package.yml
File metadata and controls
207 lines (201 loc) · 7.72 KB
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ./
strategy:
matrix:
os: [ubuntu-latest, windows-2019]
python-version: [3.8, 3.9, '3.10']
numpy-version: [1.21, 1.22]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
# Set fetch-depth to 0 so all history is retrieved; this is needed so we get the git tags
# which we use for setting the package version (via setuptools-scm).
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
# NOTE: For numpy 1.22, there was a regression in ufunc handling in numpy 1.22.0. It was fixed in 1.22.3,
# so let `pip` install the latest revision of each minor version being tested. This is also closer to
# the behavior of the conda-based builds.
run: |
python -m pip install --upgrade pip
python -m pip install setuptools-scm wheel
python -m pip install numpy==${{ matrix.numpy-version }}.*
- name: Build with python setup.py
run: |
python setup.py build --force
- name: Package wheel
if: ${{ matrix.os == 'windows-2019' }}
run: |
python setup.py bdist_wheel
- name: Package sources
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
python setup.py sdist
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: build-artifacts
path: dist/
if-no-files-found: error
#
# Test with riptable (using existing env for better performance)
#
- name: Install built riptide_cpp
# This depends on the riptide_cpp in dist being "newer" than on PyPI (which should be true),
# but also allows finding all the dependencies using regular lookup.
# The alternative would be to use "pip install --find-links --no-deps", then install all dependencies,
# as there doesn't appear to be a "pip install --only-deps" option.
# Could also use the "pip install -e" (editable installs) method to link to pre-build tree, but
# that doesn't exercise the ability to install.
run: |
pip install riptide_cpp --upgrade --find-links ./dist
- name: Install riptable
run: |
pip install riptable
- name: Install other dependencies
run: |
pip install ansi2html ipython ipykernel python-dateutil
pip install flake8 pytest hypothesis nose bottleneck pandas
- name: Riptable test with pytest
#this doesn't exit with error failure: TODO: fix riptable.tests.run() to do so!
#run: |
# python -m riptable.tests.run
run: |
python -c "import os,sys,pytest,riptable.tests;sys.exit(pytest.main(['-k','test_',os.path.dirname(riptable.tests.__file__)]))"
#- name: Riptable tooling integration tests
# run: |
# ipython -m pytest riptable/test_tooling_integration
# disable hypothesis tests until they run faster, are more consistent, and are easier to investigate
#- name: Riptable property based hypothesis tests
# run: |
# pytest --hypothesis-show-statistics -k test_ -m 'not xfail' riptable/hypothesis_tests
deploy:
# deploys build artifacts to PyPI
if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master' }}
needs: [build, conda_build]
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install setuptools wheel twine
- name: Download build artifacts
uses: actions/download-artifact@v2
with:
name: build-artifacts
path: dist/
- name: Publish artifacts to PyPI
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
set -ex
twine upload dist/* --verbose
conda_build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ['ubuntu-latest', 'windows-2019']
# matrix of aggregates works but is undocumented: https://stackoverflow.com/a/68940067
zips: [
{ python: '3.8', numpy: '1.20' },
{ python: '3.8', numpy: '1.21' },
{ python: '3.8', numpy: '1.22' },
{ python: '3.9', numpy: '1.20' },
{ python: '3.9', numpy: '1.21' },
{ python: '3.9', numpy: '1.22' },
{ python: '3.10', numpy: '1.21' },
{ python: '3.10', numpy: '1.22' }
]
env:
python_version: 3.9
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
- name: Setup Miniconda
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: "conda_build"
python-version: ${{ env.python_version }}
auto-update-conda: true
channels: conda-forge
channel-priority: flexible
show-channel-urls: true
- name: Install dependencies
shell: bash -l {0}
run: |
conda install conda-build setuptools_scm -q -y
- name: Build package
shell: bash -l {0}
run: |
set -ex
export BUILD_VERSION=$(python -c "from setuptools_scm import get_version; print(get_version(version_scheme='post-release'))")
export RIPTIDE_BUILD_VIA_CONDA="TRUE"
mkdir conda_pkgs_output
echo "python: " ${{ matrix.zips.python }} > ./conda_zips.yaml
echo "numpy: " ${{ matrix.zips.numpy }} >> ./conda_zips.yaml
conda build conda_recipe --output-folder ./conda_pkgs_output --variant-config-files ./conda_zips.yaml
- name: Publish artifacts
uses: actions/upload-artifact@v2
with:
name: conda-build-artifacts
path: conda_pkgs_output/*/riptide_cpp-*.tar.bz2
if-no-files-found: "error"
conda_deploy:
if: ${{ github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master' }}
needs: [build, conda_build]
runs-on: ubuntu-latest
env:
ANACONDA_USER: rtosholdings
ANACONDA_TOKEN: ${{ secrets.anaconda_token }}
steps:
- name: Setup Miniconda
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: "conda_deploy"
auto-update-conda: true
channels: conda-forge
channel-priority: flexible
show-channel-urls: true
- name: Install dependencies
shell: bash -l {0}
run: |
conda install anaconda-client -q -y
- name: Download build artifacts
uses: actions/download-artifact@v2
with:
name: conda-build-artifacts
path: conda_pkgs_output/
- name: Upload to Anaconda
shell: bash -l {0}
run: |
set -ex
anaconda --token "${ANACONDA_TOKEN}" upload --label main --user ${ANACONDA_USER} ./conda_pkgs_output/*/riptide_cpp-*.tar.bz2