Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
52441c47
Unverified
Commit
52441c47
authored
Apr 22, 2024
by
James Lamb
Committed by
GitHub
Apr 22, 2024
Browse files
[ci] make shell scripts stricter (#6266)
parent
89824a6c
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
56 additions
and
21 deletions
+56
-21
.ci/append_comment.sh
.ci/append_comment.sh
+1
-1
.ci/check_python_dists.sh
.ci/check_python_dists.sh
+6
-0
.ci/lint-cpp.sh
.ci/lint-cpp.sh
+11
-1
.ci/lint-python.sh
.ci/lint-python.sh
+3
-1
.ci/rerun_workflow.sh
.ci/rerun_workflow.sh
+1
-1
.ci/set_commit_status.sh
.ci/set_commit_status.sh
+1
-1
.ci/setup.sh
.ci/setup.sh
+6
-1
.ci/test-python-oldest.sh
.ci/test-python-oldest.sh
+2
-0
.ci/test.sh
.ci/test.sh
+9
-3
.ci/test_r_package.sh
.ci/test_r_package.sh
+7
-0
.ci/test_r_package_valgrind.sh
.ci/test_r_package_valgrind.sh
+2
-0
.ci/trigger_dispatch_run.sh
.ci/trigger_dispatch_run.sh
+1
-1
.github/workflows/r_package.yml
.github/workflows/r_package.yml
+0
-9
R-package/recreate-configure.sh
R-package/recreate-configure.sh
+2
-0
build-cran-package.sh
build-cran-package.sh
+1
-1
build-python.sh
build-python.sh
+1
-1
docs/build-docs.sh
docs/build-docs.sh
+2
-0
No files found.
.ci/append_comment.sh
View file @
52441c47
...
...
@@ -10,7 +10,7 @@
#
# BODY: Text that will be appended to the original comment body.
set
-e
set
-e
-E
-u
-o
pipefail
if
[
-z
"
$GITHUB_ACTIONS
"
]
;
then
echo
"Must be run inside GitHub Actions CI"
...
...
.ci/check_python_dists.sh
View file @
52441c47
#!/bin/sh
set
-e
-E
-u
DIST_DIR
=
${
1
}
# defaults
METHOD
=
${
METHOD
:-
""
}
TASK
=
${
TASK
:-
""
}
echo
"checking Python package distributions in '
${
DIST_DIR
}
'"
pip
install
\
...
...
.ci/lint-cpp.sh
View file @
52441c47
#!/bin/sh
#!/bin/bash
set
-e
-E
-u
-o
pipefail
echo
"running cpplint"
cpplint
\
...
...
@@ -32,9 +34,17 @@ get_omp_pragmas_without_num_threads() {
'pragma omp parallel'
\
|
grep
-v
' num_threads'
}
# 'grep' returns a non-0 exit code if 0 lines were found.
# Turning off '-e -o pipefail' options here so that bash doesn't
# consider this a failure and stop execution of the script.
#
# ref: https://www.gnu.org/software/grep/manual/html_node/Exit-Status.html
set
+e +o pipefail
PROBLEMATIC_LINES
=
$(
get_omp_pragmas_without_num_threads
)
set
-e
-o
pipefail
if
test
"
${
PROBLEMATIC_LINES
}
"
!=
""
;
then
get_omp_pragmas_without_num_threads
echo
"Found '#pragma omp parallel' not using explicit num_threads() configuration. Fix those."
...
...
.ci/lint-python.sh
View file @
52441c47
#!/bin/sh
#!/bin/bash
set
-e
-E
-u
-o
pipefail
echo
"running pre-commit checks"
pre-commit run
--all-files
||
exit
1
...
...
.ci/rerun_workflow.sh
View file @
52441c47
...
...
@@ -12,7 +12,7 @@
#
# PR_BRANCH: Name of pull request's branch.
set
-e
set
-e
-E
-u
-o
pipefail
if
[
-z
"
$GITHUB_ACTIONS
"
]
;
then
echo
"Must be run inside GitHub Actions CI"
...
...
.ci/set_commit_status.sh
View file @
52441c47
...
...
@@ -14,7 +14,7 @@
#
# SHA: SHA of a commit to set a status on.
set
-e
set
-e
-E
-u
-o
pipefail
if
[
-z
"
$GITHUB_ACTIONS
"
]
;
then
echo
"Must be run inside GitHub Actions CI"
...
...
.ci/setup.sh
View file @
52441c47
#!/bin/bash
set
-e
-E
-o
pipefail
set
-e
-E
-u
-o
pipefail
# defaults
AZURE
=
${
AZURE
:-
"false"
}
IN_UBUNTU_BASE_CONTAINER
=
${
IN_UBUNTU_BASE_CONTAINER
:-
"false"
}
SETUP_CONDA
=
${
SETUP_CONDA
:-
"true"
}
ARCH
=
$(
uname
-m
)
...
...
.ci/test-python-oldest.sh
View file @
52441c47
#!/bin/bash
set
-e
-E
-u
-o
pipefail
# oldest versions of dependencies published after
# minimum supported Python version's first release
#
...
...
.ci/test.sh
View file @
52441c47
#!/bin/bash
set
-e
-E
-o
pipefail
set
-e
-E
-o
-u
pipefail
# defaults
IN_UBUNTU_BASE_CONTAINER
=
${
IN_UBUNTU_BASE_CONTAINER
:-
"false"
}
METHOD
=
${
METHOD
:-
""
}
PRODUCES_ARTIFACTS
=
${
PRODUCES_ARTIFACTS
:-
"false"
}
SANITIZERS
=
${
SANITIZERS
:-
""
}
ARCH
=
$(
uname
-m
)
...
...
@@ -83,11 +89,11 @@ if [[ $TASK == "lint" ]]; then
'r-lintr>=3.1'
source
activate
$CONDA_ENV
echo
"Linting Python code"
sh
${
BUILD_DIRECTORY
}
/.ci/lint-python.sh
||
exit
1
ba
sh
${
BUILD_DIRECTORY
}
/.ci/lint-python.sh
||
exit
1
echo
"Linting R code"
Rscript
${
BUILD_DIRECTORY
}
/.ci/lint_r_code.R
${
BUILD_DIRECTORY
}
||
exit
1
echo
"Linting C++ code"
sh
${
BUILD_DIRECTORY
}
/.ci/lint-cpp.sh
||
exit
1
ba
sh
${
BUILD_DIRECTORY
}
/.ci/lint-cpp.sh
||
exit
1
exit
0
fi
...
...
.ci/test_r_package.sh
View file @
52441c47
#!/bin/bash
set
-e
-E
-u
-o
pipefail
# defaults
ARCH
=
$(
uname
-m
)
INSTALL_CMAKE_FROM_RELEASES
=
${
INSTALL_CMAKE_FROM_RELEASES
:-
"false"
}
# set up R environment
CRAN_MIRROR
=
"https://cran.rstudio.com"
...
...
@@ -212,6 +216,9 @@ if [[ $check_succeeded == "no" ]]; then
exit
1
fi
# ensure 'grep --count' doesn't cause failures
set
+e
used_correct_r_version
=
$(
cat
$LOG_FILE_NAME
\
|
grep
--count
"using R version
${
R_VERSION
}
"
...
...
.ci/test_r_package_valgrind.sh
View file @
52441c47
#!/bin/bash
set
-e
-E
-u
-o
pipefail
RDscriptvalgrind
-e
"install.packages(c('R6', 'data.table', 'jsonlite', 'Matrix', 'RhpcBLASctl', 'testthat'), repos = 'https://cran.rstudio.com')"
||
exit
1
sh build-cran-package.sh
\
--r-executable
=
RDvalgrind
\
...
...
.ci/trigger_dispatch_run.sh
View file @
52441c47
...
...
@@ -12,7 +12,7 @@
#
# DISPATCH_NAME: Name of a dispatch to be triggered.
set
-e
set
-e
-E
-u
-o
pipefail
if
[
-z
"
$GITHUB_ACTIONS
"
]
;
then
echo
"Must be run inside GitHub Actions CI"
...
...
.github/workflows/r_package.yml
View file @
52441c47
...
...
@@ -134,15 +134,6 @@ jobs:
r_version
:
4.3
build_type
:
cran
container
:
null
################
# Other checks #
################
-
os
:
ubuntu-latest
task
:
r-rchk
compiler
:
gcc
r_version
:
4.3
build_type
:
cran
container
:
'
ubuntu:22.04'
steps
:
-
name
:
Prevent conversion of line endings on Windows
if
:
startsWith(matrix.os, 'windows')
...
...
R-package/recreate-configure.sh
View file @
52441c47
#!/bin/bash
set
-e
-E
-u
-o
pipefail
# recreates 'configure' from 'configure.ac'
# this script should run on Ubuntu 22.04
AUTOCONF_VERSION
=
$(
cat
R-package/AUTOCONF_UBUNTU_VERSION
)
...
...
build-cran-package.sh
View file @
52441c47
...
...
@@ -27,7 +27,7 @@
# # skip vignette building
# sh build-cran-package.sh --no-build-vignettes
set
-e
set
-e
-E
-u
# Default values of arguments
BUILD_VIGNETTES
=
true
...
...
build-python.sh
View file @
52441c47
...
...
@@ -62,7 +62,7 @@
# Install into user-specific instead of global site-packages directory.
# Only used with 'install' command.
set
-e
-u
set
-e
-E
-u
echo
"building lightgbm"
...
...
docs/build-docs.sh
View file @
52441c47
#!/bin/bash
set
-e
-E
-u
-o
pipefail
rm
-f
./_FIRST_RUN.flag
export
PATH
=
"
${
CONDA
}
/bin:
${
PATH
}
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment