HEX
Server: LiteSpeed
System: Linux houston.panomity.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User: nudepix (1011)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //opt/agentcloud/airbyte/tools/bin/ci_performance_test.sh
#!/usr/bin/env bash

set -e

. tools/lib/lib.sh

# runs performance tests for an performance name

connector="$1"
if [[ "$2" ]]; then
  if [[ "$2" == *"cpulimit"* ]]; then
    firstarg="-DcpuLimit=$(echo $2 | cut -d / -f 2)"
  fi
  if [[ "$2" == *"memorylimit"* ]]; then
    firstarg="-DmemoryLimit=$(echo $2 | cut -d / -f 2)"
  fi
fi
if [[ "$3" ]]; then
  if [[ "$3" == *"cpulimit"* ]]; then
    secondarg="-DcpuLimit=$(echo $3 | cut -d / -f 2)"
  fi
  if [[ "$3" == *"memorylimit"* ]]; then
    secondarg="-DmemoryLimit=$(echo $3 | cut -d / -f 2)"
  fi
fi
all_performance_tests=$(./gradlew performanceTest --dry-run | grep 'performanceTest SKIPPED' | cut -d: -f 4)
run() {
if [[ "$connector" == "all" ]] ; then
  echo "Running: ./gradlew --no-daemon --scan performanceTest"
  ./gradlew --no-daemon --scan performanceTest
else
  if [[ "$connector" == *"base-normalization"* ]]; then
    selected_performance_test="base-normalization"
    performanceTestCommand="$(_to_gradle_path "airbyte-integrations/bases/base-normalization" performanceTest)"
    # avoid schema conflicts when multiple tests for normalization are run concurrently
    export RANDOM_TEST_SCHEMA="true"
  elif [[ "$connector" == *"bases"* ]]; then
    connector_name=$(echo $connector | cut -d / -f 2)
    selected_performance_test=$(echo "$all_performance_tests" | grep "^$connector_name$" || echo "")
    performanceTestCommand="$(_to_gradle_path "airbyte-integrations/$connector" performanceTest)"
  elif [[ "$connector" == *"connectors"* ]]; then
    connector_name=$(echo $connector | cut -d / -f 2)
    selected_performance_test=$(echo "$all_performance_tests" | grep "^$connector_name$" || echo "")
    performanceTestCommand="$(_to_gradle_path "airbyte-integrations/$connector" performanceTest)"
  else
    selected_performance_test=$(echo "$all_performance_tests" | grep "^$connector$" || echo "")
    performanceTestCommand=":airbyte-integrations:connectors:$connector:performanceTest"
  fi
  if [ -n "$selected_performance_test" ] ; then
    if [[ "$firstarg" ]]; then
      if [[ "$secondarg" ]]; then
        echo "Running: ./gradlew --no-daemon --scan $performanceTestCommand $firstarg $secondarg"
        ./gradlew --no-daemon --scan "$performanceTestCommand" "$firstarg" "$secondarg"
      else
        echo "Running: ./gradlew --no-daemon --scan $performanceTestCommand $firstarg"
        ./gradlew --no-daemon --scan "$performanceTestCommand" "$firstarg"
      fi
    else
      echo "Running: ./gradlew --no-daemon --scan $performanceTestCommand"
      ./gradlew --no-daemon --scan "$performanceTestCommand"
    fi
  else
    echo "Connector '$connector' not found..."
    return 1
  fi
fi
}

# Copy command output to extract gradle scan link.
run | tee build.out
# return status of "run" command, not "tee"
# https://tldp.org/LDP/abs/html/internalvariables.html#PIPESTATUSREF
run_status=${PIPESTATUS[0]}

test_performance $run_status == "0" || {
   # Build failed
   link=$(cat build.out | grep -a -A1 "Publishing build scan..." | tail -n1 | tr -d "\n")
   # Save gradle scan link to github GRADLE_SCAN_LINK variable for next job.
   # https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
   echo "GRADLE_SCAN_LINK=$link" >> $GITHUB_ENV
   exit $run_status
}

# Build successed
coverage_report=`sed -n '/^[ \t]*-\+ coverage: /,/TOTAL   /p' build.out`

if ! test_performance -z "$coverage_report"
then
   echo "PYTHON_UNITTEST_COVERAGE_REPORT<<EOF" >> $GITHUB_ENV
   echo "Python tests coverage:" >> $GITHUB_ENV
   echo '```' >> $GITHUB_ENV
   echo "$coverage_report" >> $GITHUB_ENV
   echo '```' >> $GITHUB_ENV
   echo "EOF" >> $GITHUB_ENV
else
   echo "PYTHON_UNITTEST_COVERAGE_REPORT=No Python unittests run" >> $GITHUB_ENV
fi