Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE][ci] add yaml files linter to pre-commit hook #6758

Draft
wants to merge 40 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
46d1536
Update static_analysis.yml
StrikerRUS Dec 15, 2024
3127b53
Update .pre-commit-config.yaml
StrikerRUS Dec 15, 2024
959aa10
Update .pre-commit-config.yaml
StrikerRUS Dec 15, 2024
fc847ab
Update .pre-commit-config.yaml
StrikerRUS Dec 15, 2024
d8eed0e
Update .pre-commit-config.yaml
StrikerRUS Dec 15, 2024
58bd0f2
Update .pre-commit-config.yaml
StrikerRUS Dec 15, 2024
df67352
Update .pre-commit-config.yaml
StrikerRUS Dec 15, 2024
7256a4d
Update .pre-commit-config.yaml
StrikerRUS Dec 15, 2024
bd7dc23
Update .pre-commit-config.yaml
StrikerRUS Dec 15, 2024
4b55c65
Update .pre-commit-config.yaml
StrikerRUS Dec 15, 2024
e166ff9
Create .yamllint.yml
StrikerRUS Dec 15, 2024
200f910
Update .yamllint.yml
StrikerRUS Dec 15, 2024
efe3a17
Update .yamllint.yml
StrikerRUS Dec 15, 2024
038b067
Update .yamllint.yml
StrikerRUS Dec 15, 2024
a83a5c6
Update .yamllint.yml
StrikerRUS Dec 15, 2024
23a021b
Update lock.yml
StrikerRUS Dec 15, 2024
eb5c2b1
Update .yamllint.yml
StrikerRUS Dec 15, 2024
9970292
Update lock.yml
StrikerRUS Dec 15, 2024
c25e46c
Update triggering_comments.yml
StrikerRUS Dec 15, 2024
f62cc0e
Update static_analysis.yml
StrikerRUS Dec 15, 2024
83e943c
Update static_analysis.yml
StrikerRUS Dec 15, 2024
e0350b5
Update static_analysis.yml
StrikerRUS Dec 15, 2024
b91f372
Update r_valgrind.yml
StrikerRUS Dec 15, 2024
16d3849
Update python_package.yml
StrikerRUS Dec 15, 2024
022948f
Update cuda.yml
StrikerRUS Dec 15, 2024
ca5bf6f
Update optional_checks.yml
StrikerRUS Dec 15, 2024
24e97e8
Update r_package.yml
StrikerRUS Dec 15, 2024
a71678b
Update no-response.yml
StrikerRUS Dec 15, 2024
32c5f2d
Update _pkgdown.yml
StrikerRUS Dec 15, 2024
b1611c4
Update r_valgrind.yml
StrikerRUS Dec 15, 2024
b469bdb
Update .vsts-ci.yml
StrikerRUS Dec 15, 2024
ce9b67f
Update .vsts-ci.yml
StrikerRUS Dec 15, 2024
6447003
Update .vsts-ci.yml
StrikerRUS Dec 15, 2024
fc709d1
Update .vsts-ci.yml
StrikerRUS Dec 15, 2024
a924516
Update .vsts-ci.yml
StrikerRUS Dec 15, 2024
80698a8
Update r_package.yml
StrikerRUS Dec 15, 2024
5bcfba2
Update static_analysis.yml
StrikerRUS Dec 15, 2024
07572eb
Update .pre-commit-config.yaml
StrikerRUS Dec 15, 2024
ea8897f
Update static_analysis.yml
StrikerRUS Dec 15, 2024
d3f5e7e
Merge branch 'master' into ci/yamllint
StrikerRUS Dec 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions .github/workflows/cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: CUDA Version
on:
push:
branches:
- master
- master
pull_request:
branches:
- master
- master
# Run manually by clicking a button in the UI
workflow_dispatch:
inputs:
Expand Down Expand Up @@ -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 \
Expand All @@ -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]
Expand Down Expand Up @@ -130,7 +134,7 @@ jobs:
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Note that all tests succeeded
uses: re-actors/[email protected]
with:
jobs: ${{ toJSON(needs) }}
- name: Note that all tests succeeded
uses: re-actors/[email protected]
with:
jobs: ${{ toJSON(needs) }}
14 changes: 10 additions & 4 deletions .github/workflows/lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,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'
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/no-response.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@ jobs:
- uses: lee-dohm/[email protected]
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
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/optional_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ 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; }
|| { echo ${comment}; exit 1; }
done
12 changes: 6 additions & 6 deletions .github/workflows/python_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Python-package
on:
push:
branches:
- master
- master
pull_request:
branches:
- master
- master

# automatically cancel in-progress builds if another commit is pushed
concurrency:
Expand Down Expand Up @@ -147,7 +147,7 @@ jobs:
runs-on: ubuntu-latest
needs: [test, test-latest-versions, test-oldest-versions]
steps:
- name: Note that all tests succeeded
uses: re-actors/[email protected]
with:
jobs: ${{ toJSON(needs) }}
- name: Note that all tests succeeded
uses: re-actors/[email protected]
with:
jobs: ${{ toJSON(needs) }}
23 changes: 15 additions & 8 deletions .github/workflows/r_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: R-package
on:
push:
branches:
- master
- master
pull_request:
branches:
- master
- master

# automatically cancel in-progress builds if another commit is pushed
concurrency:
Expand All @@ -33,6 +33,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 }}
Expand Down Expand Up @@ -230,7 +231,10 @@ 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')"
CRAN_MIRROR="https://cran.rstudio.com"
RDscript${{ matrix.r_customization }} \
-e "install.packages(${R_LIBS}, repos = '${CRAN_MIRROR}', 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
Expand Down Expand Up @@ -295,7 +299,10 @@ 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')"
CRAN_MIRROR="https://cran.rstudio.com"
Rscript \
-e "install.packages(${R_LIBS}, repos = '${CRAN_MIRROR}', Ncpus = parallel::detectCores())"
sh build-cran-package.sh

# 'rchk' isn't run through 'R CMD check', use the approach documented at
Expand Down Expand Up @@ -344,7 +351,7 @@ jobs:
runs-on: ubuntu-latest
needs: [test, test-r-sanitizers, test-r-extra-checks]
steps:
- name: Note that all tests succeeded
uses: re-actors/[email protected]
with:
jobs: ${{ toJSON(needs) }}
- name: Note that all tests succeeded
uses: re-actors/[email protected]
with:
jobs: ${{ toJSON(needs) }}
14 changes: 11 additions & 3 deletions .github/workflows/r_valgrind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 on lines +36 to +39
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like these types of splits for calling scripts / commands with 1 argument per line... let's keep them regardless of how we handle other line-length warnings.

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 }}."
Expand Down
17 changes: 10 additions & 7 deletions .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ name: Static Analysis
on:
push:
branches:
- master
- master
pull_request:
branches:
- master
- master

# automatically cancel in-progress builds if another commit is pushed
concurrency:
Expand Down Expand Up @@ -64,7 +64,10 @@ 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())"
R_LIBS="c('R6', 'data.table', 'jsonlite', 'knitr', 'markdown'"
R_LIBS+=", 'Matrix', 'RhpcBLASctl', 'roxygen2', 'testthat')"
CRAN_MIRROR="https://cran.rstudio.com"
Rscript -e "install.packages(${R_LIBS}, repos = '${CRAN_MIRROR}', Ncpus = parallel::detectCores())"
sh build-cran-package.sh || exit 1
R CMD INSTALL --with-keep.source lightgbm_*.tar.gz || exit 1
- name: Test documentation
Expand All @@ -88,7 +91,7 @@ jobs:
runs-on: ubuntu-latest
needs: [test, r-check-docs]
steps:
- name: Note that all tests succeeded
uses: re-actors/[email protected]
with:
jobs: ${{ toJSON(needs) }}
- name: Note that all tests succeeded
uses: re-actors/[email protected]
with:
jobs: ${{ toJSON(needs) }}
43 changes: 23 additions & 20 deletions .github/workflows/triggering_comments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,32 @@ 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')
Comment on lines +9 to +12
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runs-on: ubuntu-latest
env:
SECRETS_WORKFLOW: ${{ secrets.WORKFLOW }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 5
submodules: false
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 5
submodules: false

- name: Trigger R valgrind tests
if: github.event.comment.body == '/gha run r-valgrind'
run: |
$GITHUB_WORKSPACE/.ci/trigger-dispatch-run.sh \
"${{ github.event.issue.pull_request.url }}" \
"${{ github.event.comment.id }}" \
"gha_run_r_valgrind"
- name: Trigger R valgrind tests
if: github.event.comment.body == '/gha run r-valgrind'
run: |
$GITHUB_WORKSPACE/.ci/trigger-dispatch-run.sh \
"${{ github.event.issue.pull_request.url }}" \
"${{ github.event.comment.id }}" \
"gha_run_r_valgrind"

- name: Trigger update R configure
if: github.event.comment.body == '/gha run r-configure'
run: |
$GITHUB_WORKSPACE/.ci/trigger-dispatch-run.sh \
"${{ github.event.issue.pull_request.url }}" \
"${{ github.event.comment.id }}" \
"gha_run_r_configure"
- name: Trigger update R configure
if: github.event.comment.body == '/gha run r-configure'
run: |
$GITHUB_WORKSPACE/.ci/trigger-dispatch-run.sh \
"${{ github.event.issue.pull_request.url }}" \
"${{ github.event.comment.id }}" \
"gha_run_r_configure"
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ repos:
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
- id: yamllint
args: ["--strict"]
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.8.3
Expand Down
Loading
Loading