Skip to content

Commit

Permalink
Build PyArrow and LightGBM
Browse files Browse the repository at this point in the history
  • Loading branch information
agriyakhetarpal committed Dec 18, 2024
0 parents commit 12f4b18
Show file tree
Hide file tree
Showing 5 changed files with 678 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
130 changes: 130 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: Build PyArrow and LightGBM

on:
pull_request:
workflow_dispatch:
release:
types: [published]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: "3.12"

- name: Install system-level dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
cmake bzip2 ccache f2c g++ gfortran git make \
patch pkg-config swig unzip wget xz-utils \
autoconf autotools-dev automake texinfo dejagnu \
build-essential libtool libltdl-dev \
gnupg2 libdbus-glib-1-2 sudo sqlite3 \
ninja-build jq xxd
- name: Cache ccache outputs
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: /tmp/ccache
key: ccache-${{ hashFiles('Makefile.envs') }}

- name: Check out @agriyakhetarpal's fork of Pyodide, and the NumPy v2 mirror branch
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
repository: agriyakhetarpal/pyodide
ref: numpy-v2-update-mirror
path: pyodide_checkout
submodules: recursive

- name: Restore cached built packages
uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: |
pyodide_checkout/packages/.libs/*
pyodide_checkout/packages/.artifacts/*
key: pyodide-packages-${{ hashFiles('pyodide_checkout/packages/recipes/**/*.yaml') }}

- name: Build Pyodide distribution with NumPy v2 enabled
working-directory: pyodide_checkout/
run: |
source pyodide_env.sh
ccache -z
PYODIDE_CORES=$(nproc)
PYODIDE_JOBS="${PYODIDE_CORES}" PYODIDE_PACKAGES="pyarrow,lightgbm" make
ccache -s
- name: Save ccached outputs
uses: actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
with:
path: /tmp/ccache
key: ccache-${{ hashFiles('Makefile.envs') }}

- name: Upload Pyodide distribution with PyArrow and LightGBM wheels
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
with:
name: pyodide-with-packages-pyarrow-lightgbm
path: pyodide_checkout/dist/*
if-no-files-found: error
retention-days: 1

publish:
runs-on: ubuntu-latest
needs: [build]
if: >-
github.repository == 'agriyakhetarpal/pyodide-numpy-2.0-rebuilds' &&
github.event_name == 'release' &&
github.event.action == 'published'
permissions:
# Required to sign the attestations
id-token: write
attestations: write
# Required to upload to a GitHub release identifier
contents: write
steps:
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: packages-pyarrow-lightgbm-artifact
path: dist
merge-multiple: true

- name: Copy PyArrow and LightGBM wheels from Pyodide distribution artifact
run: |
mkdir -p packages
cp dist/packages/pyarrow-*.whl packages/
cp dist/packages/lightgbm-*.whl packages/
- name: Generate attestations for these wheels
uses: actions/attest-build-provenance@7668571508540a607bdfd90a87a560489fe372eb # v2.1.0
with:
subject-path: |
packages/*.whl
- name: Verify them, to ensure that the wheels they were attested correctly
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
for artifact in packages/*; do
echo "# ${artifact}"
gh attestation verify "${artifact}" --repo ${{ github.repository }}
done
- name: Create GitHub release with these wheels
uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974 # v2.1.0
if: >-
github.repository == 'agriyakhetarpal/pyodide-numpy-2.0-rebuilds' &&
github.event_name == 'release' &&
github.event.action == 'published'
with:
files: |
packages/*.whl
fail_on_unmatched_files: true
name: PyArrow and LightGBM wheels, built against NumPy v2 via Pyodide gh-4925
160 changes: 160 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
Loading

0 comments on commit 12f4b18

Please sign in to comment.