chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:27:18 +08:00
commit d72d1a58f0
553 changed files with 214565 additions and 0 deletions
+81
View File
@@ -0,0 +1,81 @@
# builds core artifacts, intended to be attached to releases
# or used by other workflows
name: Build
on:
push:
branches:
- main
pull_request:
branches:
- main
- master
# automatically cancel in-progress builds if another commit is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# default to 0 permissions
# (job-level overrides add the minimal permissions needed)
permissions:
contents: none
env:
# tell scripts where to put artifacts
BUILD_ARTIFACTSTAGINGDIRECTORY: '${{ github.workspace }}/artifacts'
jobs:
archive:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 5
persist-credentials: false
submodules: true
- name: Create source archive
run: |
mkdir -p "${BUILD_ARTIFACTSTAGINGDIRECTORY}"
tar \
-czvf \
/tmp/LightGBM-complete_source_code_tar_gz.tar.gz \
.
mv \
/tmp/LightGBM-complete_source_code_tar_gz.tar.gz \
${BUILD_ARTIFACTSTAGINGDIRECTORY}/
- name: Create commit.txt
shell: bash
run: |
# for pull requests, github.sha refers to the merge commit from merging the PR and
# target branch... we want the actual commit that was pushed
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
COMMIT_SHA="${{ github.event.pull_request.head.sha }}"
else
COMMIT_SHA="${{ github.sha }}"
fi
echo "${COMMIT_SHA}" > "${BUILD_ARTIFACTSTAGINGDIRECTORY}/commit.txt"
- name: Upload artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: source-archive
path: |
${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}/commit.txt
${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}/LightGBM-complete_source_code_tar_gz.tar.gz
if-no-files-found: error
all-build-jobs-successful:
if: always()
runs-on: ubuntu-latest
needs:
- archive
permissions:
statuses: read
steps:
- name: Note that all tests succeeded
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
with:
jobs: ${{ toJSON(needs) }}
+158
View File
@@ -0,0 +1,158 @@
name: C++
on:
push:
branches:
- main
pull_request:
branches:
- main
- master
# automatically cancel in-progress builds if another commit is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# default to 0 permissions
# (job-level overrides add the minimal permissions needed)
permissions:
contents: none
env:
# tell scripts where to put artifacts
# (this variable name is left over from when jobs ran on Azure DevOps)
BUILD_ARTIFACTSTAGINGDIRECTORY: '${{ github.workspace }}/artifacts'
# where repo sources are cloned to
BUILD_DIRECTORY: '${{ github.workspace }}'
# in CMake-driven builds, parallelize compilation
CMAKE_BUILD_PARALLEL_LEVEL: 4
jobs:
test:
name: ${{ matrix.task }} (${{ matrix.os-display-name || matrix.os }}, ${{ matrix.compiler }})
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
timeout-minutes: 60
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
#############
# C++ tests #
#############
- os: ubuntu-latest
task: cpp-tests
compiler: clang-17
method: with-sanitizers
container: 'ubuntu:22.04'
os-display-name: 'ubuntu22.04'
- os: macos-15-intel
task: cpp-tests
compiler: clang
method: with-sanitizers
sanitizers: "address;undefined"
container: null
- os: windows-2022
task: cpp-tests
compiler: msvc
container: null
###########
# if-else #
###########
# These test CLI-generated C++ inference code.
#
# They need Python because they're written with pytest, but they
# do not need the LightGBM Python package
- os: ubuntu-latest
task: if-else
compiler: clang-17
container: 'ubuntu:22.04'
os-display-name: 'ubuntu22.04'
python_version: '3.14'
setup-conda: 'true'
- os: macos-15-intel
task: if-else
compiler: clang
python_version: '3.10'
container: null
- os: ubuntu-latest
task: if-else
compiler: gcc
python_version: '3.11'
container: 'ghcr.io/lightgbm-org/lightgbm-vsts-agent:manylinux_2_28_x86_64'
os-display-name: 'manylinux_2_28'
steps:
- name: Install packages used by third-party actions
if: matrix.container == 'ubuntu:22.04'
shell: bash
run: |
apt-get update -y
apt-get install --no-install-recommends -y \
dirmngr \
gpg \
gpg-agent \
software-properties-common \
sudo
# install newest version of git
# ref:
# - https://unix.stackexchange.com/a/170831/550004
# - https://git-scm.com/download/linux
add-apt-repository ppa:git-core/ppa -y
apt-get update -y
apt-get install --no-install-recommends -y \
git
- name: Trust git cloning LightGBM
if: startsWith(matrix.os, 'ubuntu')
run: |
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 5
persist-credentials: false
submodules: true
- name: Setup and run tests on Linux and macOS
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
shell: bash
run: |
export COMPILER="${{ matrix.compiler }}"
export CONDA="${HOME}/miniforge"
export METHOD="${{ matrix.method }}"
export PATH=${CONDA}/bin:${PATH}
export PYTHON_VERSION="${{ matrix.python_version }}"
export SANITIZERS="${{ matrix.sanitizers }}"
export SETUP_CONDA="${{ matrix.setup-conda }}"
export TASK="${{ matrix.task }}"
if [[ "${{ matrix.os }}" =~ ^macos ]]; then
export OS_NAME="macos"
elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
export OS_NAME="linux"
fi
if [[ "${{ matrix.container }}" == "ubuntu:22.04" ]]; then
export DEBIAN_FRONTEND=noninteractive
export IN_UBUNTU_BASE_CONTAINER="true"
fi
$GITHUB_WORKSPACE/.ci/setup.sh
$GITHUB_WORKSPACE/.ci/test.sh
- name: Setup and run tests on Windows
if: startsWith(matrix.os, 'windows')
shell: pwsh -command ". {0}"
run: |
$env:BUILD_SOURCESDIRECTORY = $env:BUILD_DIRECTORY
$env:TASK = "${{ matrix.task }}"
& "$env:GITHUB_WORKSPACE/.ci/test-windows.ps1"
all-cpp-jobs-successful:
if: always()
runs-on: ubuntu-latest
needs:
- test
permissions:
statuses: read
steps:
- name: Note that all tests succeeded
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
with:
jobs: ${{ toJSON(needs) }}
+115
View File
@@ -0,0 +1,115 @@
name: CUDA Version
on:
push:
# run on pushes to LightGBM branches matching certain names
branches:
- cuda-*
# Run manually by clicking a button in the UI
workflow_dispatch:
# automatically cancel in-progress builds if another commit is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# default to 0 permissions
# (job-level overrides add the minimal permissions needed)
permissions:
contents: none
jobs:
test:
# yamllint disable-line rule:line-length
name: ${{ matrix.task }} ${{ matrix.cuda_version }} ${{ matrix.method }} (${{ matrix.linux_version }}, ${{ matrix.compiler }}, Python ${{ matrix.python_version }})
# yamllint disable-line rule:line-length
# ref: https://docs.github.com/en/actions/concepts/runners/about-larger-runners#specifications-for-gpu-larger-runners
runs-on: github-hosted-linux-gpu-amd64
container:
image: nvcr.io/nvidia/cuda:${{ matrix.cuda_version }}-devel-${{ matrix.linux_version }}
env:
CMAKE_BUILD_PARALLEL_LEVEL: 4
COMPILER: ${{ matrix.compiler }}
CONDA: /tmp/miniforge
DEBIAN_FRONTEND: noninteractive
METHOD: ${{ matrix.method }}
OS_NAME: linux
PYTHON_VERSION: ${{ matrix.python_version }}
TASK: ${{ matrix.task }}
SKBUILD_STRICT_CONFIG: true
options: --gpus all
timeout-minutes: 30
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- method: wheel
compiler: gcc
python_version: "3.11"
cuda_version: "13.2.1"
linux_version: "ubuntu24.04"
task: cuda
- method: wheel
compiler: gcc
python_version: "3.11"
cuda_version: "12.9.1"
linux_version: "ubuntu22.04"
task: cuda
- method: source
compiler: gcc
python_version: "3.14"
cuda_version: "12.2.2"
linux_version: "ubuntu22.04"
task: cuda
- method: pip
compiler: gcc
python_version: "3.12"
cuda_version: "11.8.0"
linux_version: "ubuntu20.04"
task: cuda
steps:
- name: Install latest git and sudo
run: |
apt-get update
apt-get install --no-install-recommends -y \
ca-certificates \
software-properties-common
add-apt-repository ppa:git-core/ppa -y
apt-get update
apt-get install --no-install-recommends -y \
git \
sudo
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 5
persist-credentials: false
submodules: true
- name: Setup and run tests
env:
CI_CUDA_VERSION: ${{ matrix.cuda_version }}
run: |
export BUILD_ARTIFACTSTAGINGDIRECTORY="${{ github.workspace }}/artifacts"
export BUILD_DIRECTORY="$GITHUB_WORKSPACE"
export PATH=$CONDA/bin:$PATH
# check GPU usage
nvidia-smi
# build and test
$GITHUB_WORKSPACE/.ci/setup.sh
$GITHUB_WORKSPACE/.ci/test.sh
all-cuda-jobs-successful:
if: always()
runs-on: ubuntu-latest
needs:
- test
permissions:
statuses: read
steps:
- name: Note that all tests succeeded
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
with:
jobs: ${{ toJSON(needs) }}
+58
View File
@@ -0,0 +1,58 @@
name: 'Lock Inactive Threads'
on:
schedule:
# midnight UTC, every Wednesday, for Issues
- cron: '0 0 * * 3'
# midnight UTC, every Thursday, for PRs
- cron: '0 0 * * 4'
# allow manual triggering from GitHub UI
workflow_dispatch:
# only 1 job running in the repo at any time
concurrency:
group: lock
# default to 0 permissions
# (job-level overrides add the minimal permissions needed)
permissions:
contents: none
jobs:
action:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: dessant/lock-threads@89ae32b08ed1a541efecbab17912962a5e38981c # v6.0.2
with:
github-token: ${{ github.token }}
# after how many days of inactivity should a closed issue/PR be locked?
issue-inactive-days: '365'
pr-inactive-days: '365'
# do not close feature request issues...
# we close those but track them in https://github.com/lightgbm-org/LightGBM/issues/2302
exclude-any-issue-labels: 'feature request'
# what labels should be removed prior to locking?
remove-issue-labels: 'awaiting response,awaiting review,blocking,in progress'
remove-pr-labels: 'awaiting response,awaiting review,blocking,in progress'
# what message should be posted prior to locking?
issue-comment: >
This issue has been automatically locked
since there has not been any recent activity since it was closed.
To start a new related discussion,
open a new issue at https://github.com/lightgbm-org/LightGBM/issues
including a reference to this.
pr-comment: >
This pull request has been automatically locked
since there has not been any recent activity since it was closed.
To start a new related discussion,
open a new issue at https://github.com/lightgbm-org/LightGBM/issues
including a reference to this.
# what should the locking status be?
issue-lock-reason: 'resolved'
pr-lock-reason: 'resolved'
process-only: ${{ github.event.schedule == '0 0 * * 3' && 'issues' || 'prs' }}
+54
View File
@@ -0,0 +1,54 @@
name: Link checks
on:
# Run manually by clicking a button in the UI
workflow_dispatch:
# Run once a day at 8:00am UTC
schedule:
- cron: '0 8 * * *'
# only 1 job running in the repo at any time
concurrency:
group: lock
# default to 0 permissions
# (job-level overrides add the minimal permissions needed)
permissions:
contents: none
env:
COMPILER: gcc
OS_NAME: 'linux'
TASK: 'check-links'
jobs:
check-links:
timeout-minutes: 60
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 5
persist-credentials: false
submodules: false
- name: Build docs
run: |
export CONDA=${HOME}/miniforge
export PATH=${CONDA}/bin:${HOME}/.local/bin:${PATH}
$GITHUB_WORKSPACE/.ci/setup.sh || exit 1
$GITHUB_WORKSPACE/.ci/build-docs.sh || exit 1
- name: Check links
uses: lycheeverse/lychee-action@8646ba30535128ac92d33dfc9133794bfdd9b411 # v2.8.0
with:
args: >-
--config=./docs/.lychee.toml
--
"**/*.rst"
"**/*.md"
"./R-package/**/*.Rd"
"./docs/_build/html/*.html"
fail: true
failIfEmpty: true
+40
View File
@@ -0,0 +1,40 @@
name: No Response Bot
on:
issue_comment:
types: [created]
schedule:
# "every day at 04:00 UTC"
- cron: '0 4 * * *'
# only 1 job running in the repo at any time
concurrency:
group: lock
# default to 0 permissions
# (job-level overrides add the minimal permissions needed)
permissions:
contents: none
jobs:
no-response:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: lee-dohm/no-response@9bb0a4b5e6a45046f00353d5de7d90fb8bd773bb # v0.5.0
with:
closeComment: >
This issue has been automatically closed
because it has been awaiting a response for too long.
When you have time to to work with the maintainers to resolve this issue,
please post a new comment and it will be re-opened.
If the issue has been locked for editing by the time you return to it,
please open a new issue and reference this one.
Thank you for taking the time to improve LightGBM!
daysUntilClose: 30
responseRequiredLabel: awaiting response
token: ${{ github.token }}
+44
View File
@@ -0,0 +1,44 @@
name: Optional checks
on:
pull_request:
branches:
- main
- master
# automatically cancel in-progress builds if another commit is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# default to 0 permissions
# (job-level overrides add the minimal permissions needed)
permissions:
contents: none
jobs:
all-optional-checks-successful:
timeout-minutes: 30
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ github.token }}
permissions:
contents: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 5
persist-credentials: false
submodules: false
- name: Check valgrind workflow
shell: bash
run: |
# ref: https://docs.github.com/en/actions/reference/workflows-and-actions/contexts#github-context
PR_BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}"
echo "checking status for branch '${PR_BRANCH}'"
./.ci/check-workflow-status.sh \
"${PR_BRANCH}" \
'r_valgrind.yml' \
${{ github.event.number }}
+534
View File
@@ -0,0 +1,534 @@
name: Python-package
on:
push:
branches:
- main
pull_request:
branches:
- main
- master
# automatically cancel in-progress builds if another commit is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# default to 0 permissions
# (job-level overrides add the minimal permissions needed)
permissions:
contents: none
env:
# tell scripts where to put artifacts
# (this variable name is left over from when jobs ran on Azure DevOps)
BUILD_ARTIFACTSTAGINGDIRECTORY: '${{ github.workspace }}/artifacts'
# where repo sources are cloned to
BUILD_SOURCESDIRECTORY: '${{ github.workspace }}'
CMAKE_BUILD_PARALLEL_LEVEL: 4
# avoid interactive prompts in Debian-based distributions
DEBIAN_FRONTEND: noninteractive
# On runners using nvidia-container-runtime with Docker, ensure GPUs are available to running processes.
#
# ref: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/docker-specialized.html
NVIDIA_VISIBLE_DEVICES: 'all'
SKBUILD_STRICT_CONFIG: true
jobs:
test-linux-aarch64:
name: bdist wheel (manylinux2014-arm, gcc, Python 3.14)
runs-on: ubuntu-24.04-arm
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 5
persist-credentials: false
submodules: true
- name: Setup and run tests
shell: bash
# this uses 'docker run' instead of just setting 'container:'
# because actions/checkout requires GLIBC 2.28 and that is too
# new for manylinux2014
env:
BUILD_DIRECTORY: /LightGBM
run: |
cat > ./docker-script.sh <<EOF
mkdir -p \$BUILD_ARTIFACTSTAGINGDIRECTORY
export CONDA=\$HOME/miniforge
export PATH=\$CONDA/bin:\$PATH
${{ env.BUILD_DIRECTORY }}/.ci/setup.sh || exit 1
${{ env.BUILD_DIRECTORY }}/.ci/test.sh || exit 1
EOF
IMAGE_URI="lightgbm/vsts-agent:manylinux2014_aarch64"
docker pull "${IMAGE_URI}" || exit 1
docker run \
--platform "${PLATFORM}" \
--rm \
--env BUILD_DIRECTORY=${{ env.BUILD_DIRECTORY }} \
--env BUILD_ARTIFACTSTAGINGDIRECTORY=${{ env.BUILD_DIRECTORY }}/artifacts/ \
--env COMPILER=gcc \
--env METHOD=wheel \
--env OS_NAME=linux \
--env PRODUCES_ARTIFACTS=true \
--env PYTHON_VERSION="3.14" \
--env TASK=bdist \
-v "${PWD}":"${{ env.BUILD_DIRECTORY }}" \
-w ${{ env.BUILD_DIRECTORY }} \
"${IMAGE_URI}" \
/bin/bash ./docker-script.sh
- name: Upload artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: linux-aarch64-wheel
path: artifacts/*.whl
if-no-files-found: error
test:
# yamllint disable-line rule:line-length
name: ${{ matrix.task }} ${{ matrix.method }} (${{ matrix.os-display-name || matrix.os }}, ${{ matrix.compiler }}, Python ${{ matrix.python_version }})
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
include:
- os: macos-15-intel
task: sdist
compiler: clang
python_version: '3.10'
pixi-env: 'py310'
- os: windows-2022
task: sdist
compiler: MSVC
python_version: '3.10'
pixi-env: 'py310'
- os: ubuntu-latest
container: &ubuntu_latest_image ubuntu:22.04
os-display-name: &ubuntu_latest_display_name 'ubuntu22.04'
task: regular
compiler: clang-17
python_version: '3.13'
in-ubuntu-base-container: 'true'
- os: ubuntu-latest
container: *ubuntu_latest_image
os-display-name: *ubuntu_latest_display_name
task: sdist
compiler: clang-17
python_version: '3.14'
in-ubuntu-base-container: 'true'
#########################
# OpenCL-based GPU jobs #
#########################
# clang-17 jobs are run on machines with actual GPUs because
# the package built with that compiler toolchain can't target the
# CPUs on GitHub's runners.
#
# ref: https://github.com/lightgbm-org/LightGBM/pull/7096/files#r2590879590
# TODO(jameslamb): restore these GPU jobs when we've clarified handling of GPU CI
# ref: https://github.com/lightgbm-org/LightGBM/issues/7187
# - os: github-hosted-linux-gpu-amd64
# container: nvcr.io/nvidia/cuda:12.9.1-devel-ubuntu22.04
# os-display-name: ubuntu22.04-with-gpu
# task: bdist
# compiler: clang-17
# method: wheel
# python_version: '3.11'
# in-ubuntu-base-container: 'true'
# - os: github-hosted-linux-gpu-amd64
# container: nvcr.io/nvidia/cuda:12.9.1-devel-ubuntu22.04
# os-display-name: ubuntu22.04-with-gpu
# task: gpu
# compiler: clang-17
# method: source
# python_version: '3.12'
# in-ubuntu-base-container: 'true'
- os: ubuntu-latest
container: &manylinux_amd64_image ghcr.io/lightgbm-org/lightgbm-vsts-agent:manylinux_2_28_x86_64
os-display-name: &manylinux_amd64_display_name 'manylinux_2_28'
task: gpu
method: source
compiler: gcc
python_version: '3.14'
in-ubuntu-base-container: 'false'
setup-conda: 'false'
############
# MPI jobs #
############
- os: macos-15-intel
task: mpi
compiler: gcc
method: source
python_version: '3.12'
- os: ubuntu-latest
container: *manylinux_amd64_image
os-display-name: *manylinux_amd64_display_name
task: mpi
compiler: gcc
method: source
python_version: '3.11'
in-ubuntu-base-container: 'false'
setup-conda: 'false'
- os: ubuntu-latest
container: *ubuntu_latest_image
os-display-name: *ubuntu_latest_display_name
task: mpi
compiler: clang-17
method: source
python_version: '3.13'
in-ubuntu-base-container: 'true'
- os: ubuntu-latest
container: *ubuntu_latest_image
os-display-name: *ubuntu_latest_display_name
task: mpi
compiler: clang-17
method: pip
python_version: '3.12'
in-ubuntu-base-container: 'true'
- os: ubuntu-latest
container: *ubuntu_latest_image
os-display-name: *ubuntu_latest_display_name
task: mpi
compiler: clang-17
method: wheel
python_version: '3.10'
pixi-env: 'py310'
in-ubuntu-base-container: 'true'
#####################
# jobs that create #
# release artifacts #
#####################
- os: macos-15-intel
task: bdist
compiler: clang
method: wheel
produces-artifacts: 'true'
artifact-name: 'macosx-amd64-wheel'
python_version: '3.13'
- os: macos-14
task: bdist
compiler: clang
method: wheel
produces-artifacts: 'true'
artifact-name: 'macosx-arm64-wheel'
python_version: '3.11'
- os: macos-15-intel
task: regular
compiler: clang
produces-artifacts: 'true'
artifact-name: 'macosx-amd64-liblightgbm'
python_version: '3.11'
- os: ubuntu-latest
container: *manylinux_amd64_image
os-display-name: *manylinux_amd64_display_name
task: regular
compiler: gcc
python_version: '3.11'
in-ubuntu-base-container: 'false'
setup-conda: 'false'
produces-artifacts: 'true'
artifact-name: 'linux-amd64-liblightgbm'
- os: ubuntu-latest
container: *manylinux_amd64_image
os-display-name: *manylinux_amd64_display_name
task: bdist
compiler: gcc
method: wheel
python_version: '3.10'
pixi-env: 'py310'
in-ubuntu-base-container: 'false'
setup-conda: 'false'
produces-artifacts: 'true'
artifact-name: 'linux-amd64-wheel'
- os: ubuntu-latest
container: *manylinux_amd64_image
os-display-name: *manylinux_amd64_display_name
task: sdist
compiler: gcc
python_version: '3.10'
pixi-env: 'py310'
in-ubuntu-base-container: 'false'
setup-conda: 'false'
produces-artifacts: 'true'
artifact-name: 'sdist'
- os: windows-2022
task: bdist
compiler: MSVC
method: wheel
produces-artifacts: 'true'
artifact-name: 'windows-amd64-wheel'
python_version: '3.13'
- os: windows-2022
task: regular
compiler: MSVC
produces-artifacts: 'true'
artifact-name: 'windows-amd64-cli-and-liblightgbm'
python_version: '3.11'
steps:
- name: Install packages used by third-party actions
if: ${{ matrix.in-ubuntu-base-container == 'true' }}
shell: bash
run: |
apt-get update -y
apt-get install --no-install-recommends -y \
ca-certificates \
dirmngr \
gpg \
gpg-agent \
software-properties-common \
sudo
# install newest version of git
# ref:
# - https://unix.stackexchange.com/a/170831/550004
# - https://git-scm.com/download/linux
add-apt-repository ppa:git-core/ppa -y
apt-get update -y
apt-get install --no-install-recommends -y \
git
- name: Trust git cloning LightGBM
if: startsWith(matrix.os, 'ubuntu')
run: |
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 5
persist-credentials: false
submodules: true
- name: Set up 'pixi' for jobs that need it
if: matrix.pixi-env != ''
uses: prefix-dev/setup-pixi@5185adfbffb4bd703da3010310260805d89ebb11 # v0.9.6
with:
environments: ${{ matrix.pixi-env }}
- name: Setup and run tests on Linux and macOS
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') || endsWith(matrix.os, 'gpu-amd64')
shell: bash
run: |
export COMPILER="${{ matrix.compiler }}"
export IN_UBUNTU_BASE_CONTAINER="${{ matrix.in-ubuntu-base-container }}"
export SETUP_CONDA="${{ matrix.setup-conda }}"
export TASK="${{ matrix.task }}"
export METHOD="${{ matrix.method }}"
if [[ "${{ matrix.os }}" =~ ^macos ]]; then
export OS_NAME="macos"
elif \
[[ "${{ matrix.os }}" == "ubuntu-latest" ]] \
|| [[ "${{ matrix.os }}" == "github-hosted-linux-gpu-amd64" ]];
then
export OS_NAME="linux"
export PATH="/usr/lib64/openmpi/bin:${PATH}"
fi
export PYTHON_VERSION="${{ matrix.python_version }}"
export BUILD_DIRECTORY="$GITHUB_WORKSPACE"
# some pre-built images already have 'CONDA' set
if [[ -z "${CONDA:-}" ]]; then
export CONDA=${HOME}/miniforge
fi
export PATH=${CONDA}/bin:${PATH}
export PRODUCES_ARTIFACTS="${{ matrix.produces-artifacts }}"
$GITHUB_WORKSPACE/.ci/setup.sh || exit 1
$GITHUB_WORKSPACE/.ci/test.sh || exit 1
- name: Install OpenCL on Windows
if: startsWith(matrix.os, 'windows') && (matrix.task == 'bdist')
shell: pwsh -command ". {0}"
run: |
& "$env:GITHUB_WORKSPACE/.ci/install-opencl.ps1"
# 'conda init powershell' needs to be run in a separate process
# ref: https://docs.conda.io/projects/conda/en/stable/dev-guide/deep-dives/activation.html
- name: Initialize conda on Windows
if: startsWith(matrix.os, 'windows')
shell: pwsh -command ". {0}"
run: |
$env:PATH = "$env:CONDA/Scripts;$env:PATH"
conda init powershell
- name: Setup and run tests on Windows
if: startsWith(matrix.os, 'windows')
shell: pwsh -command ". {0}"
run: |
$env:COMPILER = "${{ matrix.compiler }}"
$env:METHOD = "${{ matrix.method }}"
$env:PRODUCES_ARTIFACTS = "${{ matrix.produces-artifacts }}"
$env:PYTHON_VERSION = "${{ matrix.python_version }}"
$env:TASK = "${{ matrix.task }}"
& "$env:GITHUB_WORKSPACE/.ci/test-windows.ps1"
- name: Upload artifacts
if: ${{ matrix.produces-artifacts == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ matrix.artifact-name }}
path: |
artifacts/*.dll
artifacts/*.dylib
artifacts/*.exe
artifacts/*.so
artifacts/*.tar.gz
artifacts/*.whl
if-no-files-found: error
create-nuget:
name: NuGet package
runs-on: ubuntu-latest
timeout-minutes: 30
needs:
- test
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 5
persist-credentials: false
submodules: false
- name: Download lib_lightgbm (all operating systems) and Windows CLI
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
merge-multiple: true
path: ${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}
pattern: '*amd64*-liblightgbm'
run-id: ${{ github.run_id }}
- name: Setup NuGet CLI
uses: NuGet/setup-nuget@fd55a6f3b34392fa83fde1454582407d8c714123 # v4.0
# ref: https://github.com/NuGet/setup-nuget/issues/168
- name: Setup mono
run: |
sudo apt-get update -y
sudo apt-get install --no-install-recommends -y \
mono-devel
- name: Create NuGet package
run: |
python .ci/create-nuget.py "${BUILD_ARTIFACTSTAGINGDIRECTORY}"
nuget pack \
$(pwd)/.ci/nuget/LightGBM.nuspec \
-NonInteractive \
-Verbosity detailed \
-OutputDirectory "${BUILD_ARTIFACTSTAGINGDIRECTORY}"
- name: Upload artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: nuget-package
path: artifacts/*.nupkg
if-no-files-found: error
test-latest-versions:
name: Python - latest versions (manylinux_2_28)
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 5
persist-credentials: false
submodules: true
- name: Create wheel
run: |
docker run \
--rm \
--env CMAKE_BUILD_PARALLEL_LEVEL=${{ env.CMAKE_BUILD_PARALLEL_LEVEL }} \
-v $(pwd):/opt/lgb-build \
-w /opt/lgb-build \
lightgbm/vsts-agent:manylinux_2_28_x86_64 \
/bin/bash -c 'PATH=/opt/miniforge/bin:$PATH sh ./build-python.sh bdist_wheel --nomp'
- name: Test compatibility
run: |
docker run \
--rm \
-v $(pwd):/opt/lgb-build \
-w /opt/lgb-build \
python:3.14 \
/bin/bash ./.ci/test-python-latest.sh
test-old-versions:
name: Python - oldest supported versions (manylinux_2_28, Python ${{ matrix.python_version }})
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
# This should always include at least the oldest
# not-yet-end-of-life Python version
python_version:
- '3.10'
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 5
persist-credentials: false
submodules: true
- name: Create wheel
run: |
docker run \
--rm \
--env CMAKE_BUILD_PARALLEL_LEVEL=${{ env.CMAKE_BUILD_PARALLEL_LEVEL }} \
-v $(pwd):/opt/lgb-build \
-w /opt/lgb-build \
lightgbm/vsts-agent:manylinux_2_28_x86_64 \
/bin/bash -c 'PATH=/opt/miniforge/bin:$PATH sh ./build-python.sh bdist_wheel --nomp'
- name: Test compatibility
run: |
docker run \
--rm \
-v $(pwd):/opt/lgb-build \
-w /opt/lgb-build \
python:${{ matrix.python_version }} \
/bin/bash ./.ci/test-python-oldest.sh
upload-nightlies:
needs:
- test
- test-linux-aarch64
runs-on: ubuntu-latest
# publish whenever a new commit is pushed to 'main'
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
environment:
name: nightly-python-uploads
url: https://anaconda.org/lightgbm-packages/lightgbm
permissions:
contents: read
id-token: write
steps:
- name: setup
run: |
mkdir -p "${BUILD_ARTIFACTSTAGINGDIRECTORY}"
pip install --prefer-binary \
anaconda-auth \
anaconda-client
- name: download wheels
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
merge-multiple: true
path: ${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}
pattern: '*-wheel'
run-id: ${{ github.run_id }}
- name: download sdists
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: sdist
path: ${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}
run-id: ${{ github.run_id }}
- name: upload to anaconda.org
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN_LIGHTGBM_PACKAGES }}
run: |
anaconda upload \
--package lightgbm \
--force \
-t pypi \
${BUILD_ARTIFACTSTAGINGDIRECTORY}/lightgbm-*.tar.gz \
${BUILD_ARTIFACTSTAGINGDIRECTORY}/*.whl
all-python-package-jobs-successful:
if: always()
runs-on: ubuntu-latest
needs:
- test-latest-versions
- test
- test-linux-aarch64
- test-old-versions
permissions:
statuses: read
steps:
- name: Note that all tests succeeded
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
with:
jobs: ${{ toJSON(needs) }}
+60
View File
@@ -0,0 +1,60 @@
name: R generate configure
on:
workflow_dispatch:
inputs:
pr-branch:
type: string
description: |
Branch in lightgbm-org/LightGBM to update.
# automatically cancel in-progress builds if another commit is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# default to 0 permissions
# (job-level overrides add the minimal permissions needed)
permissions:
contents: none
jobs:
r-configure:
name: r-configure
timeout-minutes: 60
runs-on: ubuntu-latest
container: "ubuntu:22.04"
permissions:
contents: write
id-token: write
pull-requests: read
steps:
- name: Install essential software before checkout
run: |
apt-get update
apt-get install --no-install-recommends -y \
ca-certificates \
git
- name: Trust git cloning LightGBM
run: |
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 5
submodules: false
repository: lightgbm-org/LightGBM
ref: "refs/heads/${{ inputs.pr-branch }}"
token: ${{ github.token }}
persist-credentials: true
- name: Update configure
shell: bash
run: ./R-package/recreate-configure.sh || exit 1
- name: Push changes
run: |
# source for this user and email: https://github.com/orgs/community/discussions/160496
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add "./R-package/configure"
git commit --allow-empty -m "Auto-update configure"
git push
+395
View File
@@ -0,0 +1,395 @@
name: R-package
on:
push:
branches:
- main
pull_request:
branches:
- main
- master
# automatically cancel in-progress builds if another commit is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# default to 0 permissions
# (job-level overrides add the minimal permissions needed)
permissions:
contents: none
env:
# tell scripts where to put artifacts
# (this variable name is left over from when jobs ran on Azure DevOps)
BUILD_ARTIFACTSTAGINGDIRECTORY: '${{ github.workspace }}/artifacts'
# in CMake-driven builds, parallelize compilation
CMAKE_BUILD_PARALLEL_LEVEL: 4
# on Debian-based images, avoid interactive prompts
DEBIAN_FRONTEND: noninteractive
# Fix issues like the following that can show up running 'R CMD check' on
# specific clang versions:
#
# * checking for detritus in the temp directory ... NOTE
# Found the following files/directories:
# dsymutil-63923a dsymutil-9aa721 dsymutil-b7e1bb
#
# These are unlikely to show up in CRAN's checks. They come from
# 'dsymutil ---gen-reproducer' being run (not something LightGBM explicitly does).
#
# ref:
# - https://github.com/llvm/llvm-project/issues/61920
# - https://github.com/golang/go/issues/59026#issuecomment-1520487072
DSYMUTIL_REPRODUCER_PATH: /dev/null
# parallelize compilation (extra important for Linux, where CRAN doesn't supply pre-compiled binaries)
MAKEFLAGS: "-j4"
# hack to get around this:
# https://stat.ethz.ch/pipermail/r-package-devel/2020q3/005930.html
_R_CHECK_SYSTEM_CLOCK_: 0
# ignore R CMD CHECK NOTE checking how long it has
# been since the last submission
_R_CHECK_CRAN_INCOMING_REMOTE_: 0
# CRAN ignores the "installed size is too large" NOTE,
# so our CI can too. Setting to a large value here just
# to catch extreme problems
_R_CHECK_PKG_SIZES_THRESHOLD_: 100
jobs:
test:
# yamllint disable-line rule:line-length
name: ${{ matrix.task }} (${{ matrix.os-display-name || matrix.os }}, ${{ matrix.compiler }}, R ${{ matrix.r_version }}, ${{ matrix.build_type }})
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
timeout-minutes: 60
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
################
# CMake builds #
################
- os: ubuntu-latest
task: r-package
compiler: gcc
r_version: 4.3
build_type: cmake
container: 'ubuntu:22.04'
os-display-name: 'ubuntu22.04'
- os: ubuntu-latest
task: r-package
compiler: clang
r_version: 4.3
build_type: cmake
container: 'ubuntu:22.04'
os-display-name: 'ubuntu22.04'
- os: macos-15-intel
task: r-package
compiler: clang
r_version: 4.3
build_type: cmake
container: null
- os: windows-latest
task: r-package
compiler: MINGW
toolchain: MSYS
r_version: 4.3
build_type: cmake
container: null
# Visual Studio 2022
- os: windows-2022
task: r-package
compiler: MSVC
toolchain: MSVC
r_version: 4.3
build_type: cmake
container: null
###############
# CRAN builds #
###############
- os: windows-latest
task: r-package
compiler: MINGW
toolchain: MSYS
r_version: 4.3
build_type: cran
container: null
- os: ubuntu-latest
task: r-package
compiler: gcc
r_version: 4.3
build_type: cran
container: 'ubuntu:22.04'
os-display-name: 'ubuntu22.04'
produces-artifacts: 'true'
artifact-name: r-cran-package
- os: macos-15-intel
task: r-package
compiler: clang
r_version: 4.3
build_type: cran
container: null
# macos-14 = arm64
- os: macos-14
task: r-package
compiler: clang
r_version: 4.3
build_type: cran
container: null
steps:
- name: Prevent conversion of line endings on Windows
if: startsWith(matrix.os, 'windows')
shell: pwsh
run: git config --global core.autocrlf false
- name: Install packages used by third-party actions
if: startsWith(matrix.os, 'ubuntu')
shell: bash
run: |
apt-get update -y
apt-get install --no-install-recommends -y \
ca-certificates \
dirmngr \
gpg \
gpg-agent \
software-properties-common \
sudo
# install newest version of git
# ref:
# - https://unix.stackexchange.com/a/170831/550004
# - https://git-scm.com/download/linux
add-apt-repository ppa:git-core/ppa -y
apt-get update -y
apt-get install --no-install-recommends -y \
git
- name: Trust git cloning LightGBM
if: startsWith(matrix.os, 'ubuntu')
run: |
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 5
persist-credentials: false
submodules: true
- name: Install pandoc
uses: r-lib/actions/setup-pandoc@a51a8012b0aab7c32ef9d19bf54da93f3254335e # v2.12.0
- name: Install tinytex
if: startsWith(matrix.os, 'windows')
uses: r-lib/actions/setup-tinytex@a51a8012b0aab7c32ef9d19bf54da93f3254335e # v2.12.0
env:
CTAN_MIRROR: https://ctan.math.illinois.edu/systems/win32/miktex
TINYTEX_INSTALLER: TinyTeX
- name: Setup and run tests on Linux and macOS
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
shell: bash
run: |
export TASK="${{ matrix.task }}"
export COMPILER="${{ matrix.compiler }}"
if [[ "${{ matrix.os }}" =~ ^macos ]]; then
export OS_NAME="macos"
elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
export OS_NAME="linux"
export IN_UBUNTU_BASE_CONTAINER="true"
fi
export BUILD_DIRECTORY="$GITHUB_WORKSPACE"
export LGB_VER=$(head -n 1 "${BUILD_DIRECTORY}/VERSION.txt")
export PRODUCES_ARTIFACTS="${{ matrix.produces-artifacts }}"
export R_VERSION="${{ matrix.r_version }}"
export R_BUILD_TYPE="${{ matrix.build_type }}"
$GITHUB_WORKSPACE/.ci/setup.sh
$GITHUB_WORKSPACE/.ci/test.sh
- name: Setup and run tests on Windows
if: startsWith(matrix.os, 'windows')
shell: pwsh -command ". {0}"
run: |
$env:BUILD_SOURCESDIRECTORY = $env:GITHUB_WORKSPACE
$env:LGB_VER = (Get-Content -TotalCount 1 $env:BUILD_SOURCESDIRECTORY\VERSION.txt).trim().replace('rc', '-')
$env:TOOLCHAIN = "${{ matrix.toolchain }}"
$env:R_VERSION = "${{ matrix.r_version }}"
$env:R_BUILD_TYPE = "${{ matrix.build_type }}"
$env:COMPILER = "${{ matrix.compiler }}"
$env:TASK = "${{ matrix.task }}"
& "$env:GITHUB_WORKSPACE/.ci/test-windows.ps1"
- name: Upload artifacts
if: ${{ matrix.produces-artifacts == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ matrix.artifact-name }}
path: ${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}/*.tar.gz
if-no-files-found: error
test-r-sanitizers:
name: r-sanitizers (ubuntu-latest, R-devel, ${{ matrix.compiler }} ASAN/UBSAN)
timeout-minutes: 60
runs-on: ubuntu-latest
container: wch1/r-debug # zizmor: ignore[unpinned-images]
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include:
- r_customization: san
compiler: gcc
- r_customization: csan
compiler: clang
steps:
- name: Trust git cloning LightGBM
run: |
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 5
persist-credentials: false
submodules: true
- name: Install packages
shell: bash
run: |
RDscript${{ matrix.r_customization }} ./.ci/install-r-deps.R --build --test
sh build-cran-package.sh --r-executable=RD${{ matrix.r_customization }}
RD${{ matrix.r_customization }} CMD INSTALL lightgbm_*.tar.gz || exit 1
- name: Run tests with sanitizers
shell: bash
run: |
cd R-package/tests
exit_code=0
RDscript${{ matrix.r_customization }} testthat.R >> tests.log 2>&1 || exit_code=-1
cat ./tests.log
exit ${exit_code}
test-r-extra-checks:
name: r-package (${{ matrix.image }}, R-devel)
timeout-minutes: 60
permissions:
contents: read
strategy:
fail-fast: false
matrix:
# references:
# * CRAN "additional checks": https://cran.r-project.org/web/checks/check_issue_kinds.html
# * images: https://r-hub.github.io/containers/containers.html
#
# Generally, only images that are still supported, listed at
# https://r-hub.github.io/containers/#available-containers, should be used.
image:
- clang21
- clang22
- gcc16
- rchk
- ubuntu-clang
- ubuntu-gcc12
runs-on: ubuntu-latest
container: ghcr.io/r-hub/containers/${{ matrix.image }}:latest # zizmor: ignore[unpinned-images]
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 5
persist-credentials: false
submodules: true
- name: Install pandoc
uses: r-lib/actions/setup-pandoc@a51a8012b0aab7c32ef9d19bf54da93f3254335e # v2.12.0
- name: Install system dependencies
shell: bash
run: |
# libuv is needed for {fs} (https://github.com/lightgbm-org/LightGBM/issues/7208)
if type -f apt 2>&1 > /dev/null; then
apt-get update
apt-get install --no-install-recommends -y \
cmake \
devscripts \
libcurl4-openssl-dev \
libuv1-dev \
texinfo \
texlive-latex-extra \
texlive-latex-recommended \
texlive-fonts-recommended \
texlive-fonts-extra \
tidy \
qpdf
else
yum update -y
yum install -y \
cmake \
devscripts \
libcurl-devel \
libuv-devel \
qpdf \
texinfo \
texinfo-tex \
texlive-amsmath \
texlive-amsfonts \
texlive-collection-fontsrecommended \
texlive-collection-latexrecommended \
texlive-latex \
tidy
fi
- name: Install packages and run tests
shell: bash
run: |
Rscript ./.ci/install-r-deps.R --build --test --exclude=testthat
sh build-cran-package.sh
# 'rchk' isn't run through 'R CMD check', use the approach documented at
# https://r-hub.github.io/containers/local.html
if [[ "${{ matrix.image }}" =~ "rchk" ]]; then
r-check "$(pwd)" \
| tee ./rchk-logs.txt 2>&1
# the '-v' exceptions below are from R/rchk itself and not LightGBM:
# https://github.com/kalibera/rchk/issues/22#issuecomment-656036156
if grep -E '\[PB\]|ERROR' ./rchk-logs.txt \
| grep -v 'too many states' \
> /dev/null; \
then
echo "rchk found issues"
exit 1
else
echo "rchk did not find any issues"
exit 0
fi
fi
# why these packages?
#
# - 'curl' is not a dependency of {lightgbm}, but it's needed for 'R CMD check' URL checks
# - 'testthat' is not needed by 'rchk', so avoid installing it until here
#
Rscript -e "
install.packages(c('curl', 'testthat'),
repos = 'https://cran.rstudio.com',
Ncpus = parallel::detectCores())
"
if [[ "${{ matrix.image }}" =~ "clang" ]]; then
# allowing the following NOTEs (produced by default in the clang images):
#
# * checking compilation flags used ... NOTE
# Compilation used the following non-portable flag(s):
# -Wp,-D_FORTIFY_SOURCE=3
#
# even though CRAN itself sets that:
# https://www.stats.ox.ac.uk/pub/bdr/Rconfig/r-devel-linux-x86_64-fedora-clang
#
declare -i allowed_notes=1
else
declare -i allowed_notes=0
fi
bash .ci/run-r-cmd-check.sh \
"$(echo lightgbm_$(head -1 VERSION.txt).tar.gz)" \
"${allowed_notes}"
all-r-package-jobs-successful:
if: always()
runs-on: ubuntu-latest
needs:
- test
- test-r-sanitizers
- test-r-extra-checks
permissions:
statuses: read
steps:
- name: Note that all tests succeeded
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
with:
jobs: ${{ toJSON(needs) }}
+106
View File
@@ -0,0 +1,106 @@
name: R valgrind tests
# 'run-name' is used here to distinguish in the API between different runs from forks.
#
# When this was added, it was the only way to feed workflow inputs into something that
# would show up in the output of 'gh run list'.
#
# See https://github.com/orgs/community/discussions/73223#discussioncomment-11862624
run-name: R valgrind tests (pr=${{ inputs.pr-number }})
# automatically cancel in-progress builds if another commit is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# default to 0 permissions
# (job-level overrides add the minimal permissions needed)
permissions:
contents: none
on:
workflow_dispatch:
inputs:
pr-branch:
type: string
description: |
Branch the PR was submitted from.
Branches from forks should be prefixed with the user/org they originate from,
like '{user}:{branch}'.
pr-number:
type: string
description: Pull request ID, found in the PR URL.
jobs:
test-r-valgrind:
name: r-package (ubuntu-latest, R-devel, valgrind)
timeout-minutes: 360
runs-on: ubuntu-latest
container: wch1/r-debug # zizmor: ignore[unpinned-images]
env:
GITHUB_TOKEN: ${{ github.token }}
permissions:
actions: write
checks: write
contents: read
id-token: write
pull-requests: write
statuses: write
steps:
- name: Install essential software before checkout
shell: bash
run: |
apt-get update
apt-get install --no-install-recommends -y \
curl \
jq
- name: Install GitHub CLI
run: |
GH_CLI_VERSION="2.83.0"
curl \
--fail \
-O \
-L \
https://github.com/cli/cli/releases/download/v${GH_CLI_VERSION}/gh_${GH_CLI_VERSION}_linux_amd64.tar.gz
tar -xvf ./gh_${GH_CLI_VERSION}_linux_amd64.tar.gz
mv ./gh_${GH_CLI_VERSION}_linux_amd64/bin/gh /usr/local/bin/
- name: Trust git cloning LightGBM
run: |
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 5
submodules: true
persist-credentials: false
repository: lightgbm-org/LightGBM
ref: "refs/pull/${{ inputs.pr-number }}/merge"
- name: Run tests with valgrind
shell: bash
run: ./.ci/test-r-package-valgrind.sh
- name: Send final status
if: ${{ always() }}
env:
GITHUB__WORKFLOW: ${{ github.workflow }}
INPUTS__PR_NUMBER: ${{ inputs.pr-number }}
JOB__STATUS: ${{ job.status }}
run: |
$GITHUB_WORKSPACE/.ci/set-commit-status.sh \
"${GITHUB_WORKFLOW}" \
"${JOB__STATUS}" \
"${{ github.sha }}"
comment="Workflow **${GITHUB__WORKFLOW}** has been triggered! 🚀\r\n"
comment="${comment}\r\n${GITHUB_SERVER_URL}/lightgbm-org/LightGBM/actions/runs/${GITHUB_RUN_ID} \r\n"
comment="${comment}\r\nStatus: ${JOB__STATUS}"
$GITHUB_WORKSPACE/.ci/append-comment.sh \
"${INPUTS__PR_NUMBER}" \
"${comment}"
- name: Rerun workflow-indicator
if: ${{ always() }}
env:
INPUTS__PR_BRANCH: ${{ inputs.pr-branch }}
run: |
bash $GITHUB_WORKSPACE/.ci/rerun-workflow.sh \
"optional_checks.yml" \
"${INPUTS__PR_BRANCH}" \
|| true
+29
View File
@@ -0,0 +1,29 @@
name: Release Drafter
on:
push:
branches:
- main
# only 1 job running in the repo at any time
concurrency:
group: lock
# default to 0 permissions
# (job-level overrides add the minimal permissions needed)
permissions:
contents: none
jobs:
updateReleaseDraft:
permissions:
contents: write
pull-requests: read
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@ed4bc48ec97379be2258e7b7ac2624a3e26ab809 # v7.4.0
with:
config-name: release-drafter.yml
disable-autolabeler: true
env:
GITHUB_TOKEN: ${{ github.token }}
+122
View File
@@ -0,0 +1,122 @@
# contains non-functional tests, like checks on docs
# and code style
name: Static Analysis
on:
push:
branches:
- main
pull_request:
branches:
- main
- master
# automatically cancel in-progress builds if another commit is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# default to 0 permissions
# (job-level overrides add the minimal permissions needed)
permissions:
contents: none
env:
COMPILER: 'gcc'
MAKEFLAGS: '-j4'
OS_NAME: 'linux'
jobs:
lint:
name: lint
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 5
persist-credentials: false
submodules: false
- name: Setup and run tests
shell: bash
run: |
export TASK=lint
export CONDA=${HOME}/miniforge
export PATH=${CONDA}/bin:$HOME/.local/bin:${PATH}
$GITHUB_WORKSPACE/.ci/setup.sh || exit 1
$GITHUB_WORKSPACE/.ci/lint-all.sh || exit 1
check-docs:
name: check-docs
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 5
persist-credentials: false
submodules: true
- name: Setup and run tests
shell: bash
run: |
export TASK=check-docs
export CONDA=${HOME}/miniforge
export PATH=${CONDA}/bin:$HOME/.local/bin:${PATH}
$GITHUB_WORKSPACE/.ci/setup.sh || exit 1
$GITHUB_WORKSPACE/.ci/build-docs.sh || exit 1
r-check-docs:
name: r-package-check-docs
timeout-minutes: 60
runs-on: ubuntu-latest
container: rocker/verse # zizmor: ignore[unpinned-images]
permissions:
contents: read
steps:
- name: Trust git cloning LightGBM
run: |
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 5
persist-credentials: false
submodules: true
- name: Install packages
shell: bash
run: |
Rscript ./.ci/install-r-deps.R --build --include=roxygen2
sh build-cran-package.sh || exit 1
R CMD INSTALL --with-keep.source lightgbm_*.tar.gz || exit 1
- name: Test documentation
shell: bash --noprofile --norc {0}
run: |
Rscript .ci/build-docs.R || exit 1
num_doc_files_changed=$(
git diff --name-only | grep --count -E "\.Rd|NAMESPACE"
)
if [[ ${num_doc_files_changed} -gt 0 ]]; then
echo "Some R documentation files have changed. Please re-generate them and commit those changes."
echo ""
echo " sh build-cran-package.sh"
echo " R CMD INSTALL --with-keep.source lightgbm_*.tar.gz"
echo " Rscript -e \"roxygen2::roxygenize('R-package/', load = 'installed')\""
echo ""
exit 1
fi
all-static-analysis-jobs-successful:
if: always()
runs-on: ubuntu-latest
needs:
- lint
- check-docs
- r-check-docs
permissions:
statuses: read
steps:
- name: Note that all tests succeeded
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
with:
jobs: ${{ toJSON(needs) }}
+106
View File
@@ -0,0 +1,106 @@
name: SWIG
on:
push:
branches:
- main
pull_request:
branches:
- main
- master
# automatically cancel in-progress builds if another commit is pushed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# default to 0 permissions
# (job-level overrides add the minimal permissions needed)
permissions:
contents: none
env:
# tell scripts where to put artifacts
# (this variable name is left over from when jobs ran on Azure DevOps)
BUILD_ARTIFACTSTAGINGDIRECTORY: '${{ github.workspace }}/artifacts'
# in CMake-driven builds, parallelize compilation
CMAKE_BUILD_PARALLEL_LEVEL: 4
# all SWIG jobs produce artifacts
PRODUCES_ARTIFACTS: 'true'
# all jobs here have the same 'TASK'
TASK: swig
jobs:
test-swig:
name: swig (${{ matrix.os-display-name || matrix.os }}, ${{ matrix.compiler }})
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
timeout-minutes: 60
permissions:
contents: write
id-token: write
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
compiler: gcc
container: 'ghcr.io/lightgbm-org/lightgbm-vsts-agent:manylinux_2_28_x86_64'
artifact-name: swig-linux-x86_64-jar
os-display-name: 'manylinux_2_28'
- os: macos-15-intel
compiler: clang
container: null
artifact-name: swig-macos-x86_64-jar
# Visual Studio 2022
- os: windows-2022
compiler: msvc
container: null
artifact-name: swig-windows-x86_64-jar
steps:
- name: Checkout repository
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
fetch-depth: 5
persist-credentials: false
submodules: true
- name: Setup and run tests on Linux and macOS
if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu')
shell: bash
run: |
export BUILD_DIRECTORY="${GITHUB_WORKSPACE}"
export COMPILER="${{ matrix.compiler }}"
export CONDA="${HOME}/miniforge"
export PATH=${CONDA}/bin:${PATH}
if [[ "${{ matrix.os }}" =~ ^macos ]]; then
export OS_NAME="macos"
elif [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
export OS_NAME="linux"
fi
$GITHUB_WORKSPACE/.ci/setup.sh
$GITHUB_WORKSPACE/.ci/test.sh
- name: Setup and run tests on Windows
if: startsWith(matrix.os, 'windows')
shell: pwsh -command ". {0}"
run: |
$env:BUILD_DIRECTORY = $env:GITHUB_WORKSPACE
$env:BUILD_SOURCESDIRECTORY = $env:BUILD_DIRECTORY
& "$env:GITHUB_WORKSPACE/.ci/test-windows.ps1"
- name: Upload artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ matrix.artifact-name }}
path: ${{ env.BUILD_ARTIFACTSTAGINGDIRECTORY }}/*.jar
if-no-files-found: error
all-swig-jobs-successful:
if: always()
runs-on: ubuntu-latest
needs:
- test-swig
permissions:
statuses: read
steps:
- name: Note that all tests succeeded
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
with:
jobs: ${{ toJSON(needs) }}