-
Notifications
You must be signed in to change notification settings - Fork 11
139 lines (129 loc) · 5.17 KB
/
build-wheels.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
130
131
132
133
134
135
136
137
138
139
name: Build wheels
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 0 * * 0,3' # 2/weekly
jobs:
build_wheels:
name: ${{ matrix.os }}, ${{matrix.python_impl }} ${{ matrix.python }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
python: [cp39, cp310, cp311, cp312]
os: [ubuntu-latest, windows-latest, macos-13, macos-latest]
python_impl: [Python]
include:
- python: cp312
os: ubuntu-latest
python_impl: Pyodide
env:
BUILD_COMMIT: "main" # or a specific version, e.g., v0.13.1
CIBW_BUILD: ${{ matrix.python }}-*
CIBW_ARCHS_LINUX: "x86_64 aarch64"
# No support for pypy, musl, Win32 for 3.10+
# Skip musl for 3.8 and 3.9 since no upstream wheels
CIBW_SKIP: "pp* *-win32 cp38-musllinux* cp39-musllinux* *musllinux_aarch64*"
CIBW_TEST_REQUIRES: pytest pytest-xdist
CIBW_TEST_COMMAND: python -c "import statsmodels; statsmodels.test(['--skip-examples','--skip-slow','-n','2'], exit=True)"
# Avoid testing on emulated architectures and Pyodide
CIBW_TEST_SKIP: "*-*linux_{aarch64,ppc64le,s390x} *pyodide*"
CIBW_REPAIR_WHEEL_COMMAND_LINUX: 'auditwheel repair --strip -w {dest_dir} {wheel}'
CIBW_BUILD_VERBOSITY: 1
MULTIBUILD_WHEELS_STAGING_ACCESS: ${{ secrets.MULTIBUILD_WHEELS_STAGING_ACCESS }}
SCIENTIFIC_PYTHON_NIGHTLY_WHEELS: ${{ secrets.SCIENTIFIC_PYTHON_NIGHTLY_WHEELS }}
MKL_NUM_THREADS: 1
OMP_NUM_THREADS: 1
OPENLAS_NUM_THREADS: 1
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Set up QEMU
if: runner.os == 'Linux'
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Build wheels (Default)
uses: pypa/[email protected]
if: (matrix.python_impl != 'Pyodide') && (matrix.os != 'macos-13')
with:
output-dir: wheelhouse
package-dir: statsmodels
env:
CIBW_BEFORE_BUILD: 'git submodule foreach git checkout ${{ env.BUILD_COMMIT }}'
CIBW_ARCHS_MACOS: "arm64"
- name: Build wheels (MacOS x86_64)
if: matrix.os == 'macos-13'
uses: pypa/[email protected]
with:
output-dir: wheelhouse
package-dir: statsmodels
env:
CIBW_BEFORE_BUILD: 'git submodule foreach git checkout ${{ env.BUILD_COMMIT }}'
CIBW_ARCHS_OSX: "x86_64"
- name: Build Pyodide wheel
if: matrix.python_impl == 'Pyodide'
uses: pypa/[email protected]
with:
output-dir: wheelhouse
package-dir: statsmodels
env:
CIBW_BEFORE_BUILD: 'git submodule foreach git checkout ${{ env.BUILD_COMMIT }}'
CIBW_PLATFORM: pyodide
- name: Setup Upload Variables
if: ${{ always() }}
shell: bash
run: |
if [ "schedule" == "${{ github.event_name }}" ] || [ "push" == "${{ github.event_name }}" ]; then
echo "ANACONDA_UPLOAD=true" >> $GITHUB_ENV
else
echo "ANACONDA_UPLOAD=false" >> $GITHUB_ENV
fi
if [ "schedule" == "${{ github.event_name }}" ] || [ "main" == "$BUILD_COMMIT" ]; then
echo "ANACONDA_ORG=scientific-python-nightly-wheels" >> $GITHUB_ENV
echo "TOKEN=$SCIENTIFIC_PYTHON_NIGHTLY_WHEELS" >> $GITHUB_ENV
else
echo "ANACONDA_ORG=multibuild-wheels-staging" >> $GITHUB_ENV
echo "TOKEN=$MULTIBUILD_WHEELS_STAGING_ACCESS" >> $GITHUB_ENV
fi
# Used to ensure python is available for wheel upload
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Upload wheels
if: ${{ always() }}
shell: bash
run: |
# trigger an upload to the shared ecosystem
# infrastructure at: https://anaconda.org/scientific-python-nightly-wheels
# for cron jobs only (restricted to main branch once
# per week)
# SCIENTIFIC_PYTHON_NIGHTLY_WHEELS is a secret token
# used in Travis CI config, originally
#
# for merges (push events) we use the staging area instead;
# MULTIBUILD_WHEELS_STAGING_ACCESS is a secret token used in Travis
# CI config, originally generated at anaconda.org for
# multibuild-wheels-staging
# generated at anaconda.org for scientific-python-nightly-wheels
echo ${PWD}
if [ ${ANACONDA_UPLOAD} == true ]; then
# main branches of these two packages
python --version
python -m pip install "cython<3"
python -m pip list
python -m pip install git+https://github.com/bashtage/clyent.git
python -m pip install git+https://github.com/Anaconda-Server/anaconda-client.git
python -m pip install "urllib3>=1.21.1,<2"
ls ./wheelhouse/*.whl
anaconda -t ${TOKEN} upload --force -u ${ANACONDA_ORG} ./wheelhouse/*.whl
echo "PyPI-style index: https://pypi.anaconda.org/$ANACONDA_ORG/simple"
fi