зеркало из https://github.com/microsoft/LightGBM.git
fix some shellcheck warnings (#6621)
Co-authored-by: James Lamb <jaylamb20@gmail.com>
This commit is contained in:
Родитель
b1203c975c
Коммит
15ac2f7bb8
|
@ -16,11 +16,11 @@ pip install \
|
||||||
twine || exit 1
|
twine || exit 1
|
||||||
|
|
||||||
echo "twine check..."
|
echo "twine check..."
|
||||||
twine check --strict ${DIST_DIR}/* || exit 1
|
twine check --strict "$(echo "${DIST_DIR}"/*)" || exit 1
|
||||||
|
|
||||||
if { test "${TASK}" = "bdist" || test "${METHOD}" = "wheel"; }; then
|
if { test "${TASK}" = "bdist" || test "${METHOD}" = "wheel"; }; then
|
||||||
echo "check-wheel-contents..."
|
echo "check-wheel-contents..."
|
||||||
check-wheel-contents ${DIST_DIR}/*.whl || exit 1
|
check-wheel-contents "$(echo "${DIST_DIR}"/*.whl)" || exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PY_MINOR_VER=$(python -c "import sys; print(sys.version_info.minor)")
|
PY_MINOR_VER=$(python -c "import sys; print(sys.version_info.minor)")
|
||||||
|
@ -34,7 +34,7 @@ if [ "$PY_MINOR_VER" -gt 7 ]; then
|
||||||
--ignore 'distro-too-large-compressed' \
|
--ignore 'distro-too-large-compressed' \
|
||||||
--max-allowed-size-uncompressed '100M' \
|
--max-allowed-size-uncompressed '100M' \
|
||||||
--max-allowed-files 800 \
|
--max-allowed-files 800 \
|
||||||
"$(echo ${DIST_DIR}/*)" || exit 1
|
"$(echo "${DIST_DIR}"/*)" || exit 1
|
||||||
elif { test "$(uname -m)" = "aarch64"; }; then
|
elif { test "$(uname -m)" = "aarch64"; }; then
|
||||||
pydistcheck \
|
pydistcheck \
|
||||||
--inspect \
|
--inspect \
|
||||||
|
@ -42,14 +42,14 @@ if [ "$PY_MINOR_VER" -gt 7 ]; then
|
||||||
--max-allowed-size-compressed '5M' \
|
--max-allowed-size-compressed '5M' \
|
||||||
--max-allowed-size-uncompressed '15M' \
|
--max-allowed-size-uncompressed '15M' \
|
||||||
--max-allowed-files 800 \
|
--max-allowed-files 800 \
|
||||||
"$(echo ${DIST_DIR}/*)" || exit 1
|
"$(echo "${DIST_DIR}"/*)" || exit 1
|
||||||
else
|
else
|
||||||
pydistcheck \
|
pydistcheck \
|
||||||
--inspect \
|
--inspect \
|
||||||
--max-allowed-size-compressed '5M' \
|
--max-allowed-size-compressed '5M' \
|
||||||
--max-allowed-size-uncompressed '15M' \
|
--max-allowed-size-uncompressed '15M' \
|
||||||
--max-allowed-files 800 \
|
--max-allowed-files 800 \
|
||||||
"$(echo ${DIST_DIR}/*)" || exit 1
|
"$(echo "${DIST_DIR}"/*)" || exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "skipping pydistcheck (does not support Python 3.${PY_MINOR_VER})"
|
echo "skipping pydistcheck (does not support Python 3.${PY_MINOR_VER})"
|
||||||
|
|
|
@ -10,14 +10,15 @@ cpplint \
|
||||||
echo "done running cpplint"
|
echo "done running cpplint"
|
||||||
|
|
||||||
echo "running cmakelint"
|
echo "running cmakelint"
|
||||||
cmake_files=$(
|
find \
|
||||||
find . -name CMakeLists.txt -o -path "./cmake/*.cmake" \
|
. \
|
||||||
| grep -v external_libs
|
-type f \
|
||||||
)
|
\( -name CMakeLists.txt -o -path "./cmake/*.cmake" \) \
|
||||||
cmakelint \
|
-not -path './external_libs/*' \
|
||||||
|
-exec cmakelint \
|
||||||
--linelength=120 \
|
--linelength=120 \
|
||||||
--filter=-convention/filename,-package/stdargs,-readability/wonkycase \
|
--filter=-convention/filename,-package/stdargs,-readability/wonkycase \
|
||||||
${cmake_files} \
|
{} \+ \
|
||||||
|| exit 1
|
|| exit 1
|
||||||
echo "done running cmakelint"
|
echo "done running cmakelint"
|
||||||
|
|
||||||
|
|
|
@ -35,13 +35,13 @@ runs=$(
|
||||||
"${GITHUB_API_URL}/repos/microsoft/LightGBM/actions/workflows/${workflow_id}/runs?event=pull_request&branch=${pr_branch}" | \
|
"${GITHUB_API_URL}/repos/microsoft/LightGBM/actions/workflows/${workflow_id}/runs?event=pull_request&branch=${pr_branch}" | \
|
||||||
jq '.workflow_runs'
|
jq '.workflow_runs'
|
||||||
)
|
)
|
||||||
runs=$(echo $runs | jq --arg pr_number "$pr_number" --arg pr_branch "$pr_branch" 'map(select(.event == "pull_request" and ((.pull_requests | length) != 0 and (.pull_requests[0].number | tostring) == $pr_number or .head_branch == $pr_branch)))')
|
runs=$(echo "${runs}" | jq --arg pr_number "${pr_number}" --arg pr_branch "${pr_branch}" 'map(select(.event == "pull_request" and ((.pull_requests | length) != 0 and (.pull_requests[0].number | tostring) == $pr_number or .head_branch == $pr_branch)))')
|
||||||
runs=$(echo $runs | jq 'sort_by(.run_number) | reverse')
|
runs=$(echo "${runs}" | jq 'sort_by(.run_number) | reverse')
|
||||||
|
|
||||||
if [[ $(echo $runs | jq 'length') -gt 0 ]]; then
|
if [[ $(echo "${runs}" | jq 'length') -gt 0 ]]; then
|
||||||
curl -sL \
|
curl -sL \
|
||||||
-X POST \
|
-X POST \
|
||||||
-H "Accept: application/vnd.github.v3+json" \
|
-H "Accept: application/vnd.github.v3+json" \
|
||||||
-H "Authorization: token $SECRETS_WORKFLOW" \
|
-H "Authorization: token $SECRETS_WORKFLOW" \
|
||||||
"${GITHUB_API_URL}/repos/microsoft/LightGBM/actions/runs/$(echo $runs | jq '.[0].id')/rerun"
|
"${GITHUB_API_URL}/repos/microsoft/LightGBM/actions/runs/$(echo "${runs}" | jq '.[0].id')/rerun"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -39,9 +39,9 @@ sha=$3
|
||||||
|
|
||||||
data=$(
|
data=$(
|
||||||
jq -n \
|
jq -n \
|
||||||
--arg state $status \
|
--arg state "${status}" \
|
||||||
--arg url "${GITHUB_SERVER_URL}/microsoft/LightGBM/actions/runs/${GITHUB_RUN_ID}" \
|
--arg url "${GITHUB_SERVER_URL}/microsoft/LightGBM/actions/runs/${GITHUB_RUN_ID}" \
|
||||||
--arg name "$name" \
|
--arg name "${name}" \
|
||||||
'{"state":$state,"target_url":$url,"context":$name}'
|
'{"state":$state,"target_url":$url,"context":$name}'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,9 @@ pr=$(
|
||||||
data=$(
|
data=$(
|
||||||
jq -n \
|
jq -n \
|
||||||
--arg event_type "$dispatch_name" \
|
--arg event_type "$dispatch_name" \
|
||||||
--arg pr_number "$(echo $pr | jq '.number')" \
|
--arg pr_number "$(echo "$pr" | jq '.number')" \
|
||||||
--arg pr_sha "$(echo $pr | jq '.head.sha')" \
|
--arg pr_sha "$(echo "$pr" | jq '.head.sha')" \
|
||||||
--arg pr_branch "$(echo $pr | jq '.head.ref')" \
|
--arg pr_branch "$(echo "$pr" | jq '.head.ref')" \
|
||||||
--arg comment_number "$comment_id" \
|
--arg comment_number "$comment_id" \
|
||||||
'{"event_type":$event_type,"client_payload":{"pr_number":$pr_number,"pr_sha":$pr_sha,"pr_branch":$pr_branch,"comment_number":$comment_number}}'
|
'{"event_type":$event_type,"client_payload":{"pr_number":$pr_number,"pr_sha":$pr_sha,"pr_branch":$pr_branch,"comment_number":$comment_number}}'
|
||||||
)
|
)
|
||||||
|
|
|
@ -8,7 +8,7 @@ AUTOCONF_VERSION=$(cat R-package/AUTOCONF_UBUNTU_VERSION)
|
||||||
|
|
||||||
# R packages cannot have versions like 3.0.0rc1, but
|
# R packages cannot have versions like 3.0.0rc1, but
|
||||||
# 3.0.0-1 is acceptable
|
# 3.0.0-1 is acceptable
|
||||||
LGB_VERSION=$(cat VERSION.txt | sed "s/rc/-/g")
|
LGB_VERSION=$(sed "s/rc/-/g" < VERSION.txt)
|
||||||
|
|
||||||
# this script changes configure.ac. Copying to a temporary file
|
# this script changes configure.ac. Copying to a temporary file
|
||||||
# so changes to configure.ac don't get committed in git
|
# so changes to configure.ac don't get committed in git
|
||||||
|
@ -20,7 +20,7 @@ apt update
|
||||||
apt-get install \
|
apt-get install \
|
||||||
--no-install-recommends \
|
--no-install-recommends \
|
||||||
-y \
|
-y \
|
||||||
autoconf=${AUTOCONF_VERSION}
|
autoconf="${AUTOCONF_VERSION}"
|
||||||
|
|
||||||
cd R-package
|
cd R-package
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,10 @@ export PATH="${CONDA}/bin:${PATH}"
|
||||||
|
|
||||||
curl \
|
curl \
|
||||||
-sL \
|
-sL \
|
||||||
-o ${HOME}/miniforge.sh \
|
-o "${HOME}/miniforge.sh" \
|
||||||
https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh
|
https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh
|
||||||
|
|
||||||
/bin/bash ${HOME}/miniforge.sh -b -p ${CONDA}
|
/bin/bash "${HOME}/miniforge.sh" -b -p "${CONDA}"
|
||||||
|
|
||||||
conda config --set always_yes yes --set changeps1 no
|
conda config --set always_yes yes --set changeps1 no
|
||||||
conda update -q -y conda
|
conda update -q -y conda
|
||||||
|
@ -20,6 +20,7 @@ conda env create \
|
||||||
--name docs-env \
|
--name docs-env \
|
||||||
--file env.yml || exit 1
|
--file env.yml || exit 1
|
||||||
|
|
||||||
|
# shellcheck disable=SC1091
|
||||||
source activate docs-env
|
source activate docs-env
|
||||||
make clean html || exit 1
|
make clean html || exit 1
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче