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..41ed74f31ff4 100644 --- a/.github/workflows/lock.yml +++ b/.github/workflows/lock.yml @@ -34,12 +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 + 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. # what should the locking status be? issue-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..7c26d97bdeab 100644 --- a/.github/workflows/optional_checks.yml +++ b/.github/workflows/optional_checks.yml @@ -22,8 +22,11 @@ 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; } + python \ + "$GITHUB_WORKSPACE/.ci/get-workflow-status.py" \ + "$trigger_phrase" \ + || { echo "${comment}"; exit 1; } done 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 3cf579f0707e..69b5b8df004d 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -63,10 +63,12 @@ jobs: submodules: true - name: Install packages shell: bash + # yamllint disable rule:line-length 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 + # yamllint enable rule:line-length - name: Test documentation shell: bash --noprofile --norc {0} run: | 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..6248dd66177f 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 @@ -394,6 +414,7 @@ jobs: - script: | git clean -d -f -x displayName: 'Clean source directory' + # yamllint disable rule:line-length - script: | LGB_VER=$(head -n 1 VERSION.txt | sed "s/rc/-/g") R_LIB_PATH=~/Rlib @@ -402,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() 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