From 4e037766f0a52696b74fed93a73ca73a7a819b47 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Mon, 27 Jan 2025 23:03:32 +0300 Subject: [PATCH 01/10] ci/yamlint-4 --- .github/workflows/static_analysis.yml | 93 ++++++++++++++------------- .yamllint.yml | 2 +- 2 files changed, 48 insertions(+), 47 deletions(-) diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index 3cf579f0707e..b8e865b6a995 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -6,6 +6,7 @@ on: push: branches: - master + - ci/yamlint-4 pull_request: branches: - master @@ -31,7 +32,7 @@ jobs: matrix: include: - task: lint - - task: check-docs + # - task: check-docs steps: - name: Checkout repository uses: actions/checkout@v4 @@ -47,48 +48,48 @@ jobs: export PATH=${CONDA}/bin:$HOME/.local/bin:${PATH} $GITHUB_WORKSPACE/.ci/setup.sh || exit 1 $GITHUB_WORKSPACE/.ci/test.sh || exit 1 - r-check-docs: - name: r-package-check-docs - timeout-minutes: 60 - runs-on: ubuntu-latest - container: rocker/verse - steps: - - name: Trust git cloning LightGBM - run: | - git config --global --add safe.directory "${GITHUB_WORKSPACE}" - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 5 - submodules: true - - name: Install packages - shell: bash - run: | - Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'RhpcBLASctl', 'roxygen2', 'testthat'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" - 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 --vanilla -e "roxygen2::roxygenize('R-package/', load = 'installed')" || 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: [test, r-check-docs] - steps: - - name: Note that all tests succeeded - uses: re-actors/alls-green@v1.2.2 - with: - jobs: ${{ toJSON(needs) }} + # r-check-docs: + # name: r-package-check-docs + # timeout-minutes: 60 + # runs-on: ubuntu-latest + # container: rocker/verse + # steps: + # - name: Trust git cloning LightGBM + # run: | + # git config --global --add safe.directory "${GITHUB_WORKSPACE}" + # - name: Checkout repository + # uses: actions/checkout@v4 + # with: + # fetch-depth: 5 + # submodules: true + # - name: Install packages + # shell: bash + # run: | + # Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'RhpcBLASctl', 'roxygen2', 'testthat'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" + # 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 --vanilla -e "roxygen2::roxygenize('R-package/', load = 'installed')" || 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: [test, r-check-docs] + # steps: + # - name: Note that all tests succeeded + # uses: re-actors/alls-green@v1.2.2 + # with: + # jobs: ${{ toJSON(needs) }} diff --git a/.yamllint.yml b/.yamllint.yml index aab153ab95c1..7bb0ae95ec74 100644 --- a/.yamllint.yml +++ b/.yamllint.yml @@ -4,7 +4,7 @@ extends: default rules: document-start: disable line-length: - max: 999 # temporarily increase allowed line length + max: 120 truthy: # prevent treating GitHub Workflow "on" key as boolean value check-keys: false From 8c3c3deb5a72444d00fb8b84309af718157b572d Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Mon, 27 Jan 2025 23:27:57 +0300 Subject: [PATCH 02/10] dev --- .github/workflows/cuda.yml | 8 +++++-- .github/workflows/lock.yml | 15 ++++++++---- .github/workflows/no_response.yml | 11 ++++++--- .github/workflows/optional_checks.yml | 6 ++--- .github/workflows/r_package.yml | 9 +++++-- .github/workflows/r_valgrind.yml | 14 ++++++++--- .github/workflows/static_analysis.yml | 3 ++- .github/workflows/triggering_comments.yml | 5 +++- .vsts-ci.yml | 29 +++++++++++++++++++---- 9 files changed, 76 insertions(+), 24 deletions(-) diff --git a/.github/workflows/cuda.yml b/.github/workflows/cuda.yml index 0a483b01e56c..1b1c10a7d556 100644 --- a/.github/workflows/cuda.yml +++ b/.github/workflows/cuda.yml @@ -43,9 +43,12 @@ jobs: software-properties-common # set up nvidia-docker curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" -y + sudo add-apt-repository -y \ + "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" curl -sL https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - - curl -sL https://nvidia.github.io/nvidia-docker/$(. /etc/os-release;echo $ID$VERSION_ID)/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list + curl -sL \ + https://nvidia.github.io/nvidia-docker/$(. /etc/os-release;echo $ID$VERSION_ID)/nvidia-docker.list \ + | sudo tee /etc/apt/sources.list.d/nvidia-docker.list sudo apt-get update sudo apt-get install --no-install-recommends -y \ containerd.io \ @@ -58,6 +61,7 @@ jobs: run: | exit 0 test: + # yamllint disable-line rule:line-length name: ${{ matrix.task }} ${{ matrix.cuda_version }} ${{ matrix.method }} (${{ matrix.linux_version }}, ${{ matrix.compiler }}, Python ${{ matrix.python_version }}) runs-on: [self-hosted, linux] needs: [restart-docker] diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml index 2286a82d62d1..112eef758532 100644 --- a/.github/workflows/lock.yml +++ b/.github/workflows/lock.yml @@ -34,13 +34,18 @@ jobs: 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/microsoft/LightGBM/issues + 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/microsoft/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/microsoft/LightGBM/issues - including a reference to this. + 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/microsoft/LightGBM/issues. # what should the locking status be? issue-lock-reason: 'resolved' pr-lock-reason: 'resolved' diff --git a/.github/workflows/no_response.yml b/.github/workflows/no_response.yml index 1994f53d7bc7..4f07c8b40689 100644 --- a/.github/workflows/no_response.yml +++ b/.github/workflows/no_response.yml @@ -18,9 +18,14 @@ jobs: - uses: lee-dohm/no-response@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. + 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 diff --git a/.github/workflows/optional_checks.yml b/.github/workflows/optional_checks.yml index f794c38e770c..0ce8f135a540 100644 --- a/.github/workflows/optional_checks.yml +++ b/.github/workflows/optional_checks.yml @@ -22,8 +22,8 @@ jobs: ) for i in "${workflows[@]}"; do workflow_name=${i%;*} + comment="The last reported status from workflow \"$workflow_name\" is failure." + comment+=" Commit fixes and rerun the workflow." trigger_phrase=${i#*;} python "$GITHUB_WORKSPACE/.ci/get-workflow-status.py" "$trigger_phrase" \ - || { echo "The last reported status from workflow \"$workflow_name\" is failure. Commit fixes and rerun the workflow."; \ - exit 1; } - done + || { echo ${comment}; exit 1; } diff --git a/.github/workflows/r_package.yml b/.github/workflows/r_package.yml index a168da086cfa..6780a3ba46f4 100644 --- a/.github/workflows/r_package.yml +++ b/.github/workflows/r_package.yml @@ -47,6 +47,7 @@ env: jobs: test: + # yamllint disable-line rule:line-length name: ${{ matrix.task }} (${{ matrix.os }}, ${{ matrix.compiler }}, R ${{ matrix.r_version }}, ${{ matrix.build_type }}) runs-on: ${{ matrix.os }} container: ${{ matrix.container }} @@ -244,7 +245,9 @@ jobs: - name: Install packages shell: bash run: | - RDscript${{ matrix.r_customization }} -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'RhpcBLASctl', 'testthat'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" + R_LIBS="c('R6', 'data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'RhpcBLASctl', 'testthat')" + RDscript${{ matrix.r_customization }} \ + -e "install.packages(${R_LIBS}, repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" 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 @@ -309,7 +312,9 @@ jobs: - name: Install packages and run tests shell: bash run: | - Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'RhpcBLASctl'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" + R_LIBS="c('R6', 'data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'RhpcBLASctl')" + Rscript \ + -e "install.packages(${R_LIBS}, repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" sh build-cran-package.sh # 'rchk' isn't run through 'R CMD check', use the approach documented at diff --git a/.github/workflows/r_valgrind.yml b/.github/workflows/r_valgrind.yml index 8593831eed56..961fe20942cb 100644 --- a/.github/workflows/r_valgrind.yml +++ b/.github/workflows/r_valgrind.yml @@ -33,17 +33,25 @@ jobs: - name: Send init status if: ${{ always() }} run: | - $GITHUB_WORKSPACE/.ci/set-commit-status.sh "${{ github.workflow }}" "pending" "${{ github.event.client_payload.pr_sha }}" + $GITHUB_WORKSPACE/.ci/set-commit-status.sh \ + "${{ github.workflow }}" \ + "pending" \ + "${{ github.event.client_payload.pr_sha }}" + comment="Workflow **${{ github.workflow }}** has been triggered! 🚀\r\n" + comment+="${GITHUB_SERVER_URL}/microsoft/LightGBM/actions/runs/${GITHUB_RUN_ID}" $GITHUB_WORKSPACE/.ci/append-comment.sh \ "${{ github.event.client_payload.comment_number }}" \ - "Workflow **${{ github.workflow }}** has been triggered! 🚀\r\n${GITHUB_SERVER_URL}/microsoft/LightGBM/actions/runs/${GITHUB_RUN_ID}" + "${comment}" - name: Run tests with valgrind shell: bash run: ./.ci/test-r-package-valgrind.sh - name: Send final status if: ${{ always() }} run: | - $GITHUB_WORKSPACE/.ci/set-commit-status.sh "${{ github.workflow }}" "${{ job.status }}" "${{ github.event.client_payload.pr_sha }}" + $GITHUB_WORKSPACE/.ci/set-commit-status.sh \ + "${{ github.workflow }}" \ + "${{ job.status }}" \ + "${{ github.event.client_payload.pr_sha }}" $GITHUB_WORKSPACE/.ci/append-comment.sh \ "${{ github.event.client_payload.comment_number }}" \ "Status: ${{ job.status }}." diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index b8e865b6a995..23263f51ab43 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -65,7 +65,8 @@ jobs: # - name: Install packages # shell: bash # run: | - # Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'RhpcBLASctl', 'roxygen2', 'testthat'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" + # # yamllint disable-line rule:line-length + # Rscript -e "install.packages(${R_LIBS}, repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" # sh build-cran-package.sh || exit 1 # R CMD INSTALL --with-keep.source lightgbm_*.tar.gz || exit 1 # - name: Test documentation diff --git a/.github/workflows/triggering_comments.yml b/.github/workflows/triggering_comments.yml index 1b5ea706fb91..452d487c42e5 100644 --- a/.github/workflows/triggering_comments.yml +++ b/.github/workflows/triggering_comments.yml @@ -6,7 +6,10 @@ on: jobs: triggering-tests: - if: github.event.issue.pull_request && contains('OWNER,MEMBER,COLLABORATOR', github.event.comment.author_association) && startsWith(github.event.comment.body, '/gha run') + if: | + github.event.issue.pull_request && + contains('OWNER,MEMBER,COLLABORATOR', github.event.comment.author_association) && + startsWith(github.event.comment.body, '/gha run') runs-on: ubuntu-latest env: SECRETS_WORKFLOW: ${{ secrets.WORKFLOW }} diff --git a/.vsts-ci.yml b/.vsts-ci.yml index 0d457a57cbef..6bcdc05f34f9 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -137,7 +137,12 @@ jobs: filePath: $(Build.SourcesDirectory)/.ci/test.sh targetType: filePath - task: PublishBuildArtifacts@1 - condition: and(succeeded(), in(variables['TASK'], 'regular', 'sdist', 'bdist', 'swig'), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) + condition: > + and( + succeeded(), + in(variables['TASK'], 'regular', 'sdist', 'bdist', 'swig'), + not(startsWith(variables['Build.SourceBranch'], 'refs/pull/')) + ) inputs: pathtoPublish: '$(Build.ArtifactStagingDirectory)' artifactName: PackageAssets @@ -279,7 +284,12 @@ jobs: /bin/bash $BUILD_DIRECTORY/docker-script.sh displayName: 'Setup and run tests' - task: PublishBuildArtifacts@1 - condition: and(succeeded(), in(variables['TASK'], 'bdist'), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) + condition: > + and( + succeeded(), + in(variables['TASK'], 'bdist'), + not(startsWith(variables['Build.SourceBranch'], 'refs/pull/')) + ) inputs: pathtoPublish: '$(Build.ArtifactStagingDirectory)' artifactName: PackageAssets @@ -332,7 +342,12 @@ jobs: filePath: $(Build.SourcesDirectory)/.ci/test.sh targetType: filePath - task: PublishBuildArtifacts@1 - condition: and(succeeded(), in(variables['TASK'], 'regular', 'bdist', 'swig'), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) + condition: > + and( + succeeded(), + in(variables['TASK'], 'regular', 'bdist', 'swig'), + not(startsWith(variables['Build.SourceBranch'], 'refs/pull/')) + ) inputs: pathtoPublish: '$(Build.ArtifactStagingDirectory)' artifactName: PackageAssets @@ -377,7 +392,12 @@ jobs: cmd /c "powershell -ExecutionPolicy Bypass -File %BUILD_SOURCESDIRECTORY%/.ci/test-windows.ps1" displayName: Test - task: PublishBuildArtifacts@1 - condition: and(succeeded(), in(variables['TASK'], 'regular', 'bdist', 'swig'), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/'))) + condition: > + and( + succeeded(), + in(variables['TASK'], 'regular', 'bdist', 'swig'), + not(startsWith(variables['Build.SourceBranch'], 'refs/pull/')) + ) inputs: pathtoPublish: '$(Build.ArtifactStagingDirectory)' artifactName: PackageAssets @@ -399,6 +419,7 @@ jobs: R_LIB_PATH=~/Rlib export R_LIBS=${R_LIB_PATH} mkdir -p ${R_LIB_PATH} + # yamllint disable-line rule:line-length RDscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'RhpcBLASctl'), lib = '${R_LIB_PATH}', dependencies = c('Depends', 'Imports', 'LinkingTo'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" || exit 1 sh build-cran-package.sh --r-executable=RD || exit 1 mv lightgbm_${LGB_VER}.tar.gz $(Build.ArtifactStagingDirectory)/lightgbm-${LGB_VER}-r-cran.tar.gz From 1381428bacd1deeb7552396852901fa70cee2e59 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Tue, 28 Jan 2025 00:09:57 +0300 Subject: [PATCH 03/10] dev --- .github/workflows/static_analysis.yml | 2 +- .vsts-ci.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index 23263f51ab43..c1b19c02fb1e 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -64,8 +64,8 @@ jobs: # submodules: true # - name: Install packages # shell: bash + # # yamllint disable-line rule:line-length # run: | - # # yamllint disable-line rule:line-length # Rscript -e "install.packages(${R_LIBS}, repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" # sh build-cran-package.sh || exit 1 # R CMD INSTALL --with-keep.source lightgbm_*.tar.gz || exit 1 diff --git a/.vsts-ci.yml b/.vsts-ci.yml index 6bcdc05f34f9..4ee52a0094d5 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -414,12 +414,12 @@ jobs: - script: | git clean -d -f -x displayName: 'Clean source directory' + # yamllint disable-line rule:line-length - script: | LGB_VER=$(head -n 1 VERSION.txt | sed "s/rc/-/g") R_LIB_PATH=~/Rlib export R_LIBS=${R_LIB_PATH} mkdir -p ${R_LIB_PATH} - # yamllint disable-line rule:line-length RDscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'RhpcBLASctl'), lib = '${R_LIB_PATH}', dependencies = c('Depends', 'Imports', 'LinkingTo'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" || exit 1 sh build-cran-package.sh --r-executable=RD || exit 1 mv lightgbm_${LGB_VER}.tar.gz $(Build.ArtifactStagingDirectory)/lightgbm-${LGB_VER}-r-cran.tar.gz From 33fc9ac9b2fdc344b39ede906194c9d8bf651554 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Tue, 28 Jan 2025 00:17:12 +0300 Subject: [PATCH 04/10] dev --- .vsts-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vsts-ci.yml b/.vsts-ci.yml index 4ee52a0094d5..ffb61b07f8d6 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -414,8 +414,8 @@ jobs: - script: | git clean -d -f -x displayName: 'Clean source directory' - # yamllint disable-line rule:line-length - script: | + # yamllint disable-line rule:line-length LGB_VER=$(head -n 1 VERSION.txt | sed "s/rc/-/g") R_LIB_PATH=~/Rlib export R_LIBS=${R_LIB_PATH} From bb158b8b142b2131849f2d2f728a23aa037be3cc Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Tue, 28 Jan 2025 00:21:52 +0300 Subject: [PATCH 05/10] dev --- .github/workflows/static_analysis.yml | 3 ++- .vsts-ci.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index c1b19c02fb1e..60f9222969f1 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -64,11 +64,12 @@ jobs: # submodules: true # - name: Install packages # shell: bash - # # yamllint disable-line rule:line-length + # # yamllint disable rule:line-length # run: | # Rscript -e "install.packages(${R_LIBS}, repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" # sh build-cran-package.sh || exit 1 # R CMD INSTALL --with-keep.source lightgbm_*.tar.gz || exit 1 + # # yamllint enable rule:line-length # - name: Test documentation # shell: bash --noprofile --norc {0} # run: | diff --git a/.vsts-ci.yml b/.vsts-ci.yml index ffb61b07f8d6..6248dd66177f 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -414,8 +414,8 @@ jobs: - script: | git clean -d -f -x displayName: 'Clean source directory' + # yamllint disable rule:line-length - script: | - # yamllint disable-line rule:line-length LGB_VER=$(head -n 1 VERSION.txt | sed "s/rc/-/g") R_LIB_PATH=~/Rlib export R_LIBS=${R_LIB_PATH} @@ -423,6 +423,7 @@ jobs: RDscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'RhpcBLASctl'), lib = '${R_LIB_PATH}', dependencies = c('Depends', 'Imports', 'LinkingTo'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" || exit 1 sh build-cran-package.sh --r-executable=RD || exit 1 mv lightgbm_${LGB_VER}.tar.gz $(Build.ArtifactStagingDirectory)/lightgbm-${LGB_VER}-r-cran.tar.gz + # yamllint enable rule:line-length displayName: 'Build CRAN R-package' - task: PublishBuildArtifacts@1 condition: succeeded() From e92ba4b8a7fa8d05d889a241d0b84a227b6f343c Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Tue, 28 Jan 2025 00:24:49 +0300 Subject: [PATCH 06/10] dev --- .github/workflows/static_analysis.yml | 96 +++++++++++++-------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index 60f9222969f1..f1ced2587e94 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -32,7 +32,7 @@ jobs: matrix: include: - task: lint - # - task: check-docs + - task: check-docs steps: - name: Checkout repository uses: actions/checkout@v4 @@ -48,50 +48,50 @@ jobs: export PATH=${CONDA}/bin:$HOME/.local/bin:${PATH} $GITHUB_WORKSPACE/.ci/setup.sh || exit 1 $GITHUB_WORKSPACE/.ci/test.sh || exit 1 - # r-check-docs: - # name: r-package-check-docs - # timeout-minutes: 60 - # runs-on: ubuntu-latest - # container: rocker/verse - # steps: - # - name: Trust git cloning LightGBM - # run: | - # git config --global --add safe.directory "${GITHUB_WORKSPACE}" - # - name: Checkout repository - # uses: actions/checkout@v4 - # with: - # fetch-depth: 5 - # submodules: true - # - name: Install packages - # shell: bash - # # yamllint disable rule:line-length - # run: | - # Rscript -e "install.packages(${R_LIBS}, repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" - # sh build-cran-package.sh || exit 1 - # R CMD INSTALL --with-keep.source lightgbm_*.tar.gz || exit 1 - # # yamllint enable rule:line-length - # - name: Test documentation - # shell: bash --noprofile --norc {0} - # run: | - # Rscript --vanilla -e "roxygen2::roxygenize('R-package/', load = 'installed')" || 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: [test, r-check-docs] - # steps: - # - name: Note that all tests succeeded - # uses: re-actors/alls-green@v1.2.2 - # with: - # jobs: ${{ toJSON(needs) }} + r-check-docs: + name: r-package-check-docs + timeout-minutes: 60 + runs-on: ubuntu-latest + container: rocker/verse + steps: + - name: Trust git cloning LightGBM + run: | + git config --global --add safe.directory "${GITHUB_WORKSPACE}" + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 5 + submodules: true + - name: Install packages + shell: bash + # yamllint disable rule:line-length + run: | + Rscript -e "install.packages(${R_LIBS}, repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" + sh build-cran-package.sh || exit 1 + R CMD INSTALL --with-keep.source lightgbm_*.tar.gz || exit 1 + # yamllint enable rule:line-length + - name: Test documentation + shell: bash --noprofile --norc {0} + run: | + Rscript --vanilla -e "roxygen2::roxygenize('R-package/', load = 'installed')" || 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: [test, r-check-docs] + steps: + - name: Note that all tests succeeded + uses: re-actors/alls-green@v1.2.2 + with: + jobs: ${{ toJSON(needs) }} From b5ca1d13f901d4b86a661715860b55d4e2bd2f85 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Tue, 28 Jan 2025 00:38:09 +0300 Subject: [PATCH 07/10] dev --- .github/workflows/static_analysis.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index f1ced2587e94..69b5b8df004d 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -6,7 +6,6 @@ on: push: branches: - master - - ci/yamlint-4 pull_request: branches: - master @@ -66,7 +65,7 @@ jobs: shell: bash # yamllint disable rule:line-length run: | - Rscript -e "install.packages(${R_LIBS}, repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" + Rscript -e "install.packages(c('R6', 'data.table', 'jsonlite', 'knitr', 'markdown', 'Matrix', 'RhpcBLASctl', 'roxygen2', 'testthat'), repos = 'https://cran.rstudio.com', Ncpus = parallel::detectCores())" sh build-cran-package.sh || exit 1 R CMD INSTALL --with-keep.source lightgbm_*.tar.gz || exit 1 # yamllint enable rule:line-length From 495b70304ff22310cdef4ca75a162bf16e075250 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Tue, 28 Jan 2025 05:09:19 +0300 Subject: [PATCH 08/10] Update optional_checks.yml --- .github/workflows/optional_checks.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/optional_checks.yml b/.github/workflows/optional_checks.yml index 0ce8f135a540..f18786f98ef6 100644 --- a/.github/workflows/optional_checks.yml +++ b/.github/workflows/optional_checks.yml @@ -25,5 +25,8 @@ jobs: comment="The last reported status from workflow \"$workflow_name\" is failure." comment+=" Commit fixes and rerun the workflow." trigger_phrase=${i#*;} - python "$GITHUB_WORKSPACE/.ci/get-workflow-status.py" "$trigger_phrase" \ + python \ + "$GITHUB_WORKSPACE/.ci/get-workflow-status.py" \ + "$trigger_phrase" \ || { echo ${comment}; exit 1; } + done From 955b3180ae489287b128a4e60d19c116152a0087 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Tue, 28 Jan 2025 23:14:55 +0300 Subject: [PATCH 09/10] Update lock.yml --- .github/workflows/lock.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml index 112eef758532..41ed74f31ff4 100644 --- a/.github/workflows/lock.yml +++ b/.github/workflows/lock.yml @@ -45,7 +45,8 @@ jobs: 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/microsoft/LightGBM/issues. + open a new issue at https://github.com/microsoft/LightGBM/issues + including a reference to this. # what should the locking status be? issue-lock-reason: 'resolved' pr-lock-reason: 'resolved' From 5dceac8eabd69c130da3cbbe2bcfebdeab374b25 Mon Sep 17 00:00:00 2001 From: Nikita Titov Date: Tue, 28 Jan 2025 23:17:49 +0300 Subject: [PATCH 10/10] Update optional_checks.yml --- .github/workflows/optional_checks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/optional_checks.yml b/.github/workflows/optional_checks.yml index f18786f98ef6..7c26d97bdeab 100644 --- a/.github/workflows/optional_checks.yml +++ b/.github/workflows/optional_checks.yml @@ -28,5 +28,5 @@ jobs: python \ "$GITHUB_WORKSPACE/.ci/get-workflow-status.py" \ "$trigger_phrase" \ - || { echo ${comment}; exit 1; } + || { echo "${comment}"; exit 1; } done