From 7e69659ed706bc7ceda736dcb58ab29b41fd9b2a Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Thu, 29 Aug 2024 22:40:32 +0530 Subject: [PATCH 1/9] Add Dependabot configuration file --- .github/dependabot.yml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ac27a84 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +version: 2 +updates: + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + # Check for updates to GitHub Actions every week + interval: "weekly" From 18a9b8c5798fc1fbd4ad8c24545cd0422c7b6aef Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Thu, 29 Aug 2024 22:53:04 +0530 Subject: [PATCH 2/9] Use cibuildwheel GH action --- .github/workflows/build-wheels.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index bd5dc8b..df7688f 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -56,12 +56,11 @@ jobs: with: platforms: all - - name: Install cibuildwheel - run: python -m pip install cibuildwheel==2.16.2 - - name: Build wheels - run: | - python -m cibuildwheel --output-dir wheelhouse statsmodels + uses: pypa/cibuildwheel@v2.20.0 + with: + output-dir: wheelhouse + package-dir: statsmodels env: CIBW_BEFORE_BUILD: 'git submodule foreach git checkout ${{ env.BUILD_COMMIT }}' From 8883901adfac443af8711037a0046589622f7dc2 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Thu, 29 Aug 2024 23:09:07 +0530 Subject: [PATCH 3/9] Build Pyodide wheel in separate job --- .github/workflows/build-wheels.yml | 88 ++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index df7688f..1dd3d4c 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -109,3 +109,91 @@ jobs: anaconda -t ${TOKEN} upload --force -u ${ANACONDA_ORG} ./wheelhouse/*.whl echo "PyPI-style index: https://pypi.anaconda.org/$ANACONDA_ORG/simple" fi + + + # Same as the above job, but configurations swapped for Pyodide + build_pyodide_wheel: + name: ubuntu-latest, Pyodide cp312 + runs-on: ubuntu-latest + defaults: + run: + shell: bash + env: + BUILD_COMMIT: "main" # or a specific version, e.g., v0.13.1 + CIBW_PLATFORM: pyodide + CIBW_TEST_REQUIRES: pytest + CIBW_TEST_COMMAND: python -c "import statsmodels; statsmodels.test(['--skip-examples','--skip-slow')" + 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 + + # Used to host cibuildwheel runner + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Build Pyodide wheel + uses: pypa/cibuildwheel@v2.20.0 + with: + output-dir: wheelhouse + package-dir: statsmodels + + env: + CIBW_BEFORE_BUILD: 'git submodule foreach git checkout ${{ env.BUILD_COMMIT }}' + CIBW_PLATFORM: pyodide + CIBW_TEST_REQUIRES: pytest + CIBW_TEST_COMMAND: python -c "import statsmodels; statsmodels.test(['--skip-examples','--skip-slow']) + + - 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 + - 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 \ No newline at end of file From 048665ad46f4ad9e48f6868aca74dfbc28f14965 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Thu, 29 Aug 2024 23:16:34 +0530 Subject: [PATCH 4/9] Terminate quoted string properly --- .github/workflows/build-wheels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 1dd3d4c..979d6ac 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -122,7 +122,7 @@ jobs: BUILD_COMMIT: "main" # or a specific version, e.g., v0.13.1 CIBW_PLATFORM: pyodide CIBW_TEST_REQUIRES: pytest - CIBW_TEST_COMMAND: python -c "import statsmodels; statsmodels.test(['--skip-examples','--skip-slow')" + CIBW_TEST_COMMAND: python -c "import statsmodels; statsmodels.test(['--skip-examples','--skip-slow'])" MULTIBUILD_WHEELS_STAGING_ACCESS: ${{ secrets.MULTIBUILD_WHEELS_STAGING_ACCESS }} SCIENTIFIC_PYTHON_NIGHTLY_WHEELS: ${{ secrets.SCIENTIFIC_PYTHON_NIGHTLY_WHEELS }} MKL_NUM_THREADS: 1 From 1a8938a0e847987725e31b01e6c77cb0fdc2c5d3 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Thu, 29 Aug 2024 23:27:42 +0530 Subject: [PATCH 5/9] Don't repeat env vars --- .github/workflows/build-wheels.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 979d6ac..4836b4d 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -146,12 +146,6 @@ jobs: output-dir: wheelhouse package-dir: statsmodels - env: - CIBW_BEFORE_BUILD: 'git submodule foreach git checkout ${{ env.BUILD_COMMIT }}' - CIBW_PLATFORM: pyodide - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_COMMAND: python -c "import statsmodels; statsmodels.test(['--skip-examples','--skip-slow']) - - name: Setup Upload Variables if: ${{ always() }} shell: bash From e66eabff5569fb7577fd9fce0180fe655546b92c Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Thu, 29 Aug 2024 23:37:37 +0530 Subject: [PATCH 6/9] Simplify Pyodide matrix, don't use separate job --- .github/workflows/build-wheels.yml | 92 +++++------------------------- 1 file changed, 14 insertions(+), 78 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 4836b4d..57d0a31 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -10,7 +10,7 @@ on: jobs: build_wheels: - name: ${{ matrix.os }}, Python ${{ matrix.python }} + name: ${{ matrix.os }}, ${{matrix.python_impl }} ${{ matrix.python }} runs-on: ${{ matrix.os }} defaults: run: @@ -20,6 +20,11 @@ jobs: matrix: python: [cp39, cp310, cp311, cp312] os: [ubuntu-latest, windows-latest, 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 }}-* @@ -58,93 +63,24 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.20.0 + if: matrix.python_impl != 'Pyodide' with: output-dir: wheelhouse package-dir: statsmodels env: CIBW_BEFORE_BUILD: 'git submodule foreach git checkout ${{ env.BUILD_COMMIT }}' - - 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 - - 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 - - - # Same as the above job, but configurations swapped for Pyodide - build_pyodide_wheel: - name: ubuntu-latest, Pyodide cp312 - runs-on: ubuntu-latest - defaults: - run: - shell: bash - env: - BUILD_COMMIT: "main" # or a specific version, e.g., v0.13.1 - CIBW_PLATFORM: pyodide - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_COMMAND: python -c "import statsmodels; statsmodels.test(['--skip-examples','--skip-slow'])" - 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 - - # Used to host cibuildwheel runner - - uses: actions/setup-python@v5 - with: - python-version: '3.12' - - name: Build Pyodide wheel + if: matrix.python_impl == 'Pyodide' uses: pypa/cibuildwheel@v2.20.0 with: output-dir: wheelhouse package-dir: statsmodels + env: + CIBW_BEFORE_BUILD: 'git submodule foreach git checkout ${{ env.BUILD_COMMIT }}' + CIBW_PLATFORM: pyodide + CIBW_TEST_REQUIRES: pytest + CIBW_TEST_COMMAND: python -c "import statsmodels; statsmodels.test(['--skip-examples','--skip-slow'])" - name: Setup Upload Variables if: ${{ always() }} @@ -190,4 +126,4 @@ jobs: 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 \ No newline at end of file + fi From 6ad65206b6aaca4e3941652fc1f4675ad222aea5 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Thu, 29 Aug 2024 23:58:44 +0530 Subject: [PATCH 7/9] Don't test Pyodide wheels since it's slow to run --- .github/workflows/build-wheels.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 57d0a31..cfd7e4e 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -35,8 +35,8 @@ jobs: 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'])" - # Avoid testing on emulated architectures - CIBW_TEST_SKIP: "*-*linux_{aarch64,ppc64le,s390x}" + # 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}' MULTIBUILD_WHEELS_STAGING_ACCESS: ${{ secrets.MULTIBUILD_WHEELS_STAGING_ACCESS }} SCIENTIFIC_PYTHON_NIGHTLY_WHEELS: ${{ secrets.SCIENTIFIC_PYTHON_NIGHTLY_WHEELS }} @@ -79,8 +79,9 @@ jobs: env: CIBW_BEFORE_BUILD: 'git submodule foreach git checkout ${{ env.BUILD_COMMIT }}' CIBW_PLATFORM: pyodide - CIBW_TEST_REQUIRES: pytest - CIBW_TEST_COMMAND: python -c "import statsmodels; statsmodels.test(['--skip-examples','--skip-slow'])" + # Tests are slow, and statsmodels is tested out-of-tree on PRs in the main repository + # CIBW_TEST_REQUIRES: pytest + # CIBW_TEST_COMMAND: python -c "import statsmodels; statsmodels.test(['--skip-examples','--skip-slow'])" - name: Setup Upload Variables if: ${{ always() }} From 70a67541b17f9c0ad63ac3a5d3d174343ce32eb6 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 30 Aug 2024 22:06:54 +0530 Subject: [PATCH 8/9] Don't pin to cibuildwheel 2.20.X --- .github/workflows/build-wheels.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index cfd7e4e..59fa39e 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -62,7 +62,7 @@ jobs: platforms: all - name: Build wheels - uses: pypa/cibuildwheel@v2.20.0 + uses: pypa/cibuildwheel@v2.20 if: matrix.python_impl != 'Pyodide' with: output-dir: wheelhouse @@ -72,7 +72,7 @@ jobs: - name: Build Pyodide wheel if: matrix.python_impl == 'Pyodide' - uses: pypa/cibuildwheel@v2.20.0 + uses: pypa/cibuildwheel@v2.20 with: output-dir: wheelhouse package-dir: statsmodels From a690858814dc9a52c938d91e4955e5a44616d38d Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Fri, 30 Aug 2024 22:07:23 +0530 Subject: [PATCH 9/9] setup-python isn't needed with cibuilwheel GHA --- .github/workflows/build-wheels.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 59fa39e..a61ec2f 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -50,11 +50,6 @@ jobs: submodules: recursive fetch-depth: 0 - # Used to host cibuildwheel runner - - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - name: Set up QEMU if: runner.os == 'Linux' uses: docker/setup-qemu-action@v3