Merge pull request #14071 from mehrdada/shellcheck

Add tools/run_tests/artifacts to shellcheck enforcement list
pull/14315/head
Mehrdad Afshari 7 years ago committed by GitHub
commit b58d13394c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      tools/distrib/build_ruby_environment_macos.sh
  2. 2
      tools/distrib/check_nanopb_output.sh
  3. 2
      tools/distrib/check_windows_dlls.sh
  4. 2
      tools/run_tests/artifacts/build_artifact_csharp.sh
  5. 3
      tools/run_tests/artifacts/build_artifact_php.sh
  6. 2
      tools/run_tests/artifacts/build_artifact_protoc.sh
  7. 30
      tools/run_tests/artifacts/build_artifact_python.sh
  8. 8
      tools/run_tests/artifacts/build_artifact_ruby.sh
  9. 4
      tools/run_tests/artifacts/build_package_php.sh
  10. 4
      tools/run_tests/artifacts/build_package_python.sh
  11. 18
      tools/run_tests/artifacts/build_package_ruby.sh
  12. 8
      tools/run_tests/artifacts/run_in_workspace.sh
  13. 1
      tools/run_tests/sanity/check_shellcheck.sh

@ -17,12 +17,12 @@ set -ex
rm -rf ~/.rake-compiler
CROSS_RUBY=`mktemp tmpfile.XXXXXXXX`
CROSS_RUBY=$(mktemp tmpfile.XXXXXXXX)
curl https://raw.githubusercontent.com/rake-compiler/rake-compiler/v1.0.3/tasks/bin/cross-ruby.rake > $CROSS_RUBY
curl https://raw.githubusercontent.com/rake-compiler/rake-compiler/v1.0.3/tasks/bin/cross-ruby.rake > "$CROSS_RUBY"
# See https://github.com/grpc/grpc/issues/12161 for verconf.h patch details
patch $CROSS_RUBY << EOF
patch "$CROSS_RUBY" << EOF
--- cross-ruby.rake 2017-09-27 16:46:00.311020325 +0200
+++ patched 2017-09-27 16:49:46.127016895 +0200
@@ -133,7 +133,8 @@
@ -49,8 +49,9 @@ MAKE="make -j8"
for v in 2.5.0 2.4.0 2.3.0 2.2.2 2.1.6 2.0.0-p645 ; do
ccache -c
rake -f $CROSS_RUBY cross-ruby VERSION=$v HOST=x86_64-darwin11
rake -f "$CROSS_RUBY" cross-ruby VERSION="$v" HOST=x86_64-darwin11 MAKE="$MAKE"
done
sed 's/x86_64-darwin-11/universal-darwin/' ~/.rake-compiler/config.yml > $CROSS_RUBY
mv $CROSS_RUBY ~/.rake-compiler/config.yml
sed 's/x86_64-darwin-11/universal-darwin/' ~/.rake-compiler/config.yml > "$CROSS_RUBY"
mv "$CROSS_RUBY" ~/.rake-compiler/config.yml

@ -51,7 +51,7 @@ readonly LOAD_BALANCER_GRPC_OUTPUT_PATH='src/core/ext/filters/client_channel/lb_
"$LOAD_BALANCER_GRPC_OUTPUT_PATH"
# compare outputs to checked compiled code
if ! diff -r $NANOPB_TMP_OUTPUT src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1; then
if ! diff -r "$NANOPB_TMP_OUTPUT" src/core/ext/filters/client_channel/lb_policy/grpclb/proto/grpc/lb/v1; then
echo "Outputs differ: $NANOPB_TMP_OUTPUT vs $LOAD_BALANCER_GRPC_OUTPUT_PATH"
exit 2
fi

@ -16,7 +16,7 @@
set -ex
# change to root directory
cd $(dirname $0)/../..
cd "$(dirname "$0")/../.."
bundle
rake dlls

@ -15,7 +15,7 @@
set -ex
cd $(dirname $0)/../../..
cd "$(dirname "$0")/../../.."
make grpc_csharp_ext

@ -13,10 +13,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
PHP_TARGET_ARCH=$1
set -ex
cd $(dirname $0)/../../..
cd "$(dirname "$0")/../../.."
mkdir -p "${ARTIFACTS_OUT}"

@ -18,7 +18,7 @@ source scl_source enable devtoolset-1.1
set -ex
cd $(dirname $0)/../../..
cd "$(dirname "$0")/../../.."
make plugins

@ -15,7 +15,7 @@
set -ex
cd $(dirname $0)/../../..
cd "$(dirname "$0")/../../.."
export GRPC_PYTHON_USE_CUSTOM_BDIST=0
export GRPC_PYTHON_BUILD_WITH_CYTHON=1
@ -29,30 +29,30 @@ ARTIFACT_DIR="$PWD/${ARTIFACTS_OUT}"
# Build the source distribution first because MANIFEST.in cannot override
# exclusion of built shared objects among package resources (for some
# inexplicable reason).
${SETARCH_CMD} ${PYTHON} setup.py sdist
${SETARCH_CMD} "${PYTHON}" setup.py sdist
# Wheel has a bug where directories don't get excluded.
# https://bitbucket.org/pypa/wheel/issues/99/cannot-exclude-directory
${SETARCH_CMD} ${PYTHON} setup.py bdist_wheel
${SETARCH_CMD} "${PYTHON}" setup.py bdist_wheel
# Build gRPC tools package distribution
${PYTHON} tools/distrib/python/make_grpcio_tools.py
"${PYTHON}" tools/distrib/python/make_grpcio_tools.py
# Build gRPC tools package source distribution
${SETARCH_CMD} ${PYTHON} tools/distrib/python/grpcio_tools/setup.py sdist
${SETARCH_CMD} "${PYTHON}" tools/distrib/python/grpcio_tools/setup.py sdist
# Build gRPC tools package binary distribution
${SETARCH_CMD} ${PYTHON} tools/distrib/python/grpcio_tools/setup.py bdist_wheel
${SETARCH_CMD} "${PYTHON}" tools/distrib/python/grpcio_tools/setup.py bdist_wheel
if [ "$GRPC_BUILD_MANYLINUX_WHEEL" != "" ]
then
for wheel in dist/*.whl; do
${AUDITWHEEL} repair $wheel -w "$ARTIFACT_DIR"
rm $wheel
"${AUDITWHEEL}" repair "$wheel" -w "$ARTIFACT_DIR"
rm "$wheel"
done
for wheel in tools/distrib/python/grpcio_tools/dist/*.whl; do
${AUDITWHEEL} repair $wheel -w "$ARTIFACT_DIR"
rm $wheel
"${AUDITWHEEL}" repair "$wheel" -w "$ARTIFACT_DIR"
rm "$wheel"
done
fi
@ -62,17 +62,17 @@ fi
# are in a docker image or in a virtualenv.
if [ "$GRPC_BUILD_GRPCIO_TOOLS_DEPENDENTS" != "" ]
then
${PIP} install -rrequirements.txt
${PIP} install grpcio --no-index --find-links "file://$ARTIFACT_DIR/"
${PIP} install grpcio-tools --no-index --find-links "file://$ARTIFACT_DIR/"
"${PIP}" install -rrequirements.txt
"${PIP}" install grpcio --no-index --find-links "file://$ARTIFACT_DIR/"
"${PIP}" install grpcio-tools --no-index --find-links "file://$ARTIFACT_DIR/"
# Build gRPC health-checking source distribution
${SETARCH_CMD} ${PYTHON} src/python/grpcio_health_checking/setup.py \
${SETARCH_CMD} "${PYTHON}" src/python/grpcio_health_checking/setup.py \
preprocess build_package_protos sdist
cp -r src/python/grpcio_health_checking/dist/* "$ARTIFACT_DIR"
# Build gRPC reflection source distribution
${SETARCH_CMD} ${PYTHON} src/python/grpcio_reflection/setup.py \
${SETARCH_CMD} "${PYTHON}" src/python/grpcio_reflection/setup.py \
preprocess build_package_protos sdist
cp -r src/python/grpcio_reflection/dist/* "$ARTIFACT_DIR"
fi

@ -14,9 +14,9 @@
# limitations under the License.
set -ex
SYSTEM=`uname | cut -f 1 -d_`
SYSTEM=$(uname | cut -f 1 -d_)
cd $(dirname $0)/../../..
cd "$(dirname "$0")/../../.."
set +ex
[[ -s /etc/profile.d/rvm.sh ]] && . /etc/profile.d/rvm.sh
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
@ -46,7 +46,9 @@ export DOCKERHUB_ORGANIZATION=grpctesting
rake gem:native
if [ "$SYSTEM" == "Darwin" ] ; then
rm `ls pkg/*.gem | grep -v darwin`
# TODO: consider rewriting this to pass shellcheck
# shellcheck disable=SC2046,SC2010
rm $(ls pkg/*.gem | grep -v darwin)
fi
mkdir -p "${ARTIFACTS_OUT}"

@ -15,7 +15,7 @@
set -ex
cd $(dirname $0)/../../..
cd "$(dirname "$0")/../../.."
mkdir -p artifacts/
cp -r $EXTERNAL_GIT_ROOT/platform={windows,linux,macos}/artifacts/php_*/* artifacts/ || true
cp -r "$EXTERNAL_GIT_ROOT"/platform={windows,linux,macos}/artifacts/php_*/* artifacts/ || true

@ -15,13 +15,13 @@
set -ex
cd $(dirname $0)/../../..
cd "$(dirname "$0")/../../.."
mkdir -p artifacts/
# All the python packages have been built in the artifact phase already
# and we only collect them here to deliver them to the distribtest phase.
cp -r $EXTERNAL_GIT_ROOT/platform={windows,linux,macos}/artifacts/python_*/* artifacts/ || true
cp -r "$EXTERNAL_GIT_ROOT"/platform={windows,linux,macos}/artifacts/python_*/* artifacts/ || true
# TODO: all the artifact builder configurations generate a grpcio-VERSION.tar.gz
# source distribution package, and only one of them will end up

@ -15,7 +15,7 @@
set -ex
cd $(dirname $0)/../../..
cd "$(dirname "$0")/../../.."
base=$(pwd)
@ -23,7 +23,7 @@ mkdir -p artifacts/
# All the ruby packages have been built in the artifact phase already
# and we only collect them here to deliver them to the distribtest phase.
cp -r $EXTERNAL_GIT_ROOT/platform={windows,linux,macos}/artifacts/ruby_native_gem_*/* artifacts/ || true
cp -r "$EXTERNAL_GIT_ROOT"/platform={windows,linux,macos}/artifacts/ruby_native_gem_*/* artifacts/ || true
well_known_protos=( any api compiler/plugin descriptor duration empty field_mask source_context struct timestamp type wrappers )
@ -43,16 +43,16 @@ for arch in {x86,x64}; do
for plat in {windows,linux,macos}; do
input_dir="$EXTERNAL_GIT_ROOT/platform=${plat}/artifacts/protoc_${plat}_${arch}"
output_dir="$base/src/ruby/tools/bin/${ruby_arch}-${plat}"
mkdir -p $output_dir/google/protobuf
mkdir -p $output_dir/google/protobuf/compiler # needed for plugin.proto
cp $input_dir/protoc* $output_dir/
cp $input_dir/grpc_ruby_plugin* $output_dir/
mkdir -p "$output_dir"/google/protobuf
mkdir -p "$output_dir"/google/protobuf/compiler # needed for plugin.proto
cp "$input_dir"/protoc* "$output_dir"/
cp "$input_dir"/grpc_ruby_plugin* "$output_dir"/
for proto in "${well_known_protos[@]}"; do
cp $base/third_party/protobuf/src/google/protobuf/$proto.proto $output_dir/google/protobuf/$proto.proto
cp "$base/third_party/protobuf/src/google/protobuf/$proto.proto" "$output_dir/google/protobuf/$proto.proto"
done
done
done
cd $base/src/ruby/tools
cd "$base/src/ruby/tools"
gem build grpc-tools.gemspec
cp ./grpc-tools*.gem $base/artifacts/
cp ./grpc-tools*.gem "$base/artifacts/"

@ -18,15 +18,19 @@
# All cmdline args will be executed as a command.
set -ex
cd $(dirname $0)/../../..
cd "$(dirname "$0")/../../.."
export repo_root=$(pwd)
# TODO: fix file to pass shellcheck
rm -rf "${WORKSPACE_NAME}"
git clone . "${WORKSPACE_NAME}"
# clone gRPC submodules, use data from locally cloned submodules where possible
# shellcheck disable=SC1004,SC2016
git submodule foreach 'cd "${repo_root}/${WORKSPACE_NAME}" \
&& git submodule update --init --reference ${repo_root}/${name} ${name}'
echo "Running in workspace ${WORKSPACE_NAME}"
cd ${WORKSPACE_NAME}
cd "${WORKSPACE_NAME}"
# shellcheck disable=SC2068
$@

@ -19,6 +19,7 @@ set -e
ROOT="$(dirname "$0")/../../.."
DIRS=(
'tools/run_tests/artifacts'
'tools/run_tests/helper_scripts'
'tools/run_tests/sanity'
)

Loading…
Cancel
Save