This document is for LightGBM maintainers.
This project uses pixi for tasks and CI jobs that run with a locked set of dependencies.
In general, updating these environments looks like:
- manually modify
pixi.toml - run
pixi install
And running inside one looks like:
# interactive shell
pixi shell -e py311
# run a task
pixi run -e py311 python -c "import pandas; print(pandas.__version__)"See https://pixi.prefix.dev/latest/ for more details.
This section describes how to maintain the project's continuous integration ("CI").
Most Linux CI jobs use container images built from within this repository.
- Dockerfiles:
.ci/ci-images/ - workflow:
.github/workflows/ci-images.yml
To build new images:
- push changes to a branch in the LightGBM repo (not a fork!)
- trigger a run of the image-building workflow from that branch
gh workflow run \
--repo lightgbm-org/LightGBM \
--ref $(git branch --show-current) \
-f tag-suffix="-dev"\
ci-images.yml- attempt a run of regular CI with the image references switched to those
-devimages - if all succeeds, do another run building the CI images without a suffix
gh workflow run \
--repo lightgbm-org/LightGBM \
--ref $(git branch --show-current) \
-f tag-suffix="" \
ci-images.ymlCreate a pull request into main which prepares the source code for release.
Copy the description and checklist from the previous release PR (for example: #6796).
This should usually also include a checklist of other issues and PRs that should be completed for the release, and the PR should be used to discuss what makes it into the release.
Once the PR is approved, merge it.
Do not merge any other PRs into main until the rest of the release is complete.
Wait for all CI runs triggered by the merge to main to complete successfully.
These runs build and test the official artifacts that will be attached to the GitHub release and published to package managers.
Navigate to https://github.com/lightgbm-org/LightGBM/releases.
Click "edit" on the draft release that release-drafter has created there.
- update the tag and release title to match the version of LightGBM, in the format
v{major}.{minor}.{patch} - ensure that tag points at the commit on
maincreated by merging the release PR
When you're satisfied with the state of the release, click "Publish release".
After creating a release, run the following from the root of the repo to populate it with artifacts.
# download all artifacts to a local directory
./.ci/download-artifacts.sh ${COMMIT_ID}
# attach them to the GitHub release
gh release upload \
--repo lightgbm-org/LightGBM \
"${TAG}" \
./release-artifacts/*Where:
COMMIT_ID= full commit hash of the commit onmaincorresponding to the releaseTAG= the tag for the release (e.g.v4.7.0)
These include things like publishing to package managers, updating build configs for repackagers like conda-forge, and many other steps.
See the release checklist on the PR for details.
Nightly packages for the lightgbm Python package are uploaded to https://anaconda.org/lightgbm-packages on every merge to main.
That's done using an upload token stored in a secret in CI. Those tokens expire after 1 year.
To generate a new one, run the following.
# install Anaconda CLI
conda install -y -c conda-forge \
anaconda-auth \
anaconda-client
# authenticate locally
anaconda auth login
# create a token (this expires after 1 year)
TOKEN=$(
anaconda org auth \
--create \
--name nightly-uploads \
--org lightgbm-packages \
--scopes 'api:read api:write pypi:upload'
)That token can be used by maintainers to manually upload packages as well.
For example:
./.ci/download-artifacts.sh $(git rev-parse HEAD)
# NOTE: set upload token in environment variable 'ANACONDA_API_TOKEN'
anaconda upload \
--package lightgbm \
--force-metadata-update \
-t pypi \
./release-artifacts/*.whl