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

Modify shell scripts to pass shellcheck --severity=warning #3371

Merged
merged 4 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 20 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Shellcheck

on:
push:
branches: [ main ]
pull_request:
merge_group:
workflow_dispatch:

jobs:
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install shellcheck
run: sudo apt update && sudo apt install --assume-yes shellcheck

- name: Run shellcheck
run: find . -name \*.sh -o -name \*.sh.template | xargs shellcheck --severity=warning
3 changes: 2 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ function FirstJsonValue {

# If dotnet CLI is installed globally and it matches requested version, use for execution
if [ -x "$(command -v dotnet)" ] && dotnet --version &>/dev/null; then
export DOTNET_EXE="$(command -v dotnet)"
DOTNET_EXE="$(command -v dotnet)"
export DOTNET_EXE
else
Kielek marked this conversation as resolved.
Show resolved Hide resolved
# Download install script
DOTNET_INSTALL_FILE="$TEMP_DIRECTORY/dotnet-install.sh"
Expand Down
2 changes: 1 addition & 1 deletion instrument.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,4 @@ if [ "$ENABLE_PROFILING" = "true" ]; then
fi
fi

$@
exec "$@"
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
#!/bin/sh

BASE_PATH="$(cd $(dirname "$0") && pwd)"
BASE_PATH="$(cd "$(dirname "$0")" && pwd)"

# Settings for .NET
export ASPNETCORE_HOSTINGSTARTUPASSEMBLIES=OpenTelemetry.AutoInstrumentation.AspNetCoreBootstrapper
export CORECLR_ENABLE_PROFILING=1
export CORECLR_PROFILER="{918728DD-259F-4A6A-AC2B-B85E1B658318}"
export CORECLR_PROFILER_PATH=$(ls ${BASE_PATH}/OpenTelemetry.AutoInstrumentation.Native.*)
CORECLR_PROFILER_PATH="$(ls ${BASE_PATH}/OpenTelemetry.AutoInstrumentation.Native.*)"
pjanotti marked this conversation as resolved.
Show resolved Hide resolved
export CORECLR_PROFILER_PATH
export DOTNET_STARTUP_HOOKS=${BASE_PATH}/OpenTelemetry.AutoInstrumentation.StartupHook.dll

# Settings for OpenTelemetry
export OTEL_DOTNET_AUTO_HOME=${BASE_PATH}
export OTEL_DOTNET_AUTO_RULE_ENGINE_ENABLED=false

$@
exec "$@"
5 changes: 3 additions & 2 deletions scripts/format-native.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
#!/bin/bash
set -e

SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
cd $SCRIPT_DIR/..
Expand Down Expand Up @@ -31,7 +32,7 @@ else
fi

# files to format
NATIVE_FILES=$(find . -iname *.cpp -o -iname *.hpp -iname *.h -iname *.inc | grep -v ./packages | grep -v ./src/OpenTelemetry.AutoInstrumentation.Native/lib)
NATIVE_FILES=$(find . -iname "*.cpp" -o -iname "*.hpp" -iname "*.h" -iname "*.inc" | grep -v ./packages | grep -v ./src/OpenTelemetry.AutoInstrumentation.Native/lib)

# clang-format
echo "$NATIVE_FILES" | xargs "./bin/artifacts/clang-format$EXT" -style=file -i
Expand Down
Loading