Skip to content

Commit 8883901

Browse files
Build Pyodide wheel in separate job
1 parent 18a9b8c commit 8883901

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

.github/workflows/build-wheels.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,91 @@ jobs:
109109
anaconda -t ${TOKEN} upload --force -u ${ANACONDA_ORG} ./wheelhouse/*.whl
110110
echo "PyPI-style index: https://pypi.anaconda.org/$ANACONDA_ORG/simple"
111111
fi
112+
113+
114+
# Same as the above job, but configurations swapped for Pyodide
115+
build_pyodide_wheel:
116+
name: ubuntu-latest, Pyodide cp312
117+
runs-on: ubuntu-latest
118+
defaults:
119+
run:
120+
shell: bash
121+
env:
122+
BUILD_COMMIT: "main" # or a specific version, e.g., v0.13.1
123+
CIBW_PLATFORM: pyodide
124+
CIBW_TEST_REQUIRES: pytest
125+
CIBW_TEST_COMMAND: python -c "import statsmodels; statsmodels.test(['--skip-examples','--skip-slow')"
126+
MULTIBUILD_WHEELS_STAGING_ACCESS: ${{ secrets.MULTIBUILD_WHEELS_STAGING_ACCESS }}
127+
SCIENTIFIC_PYTHON_NIGHTLY_WHEELS: ${{ secrets.SCIENTIFIC_PYTHON_NIGHTLY_WHEELS }}
128+
MKL_NUM_THREADS: 1
129+
OMP_NUM_THREADS: 1
130+
OPENLAS_NUM_THREADS: 1
131+
132+
steps:
133+
- uses: actions/checkout@v4
134+
with:
135+
submodules: recursive
136+
fetch-depth: 0
137+
138+
# Used to host cibuildwheel runner
139+
- uses: actions/setup-python@v5
140+
with:
141+
python-version: '3.12'
142+
143+
- name: Build Pyodide wheel
144+
uses: pypa/[email protected]
145+
with:
146+
output-dir: wheelhouse
147+
package-dir: statsmodels
148+
149+
env:
150+
CIBW_BEFORE_BUILD: 'git submodule foreach git checkout ${{ env.BUILD_COMMIT }}'
151+
CIBW_PLATFORM: pyodide
152+
CIBW_TEST_REQUIRES: pytest
153+
CIBW_TEST_COMMAND: python -c "import statsmodels; statsmodels.test(['--skip-examples','--skip-slow'])
154+
155+
- name: Setup Upload Variables
156+
if: ${{ always() }}
157+
shell: bash
158+
run: |
159+
if [ "schedule" == "${{ github.event_name }}" ] || [ "push" == "${{ github.event_name }}" ]; then
160+
echo "ANACONDA_UPLOAD=true" >> $GITHUB_ENV
161+
else
162+
echo "ANACONDA_UPLOAD=false" >> $GITHUB_ENV
163+
fi
164+
if [ "schedule" == "${{ github.event_name }}" ] || [ "main" == "$BUILD_COMMIT" ]; then
165+
echo "ANACONDA_ORG=scientific-python-nightly-wheels" >> $GITHUB_ENV
166+
echo "TOKEN=$SCIENTIFIC_PYTHON_NIGHTLY_WHEELS" >> $GITHUB_ENV
167+
else
168+
echo "ANACONDA_ORG=multibuild-wheels-staging" >> $GITHUB_ENV
169+
echo "TOKEN=$MULTIBUILD_WHEELS_STAGING_ACCESS" >> $GITHUB_ENV
170+
fi
171+
- name: Upload wheels
172+
if: ${{ always() }}
173+
shell: bash
174+
run: |
175+
# trigger an upload to the shared ecosystem
176+
# infrastructure at: https://anaconda.org/scientific-python-nightly-wheels
177+
# for cron jobs only (restricted to main branch once
178+
# per week)
179+
# SCIENTIFIC_PYTHON_NIGHTLY_WHEELS is a secret token
180+
# used in Travis CI config, originally
181+
#
182+
# for merges (push events) we use the staging area instead;
183+
# MULTIBUILD_WHEELS_STAGING_ACCESS is a secret token used in Travis
184+
# CI config, originally generated at anaconda.org for
185+
# multibuild-wheels-staging
186+
# generated at anaconda.org for scientific-python-nightly-wheels
187+
echo ${PWD}
188+
if [ ${ANACONDA_UPLOAD} == true ]; then
189+
# main branches of these two packages
190+
python --version
191+
python -m pip install "cython<3"
192+
python -m pip list
193+
python -m pip install git+https://github.com/bashtage/clyent.git
194+
python -m pip install git+https://github.com/Anaconda-Server/anaconda-client.git
195+
python -m pip install "urllib3>=1.21.1,<2"
196+
ls ./wheelhouse/*.whl
197+
anaconda -t ${TOKEN} upload --force -u ${ANACONDA_ORG} ./wheelhouse/*.whl
198+
echo "PyPI-style index: https://pypi.anaconda.org/$ANACONDA_ORG/simple"
199+
fi

0 commit comments

Comments
 (0)