From e378eedd90384712b7b7b406d3de21e54ef0a7b1 Mon Sep 17 00:00:00 2001 From: Sergey Avseyev Date: Thu, 8 Jan 2026 21:54:16 +0000 Subject: [PATCH 1/8] [backport] Run CI workflows on maintenance branches (#205) --- .github/workflows/tests.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 242eb66a..ca500c04 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,9 +3,13 @@ permissions: {} on: push: - branches: [main] + branches: + - main + - release* pull_request: - branches: [main] + branches: + - main + - release* concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} From 4224d7a3e385da68eb3494df9837d761f28dd478 Mon Sep 17 00:00:00 2001 From: Dimitris Christodoulou <36637689+DemetrisChr@users.noreply.github.com> Date: Tue, 6 Jan 2026 14:39:21 +0000 Subject: [PATCH 2/8] [backport] Bump version of macOS x86 runners Backport of #200 --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ca500c04..81efb385 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -367,7 +367,7 @@ jobs: build_macos_x86_64: needs: source - runs-on: macos-13 + runs-on: macos-15-intel strategy: fail-fast: false matrix: @@ -406,7 +406,7 @@ jobs: needs: - source - build_macos_x86_64 - runs-on: macos-13 + runs-on: macos-15-intel steps: - uses: actions/download-artifact@v4 with: @@ -569,7 +569,7 @@ jobs: needs: - source - repackage_macos_x86_64 - runs-on: macos-13 + runs-on: macos-15-intel strategy: fail-fast: false matrix: From 3aaf4c3ad38b1caf988b1934983bde9735b945c0 Mon Sep 17 00:00:00 2001 From: Dimitris Christodoulou <36637689+DemetrisChr@users.noreply.github.com> Date: Tue, 6 Jan 2026 16:58:02 +0000 Subject: [PATCH 3/8] [backport] Fix GoCaves download error on macOS Backport of #193 --- Gemfile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Gemfile b/Gemfile index 261e2d87..e1935d30 100644 --- a/Gemfile +++ b/Gemfile @@ -44,4 +44,15 @@ group :development do gem "ruby-lsp", require: false gem "simplecov-cobertura" gem "yard" + + # Resolves https://github.com/ruby/openssl/issues/949 which we encounter when downloading gocaves on macOS on CI + # This has been fixed in openssl versions 3.1.2, 3.2.2, 3.3.1. + # The latest dot-patch version of Ruby 3.3 and 3.4 now comes with a new enough openssl version by default. + if RUBY_PLATFORM.include?("darwin") + if RUBY_VERSION.start_with?('3.2') + gem "openssl", "~> 3.2.2" + elsif RUBY_VERSION.start_with?('3.1') + gem "openssl", "~> 3.1.2" + end + end end From a16047a42fd7ca09b0af35488b659705dd888672 Mon Sep 17 00:00:00 2001 From: Sergey Avseyev Date: Fri, 9 Jan 2026 11:58:54 -0800 Subject: [PATCH 4/8] Fix minitest on CI --- .github/workflows/tests.yml | 31 +++++++++++++++++++++++++++++++ .gitignore | 1 + Gemfile | 14 ++------------ test/mock_helper.rb | 21 ++++++++++++--------- 4 files changed, 46 insertions(+), 21 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 81efb385..8a522445 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -26,6 +26,10 @@ jobs: submodules: recursive fetch-depth: 0 fetch-tags: true + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y libcurl4-openssl-dev - uses: ruby/setup-ruby@v1 with: ruby-version: 3.3 @@ -109,6 +113,7 @@ jobs: make \ openssl \ openssl-dev \ + curl-dev \ readline-dev \ ruby \ tar \ @@ -454,6 +459,10 @@ jobs: - '3.3' - '3.4' steps: + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y libcurl4-openssl-dev - uses: actions/download-artifact@v4 with: name: couchbase-${{ needs.source.outputs.gem_version }}-x86_64-linux @@ -555,6 +564,15 @@ jobs: logs/* test/**/*.{log,xml} retention-days: 5 + - name: Upload crash logs + if: failure() + uses: actions/upload-artifact@v4 + with: + name: ${{ github.job }}-${{ github.run_attempt }}-${{ matrix.ruby }}-crash + path: | + ~/Library/Logs/DiagnosticReports/ + /Library/Logs/DiagnosticReports/ + retention-days: 5 - name: Publish Test Report uses: mikepenz/action-junit-report@v4.1.0 if: always() @@ -616,6 +634,15 @@ jobs: logs/* test/**/*.{log,xml} retention-days: 5 + - name: Upload crash logs + if: failure() + uses: actions/upload-artifact@v4 + with: + name: ${{ github.job }}-${{ github.run_attempt }}-${{ matrix.ruby }}-crash + path: | + ~/Library/Logs/DiagnosticReports/ + /Library/Logs/DiagnosticReports/ + retention-days: 5 - name: Publish Test Report uses: mikepenz/action-junit-report@v4.1.0 if: always() @@ -640,6 +667,10 @@ jobs: - 7.1.6 - 7.0.5 steps: + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y libcurl4-openssl-dev - name: Install cbdinocluster run: | mkdir -p "$HOME/bin" diff --git a/.gitignore b/.gitignore index 448c2d67..78599282 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ /pkg/ /test/reports/ /tmp/ +/logs/ /vendor/bundle/ Gemfile.lock Makefile diff --git a/Gemfile b/Gemfile index e1935d30..08d33a54 100644 --- a/Gemfile +++ b/Gemfile @@ -23,6 +23,7 @@ gem "rake" group :development do gem "activesupport", "~> 7.0.3" + gem "curb" gem "drb" gem "faker" gem "flay" @@ -30,7 +31,7 @@ group :development do gem "gem-compiler" gem "grpc-tools", "~> 1.59" gem "heckle" - gem "minitest" + gem "minitest", "< 6.0" gem "minitest-reporters" gem "mutex_m" gem "rack" @@ -44,15 +45,4 @@ group :development do gem "ruby-lsp", require: false gem "simplecov-cobertura" gem "yard" - - # Resolves https://github.com/ruby/openssl/issues/949 which we encounter when downloading gocaves on macOS on CI - # This has been fixed in openssl versions 3.1.2, 3.2.2, 3.3.1. - # The latest dot-patch version of Ruby 3.3 and 3.4 now comes with a new enough openssl version by default. - if RUBY_PLATFORM.include?("darwin") - if RUBY_VERSION.start_with?('3.2') - gem "openssl", "~> 3.2.2" - elsif RUBY_VERSION.start_with?('3.1') - gem "openssl", "~> 3.1.2" - end - end end diff --git a/test/mock_helper.rb b/test/mock_helper.rb index d26cb6dc..be8bb844 100755 --- a/test/mock_helper.rb +++ b/test/mock_helper.rb @@ -20,30 +20,33 @@ require "fileutils" require "tmpdir" require "socket" +require "curb" class Caves attr_accessor :verbose - VERSION = "v0.0.1-78" + VERSION = "v0.0.1-79" FORK = "couchbaselabs" def download_mock(url = caves_url) return if binary_ready? puts "download #{url}" - resp = Net::HTTP.get_response(URI.parse(url)) - case resp - when Net::HTTPSuccess - raise "Unexpected content type: #{resp['content-type']}" if resp["content-type"] != "application/octet-stream" + curl = Curl::Easy.new(url) do |c| + c.follow_location = true + c.max_redirects = 5 + end + curl.perform + case curl.response_code + when 200..299 + raise "Unexpected content type: #{curl.content_type}" if curl.content_type != "application/octet-stream" FileUtils.mkdir_p(caves_dir, verbose: verbose?) - File.write(mock_path, resp.body, binmode: true) + File.write(mock_path, curl.body, binmode: true) FileUtils.chmod("a+x", mock_path, verbose: verbose?) unless windows? - when Net::HTTPRedirection - download_mock(resp["location"]) else - raise "Unable to download mock from #{url}: #{resp.status}" + raise "Unable to download mock from #{url}: #{curl.response_code}" end end From b9a351aed6f83d46ee9eead4d309ebd5032861fe Mon Sep 17 00:00:00 2001 From: Sergey Avseyev Date: Mon, 12 Jan 2026 09:41:29 -0800 Subject: [PATCH 5/8] debug openssl on macos --- .github/workflows/debug.yml | 298 ++++++++++++++++++ .github/workflows/linters.yml | 10 +- .github/workflows/tests.yml | 10 +- Gemfile | 3 +- bin/console | 14 + ext/CMakeLists.txt | 5 +- lib/couchbase/cluster.rb | 2 +- .../protostellar/generated/kv/v1/kv_pb.rb | 2 + test/protostellar/retry_orchestrator_test.rb | 2 + test/search_test.rb | 19 ++ 10 files changed, 356 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/debug.yml diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml new file mode 100644 index 00000000..d9ee6136 --- /dev/null +++ b/.github/workflows/debug.yml @@ -0,0 +1,298 @@ +name: debug +permissions: {} + +on: + push: + branches: + - main + - release* + pull_request: + branches: + - main + - release* + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + debug_source: + runs-on: ubuntu-22.04 + outputs: + gem_version: ${{ steps.build_gem.outputs.gem_version }} + steps: + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y libcurl4-openssl-dev + - uses: actions/checkout@v4 + with: + submodules: recursive + fetch-depth: 0 + fetch-tags: true + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.3 + bundler-cache: true + - name: Build + id: build_gem + run: | + COMMITS_SINCE_LAST_TAG=$(git describe --tags --always --long | awk -F '-' '{print $2}') + ruby bin/jenkins/patch-version.rb ${COMMITS_SINCE_LAST_TAG} + GEM_VERSION=$(ruby -r ./lib/couchbase/version.rb -e "puts Couchbase::VERSION[:sdk]") + echo "gem_version=${GEM_VERSION}" >> "$GITHUB_OUTPUT" + bundle exec rake build + - name: RDoc + run: | + cat > patch-readme.rb </dev/null | head -10 || echo "No system ssl libs found" + ls -la /usr/lib/libssl* /System/Library/Frameworks/Security.framework/libssl* 2>/dev/null || echo "No explicit libssl*" + openssl version || echo "OpenSSL CLI not found" + echo "--- Homebrew OpenSSL:" + ls -la /opt/homebrew/lib/libssl* /usr/local/lib/libssl* 2>/dev/null || echo "No Homebrew libssl" + echo "--- Ruby lib path (for native exts):" + ruby -e 'puts RbConfig::CONFIG["libdir"] + "/ruby/" + RbConfig::CONFIG["ruby_version"]' + + - name: Check Ruby OpenSSL + run: | + ruby -r openssl -e " + puts 'Ruby OpenSSL version: ' + OpenSSL::OPENSSL_VERSION + ctx = OpenSSL::SSL::SSLContext.new + puts 'SSLContext min_version: ' + (ctx.respond_to?(:min_version) ? ctx.min_version.to_s : 'unsupported') + puts 'SSLContext max_version: ' + (ctx.respond_to?(:max_version) ? ctx.max_version.to_s : 'unsupported') + puts 'SSL config file: ' + (defined?(OpenSSL::OPENSSL_CONF) ? OpenSSL::OPENSSL_CONF.to_s : 'undefined') + begin + engines = OpenSSL::Engine.engines + puts 'Loaded OpenSSL engines: ' + engines.map(&:name).join(', ') + rescue NameError + puts 'OpenSSL::Engine unavailable' + end + " || echo "Ruby OpenSSL check completed (ignore NameError)" + + - name: Test OpenSSL HTTPS fetch + run: | + ruby -e " + require 'net/http'; require 'uri'; require 'openssl' + uri = URI('https://www.couchbase.com/') + http = Net::HTTP.new(uri.host, uri.port) + http.use_ssl = true + http.verify_mode = OpenSSL::SSL::VERIFY_PEER + begin + response = http.get(uri.path.empty? ? '/' : uri.path) + puts 'SUCCESS: HTTP ' + response.code + ' - ' + response['content-type'] + puts 'SSL handshake OK - OpenSSL functional' + rescue OpenSSL::SSL::SSLError => e + puts 'SSL Error: ' + e.message + rescue => e + puts 'Error: ' + e.class.name + ' - ' + e.message + end + " + + debug_build_macos_x86_64: + needs: debug_source + runs-on: macos-15-intel + strategy: + fail-fast: false + matrix: + ruby: + - '3.3' + steps: + - uses: hendrikmuhs/ccache-action@v1.2 + with: + max-size: 2G + key: ${{ github.job }}-${{ matrix.ruby }} + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + - uses: actions/download-artifact@v4 + with: + name: couchbase-${{ needs.debug_source.outputs.gem_version }} + - name: Precompile + env: + CB_STATIC_BORINGSSL: 1 + CB_STATIC_STDLIB: 1 + CB_REMOVE_EXT_DIRECTORY: 1 + run: | + gem install gem-compiler + gem compile --prune couchbase-${{ needs.debug_source.outputs.gem_version }}.gem + - uses: actions/upload-artifact@v4 + with: + retention-days: 1 + name: couchbase-${{ needs.debug_source.outputs.gem_version }}-x86_64-darwin-${{ matrix.ruby }} + path: | + *-x86_64-darwin*.gem + + debug_repackage_macos_x86_64: + needs: + - debug_source + - debug_build_macos_x86_64 + runs-on: macos-15-intel + steps: + - uses: actions/download-artifact@v4 + with: + name: scripts-${{ needs.debug_source.outputs.gem_version }} + - uses: actions/download-artifact@v4 + with: + path: pkg/binary/3.3 + name: couchbase-${{ needs.debug_source.outputs.gem_version }}-x86_64-darwin-3.3 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.3 + - name: Repackage + run: | + ruby bin/jenkins/repackage-extension.rb + - uses: actions/upload-artifact@v4 + with: + name: couchbase-${{ needs.debug_source.outputs.gem_version }}-x86_64-darwin + path: | + pkg/fat/*.gem + + debug_mock_macos_x86_64: + timeout-minutes: 15 + needs: + - debug_source + - debug_repackage_macos_x86_64 + runs-on: macos-15-intel + strategy: + fail-fast: false + matrix: + ruby: + - '3.3' + steps: + - uses: actions/download-artifact@v4 + with: + name: couchbase-${{ needs.debug_source.outputs.gem_version }}-x86_64-darwin + - uses: actions/download-artifact@v4 + with: + name: scripts-${{ needs.debug_source.outputs.gem_version }} + - uses: actions/download-artifact@v4 + with: + name: tests-${{ needs.debug_source.outputs.gem_version }} + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + - name: Install + run: | + COUCHBASE_GEM_PATH=$(realpath couchbase-*.gem) + UNPACKED_GEM_PATH=$(gem unpack ${COUCHBASE_GEM_PATH} | grep "Unpacked gem" | cut -d "'" -f 2) + gem unpack --spec --target ${UNPACKED_GEM_PATH} ${COUCHBASE_GEM_PATH} + ruby -i.bak -pe "gsub(/gemspec/, 'gem \"couchbase\", path: \"${UNPACKED_GEM_PATH}\"')" Gemfile + bundle install + export DYLD_BIND_AT_LAUNCH=1 + export DYLD_PRINT_LIBRARIES=1 + bundle exec ruby -r bundler/setup -r couchbase -e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO' + + - name: Check ALL gem library dependencies + run: | + set -ex + + echo "=== Before exports ===" + echo "DYLD_LIBRARY_PATH: $DYLD_LIBRARY_PATH" + echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH" + echo "PATH: $PATH" + + echo "DYLD_LIBRARY_PATH: $DYLD_LIBRARY_PATH" + echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH" + + echo "=== libruby.3.3.dylib ===" + otool -L /Users/runner/hostedtoolcache/Ruby/3.3.10/x64/lib/libruby.3.3.dylib || true + + echo "=== ALL Gem shared objects (dylib/bundle/so) ===" + bundle exec ruby -e ' + libs = Gem.loaded_specs.values.map{|x| Dir["#{x.full_gem_path}/**/*.{dylib,bundle,so}"]}.flatten.sort.uniq + puts "Found #{libs.size} libraries:" + puts libs + libs.each do |lib| + puts "=== #{lib} ===" + system("otool", "-L", lib) + system("nm", "-uU", lib) + end + ' || true + + export DYLD_LIBRARY_PATH="/usr/local/lib:/opt/homebrew/lib:$DYLD_LIBRARY_PATH" + export LD_LIBRARY_PATH="/usr/local/lib:/opt/homebrew/lib:$LD_LIBRARY_PATH" + + echo "=== After exports ===" + echo "DYLD_LIBRARY_PATH: $DYLD_LIBRARY_PATH" + echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH" + echo "PATH: $PATH" + + echo "=== libruby.3.3.dylib ===" + otool -L /Users/runner/hostedtoolcache/Ruby/3.3.10/x64/lib/libruby.3.3.dylib || true + + echo "=== ALL Gem shared objects (dylib/bundle/so) ===" + bundle exec ruby -e ' + libs = Gem.loaded_specs.values.map{|x| Dir["#{x.full_gem_path}/**/*.{dylib,bundle,so}"]}.flatten.sort.uniq + puts "Found #{libs.size} libraries:" + puts libs + libs.each do |lib| + puts "=== #{lib} ===" + system("otool", "-L", lib) + system("nm", "-uU", lib) + end + ' || true + + export DYLD_PRINT_LIBRARIES=1 + bundle exec ruby -r bundler/setup -r couchbase -e 'pp Couchbase::Cluster.connect("couchbases://127.0.0.1", "Administrator", "password")' diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index afcda6a3..5b52512c 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -3,9 +3,15 @@ permissions: {} on: push: - branches: [ main ] + branches: + - do_not_run + # - main + # - release* pull_request: - branches: [ main ] + branches: + - do_not_run + # - main + # - release* env: LLVM_VERSION: 20 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8a522445..d2a5bc54 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,12 +4,14 @@ permissions: {} on: push: branches: - - main - - release* + - do_not_run + # - main + # - release* pull_request: branches: - - main - - release* + - do_not_run + # - main + # - release* concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} diff --git a/Gemfile b/Gemfile index 08d33a54..130c990d 100644 --- a/Gemfile +++ b/Gemfile @@ -24,12 +24,13 @@ gem "rake" group :development do gem "activesupport", "~> 7.0.3" gem "curb" + gem "irb" gem "drb" gem "faker" gem "flay" gem "flog" gem "gem-compiler" - gem "grpc-tools", "~> 1.59" + gem "grpc-tools", "~> 1.59", require: false gem "heckle" gem "minitest", "< 6.0" gem "minitest-reporters" diff --git a/bin/console b/bin/console index 8c48bdae..00e93caa 100755 --- a/bin/console +++ b/bin/console @@ -15,6 +15,20 @@ # See the License for the specific language governing permissions and # limitations under the License. +if ARGV.delete("--trace-loaded-features") || ENV["COUCHBASE_TRACE_LOADED_FEATURES"] + loaded_before = $LOADED_FEATURES.dup + set_trace_func -> (event, file, line, id, binding, klass) do + if event == 'c-return' && [:require, :load].include?(id) + new_loads = $LOADED_FEATURES - loaded_before + unless new_loads.empty? + puts "#{file}:#{line}" + new_loads.each { |path| puts " LOADED: #{path}" } + loaded_before.concat(new_loads) + end + end + end +end + require "bundler/setup" require "irb" require "open3" diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt index 827900f1..4c813a7e 100644 --- a/ext/CMakeLists.txt +++ b/ext/CMakeLists.txt @@ -87,5 +87,8 @@ if(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang") endif() if(APPLE) - target_link_libraries(couchbase PRIVATE -Wl,-undefined,dynamic_lookup) + target_link_options(couchbase PRIVATE + # -Wl,-undefined,dynamic_lookup + -Wl,-dead_strip + ) endif() diff --git a/lib/couchbase/cluster.rb b/lib/couchbase/cluster.rb index 7f9ecae6..9a39fd52 100644 --- a/lib/couchbase/cluster.rb +++ b/lib/couchbase/cluster.rb @@ -27,7 +27,7 @@ require "couchbase/analytics_options" require "couchbase/diagnostics" -require "couchbase/protostellar" +# require "couchbase/protostellar" module Couchbase # The main entry point when connecting to a Couchbase cluster. diff --git a/lib/couchbase/protostellar/generated/kv/v1/kv_pb.rb b/lib/couchbase/protostellar/generated/kv/v1/kv_pb.rb index c2622404..98eadb5e 100644 --- a/lib/couchbase/protostellar/generated/kv/v1/kv_pb.rb +++ b/lib/couchbase/protostellar/generated/kv/v1/kv_pb.rb @@ -2,6 +2,8 @@ # Generated by the protocol buffer compiler. DO NOT EDIT! # source: couchbase/kv/v1/kv.proto +raise "should not be loaded at all" + require 'google/protobuf' require 'google/rpc/status_pb' diff --git a/test/protostellar/retry_orchestrator_test.rb b/test/protostellar/retry_orchestrator_test.rb index 64d7adde..5d413776 100644 --- a/test/protostellar/retry_orchestrator_test.rb +++ b/test/protostellar/retry_orchestrator_test.rb @@ -2,6 +2,8 @@ require "test_helper" +return + require "couchbase/protostellar/request_generator/kv" require "couchbase/protostellar/request_behaviour" require "couchbase/protostellar/retry/orchestrator" diff --git a/test/search_test.rb b/test/search_test.rb index dabc2c63..f38e2461 100644 --- a/test/search_test.rb +++ b/test/search_test.rb @@ -14,6 +14,25 @@ # See the License for the specific language governing permissions and # limitations under the License. +if ENV["COUCHBASE_TRACE_LOADED_FEATURES"] + unless defined?(COUCHBASE_LOADED_FEATURES_TRACE_FUNC) + loaded_before = $LOADED_FEATURES.dup + + COUCHBASE_LOADED_FEATURES_TRACE_FUNC = -> (event, file, line, id, binding, klass) do + if event == 'c-return' && [:require, :load].include?(id) + new_loads = $LOADED_FEATURES - loaded_before + unless new_loads.empty? + puts "#{file}:#{line}" + new_loads.each { |path| puts " LOADED: #{path}" } + loaded_before.concat(new_loads) + end + end + end + + set_trace_func(COUCHBASE_LOADED_FEATURES_TRACE_FUNC) + end +end + require_relative "test_helper" module Couchbase From 2cd94d9465cb20a14da87c7f82b6b63dfe01877c Mon Sep 17 00:00:00 2001 From: Sergey Avseyev Date: Wed, 14 Jan 2026 12:57:27 -0800 Subject: [PATCH 6/8] switch core to WIP fix --- .gitmodules | 3 ++- ext/couchbase | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 9c00953b..40941e2e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,7 +3,8 @@ url = https://github.com/couchbaselabs/sdk-testcases.git [submodule "ext/couchbase"] path = ext/couchbase - url = https://github.com/couchbaselabs/couchbase-cxx-client.git + #url = https://github.com/couchbaselabs/couchbase-cxx-client.git + url = https://github.com/avsej/couchbase-cxx-client.git [submodule "deps/protostellar"] path = deps/protostellar url = https://github.com/couchbase/protostellar.git diff --git a/ext/couchbase b/ext/couchbase index c2439a40..99797862 160000 --- a/ext/couchbase +++ b/ext/couchbase @@ -1 +1 @@ -Subproject commit c2439a404fa6b276862fe81150b1326bf98e6164 +Subproject commit 99797862a6ecbba8a86a11bd05a0d64ec7cb1c34 From 4df62076c3c45d84888ab9e9c4b2dd366d446279 Mon Sep 17 00:00:00 2001 From: Sergey Avseyev Date: Wed, 14 Jan 2026 13:08:21 -0800 Subject: [PATCH 7/8] rollback dead_strip and dynamic_lookup for undefined --- ext/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt index 4c813a7e..478e6d7f 100644 --- a/ext/CMakeLists.txt +++ b/ext/CMakeLists.txt @@ -88,7 +88,6 @@ endif() if(APPLE) target_link_options(couchbase PRIVATE - # -Wl,-undefined,dynamic_lookup - -Wl,-dead_strip + -Wl,-undefined,dynamic_lookup ) endif() From 165aa69d11ba1a57d7b87288915374b488a57763 Mon Sep 17 00:00:00 2001 From: Sergey Avseyev Date: Wed, 14 Jan 2026 13:32:04 -0800 Subject: [PATCH 8/8] restore main workflows --- .github/workflows/debug.yml | 298 ---------------------------------- .github/workflows/linters.yml | 10 +- .github/workflows/tests.yml | 10 +- 3 files changed, 8 insertions(+), 310 deletions(-) delete mode 100644 .github/workflows/debug.yml diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml deleted file mode 100644 index d9ee6136..00000000 --- a/.github/workflows/debug.yml +++ /dev/null @@ -1,298 +0,0 @@ -name: debug -permissions: {} - -on: - push: - branches: - - main - - release* - pull_request: - branches: - - main - - release* - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - debug_source: - runs-on: ubuntu-22.04 - outputs: - gem_version: ${{ steps.build_gem.outputs.gem_version }} - steps: - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y libcurl4-openssl-dev - - uses: actions/checkout@v4 - with: - submodules: recursive - fetch-depth: 0 - fetch-tags: true - - uses: ruby/setup-ruby@v1 - with: - ruby-version: 3.3 - bundler-cache: true - - name: Build - id: build_gem - run: | - COMMITS_SINCE_LAST_TAG=$(git describe --tags --always --long | awk -F '-' '{print $2}') - ruby bin/jenkins/patch-version.rb ${COMMITS_SINCE_LAST_TAG} - GEM_VERSION=$(ruby -r ./lib/couchbase/version.rb -e "puts Couchbase::VERSION[:sdk]") - echo "gem_version=${GEM_VERSION}" >> "$GITHUB_OUTPUT" - bundle exec rake build - - name: RDoc - run: | - cat > patch-readme.rb </dev/null | head -10 || echo "No system ssl libs found" - ls -la /usr/lib/libssl* /System/Library/Frameworks/Security.framework/libssl* 2>/dev/null || echo "No explicit libssl*" - openssl version || echo "OpenSSL CLI not found" - echo "--- Homebrew OpenSSL:" - ls -la /opt/homebrew/lib/libssl* /usr/local/lib/libssl* 2>/dev/null || echo "No Homebrew libssl" - echo "--- Ruby lib path (for native exts):" - ruby -e 'puts RbConfig::CONFIG["libdir"] + "/ruby/" + RbConfig::CONFIG["ruby_version"]' - - - name: Check Ruby OpenSSL - run: | - ruby -r openssl -e " - puts 'Ruby OpenSSL version: ' + OpenSSL::OPENSSL_VERSION - ctx = OpenSSL::SSL::SSLContext.new - puts 'SSLContext min_version: ' + (ctx.respond_to?(:min_version) ? ctx.min_version.to_s : 'unsupported') - puts 'SSLContext max_version: ' + (ctx.respond_to?(:max_version) ? ctx.max_version.to_s : 'unsupported') - puts 'SSL config file: ' + (defined?(OpenSSL::OPENSSL_CONF) ? OpenSSL::OPENSSL_CONF.to_s : 'undefined') - begin - engines = OpenSSL::Engine.engines - puts 'Loaded OpenSSL engines: ' + engines.map(&:name).join(', ') - rescue NameError - puts 'OpenSSL::Engine unavailable' - end - " || echo "Ruby OpenSSL check completed (ignore NameError)" - - - name: Test OpenSSL HTTPS fetch - run: | - ruby -e " - require 'net/http'; require 'uri'; require 'openssl' - uri = URI('https://www.couchbase.com/') - http = Net::HTTP.new(uri.host, uri.port) - http.use_ssl = true - http.verify_mode = OpenSSL::SSL::VERIFY_PEER - begin - response = http.get(uri.path.empty? ? '/' : uri.path) - puts 'SUCCESS: HTTP ' + response.code + ' - ' + response['content-type'] - puts 'SSL handshake OK - OpenSSL functional' - rescue OpenSSL::SSL::SSLError => e - puts 'SSL Error: ' + e.message - rescue => e - puts 'Error: ' + e.class.name + ' - ' + e.message - end - " - - debug_build_macos_x86_64: - needs: debug_source - runs-on: macos-15-intel - strategy: - fail-fast: false - matrix: - ruby: - - '3.3' - steps: - - uses: hendrikmuhs/ccache-action@v1.2 - with: - max-size: 2G - key: ${{ github.job }}-${{ matrix.ruby }} - - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - - uses: actions/download-artifact@v4 - with: - name: couchbase-${{ needs.debug_source.outputs.gem_version }} - - name: Precompile - env: - CB_STATIC_BORINGSSL: 1 - CB_STATIC_STDLIB: 1 - CB_REMOVE_EXT_DIRECTORY: 1 - run: | - gem install gem-compiler - gem compile --prune couchbase-${{ needs.debug_source.outputs.gem_version }}.gem - - uses: actions/upload-artifact@v4 - with: - retention-days: 1 - name: couchbase-${{ needs.debug_source.outputs.gem_version }}-x86_64-darwin-${{ matrix.ruby }} - path: | - *-x86_64-darwin*.gem - - debug_repackage_macos_x86_64: - needs: - - debug_source - - debug_build_macos_x86_64 - runs-on: macos-15-intel - steps: - - uses: actions/download-artifact@v4 - with: - name: scripts-${{ needs.debug_source.outputs.gem_version }} - - uses: actions/download-artifact@v4 - with: - path: pkg/binary/3.3 - name: couchbase-${{ needs.debug_source.outputs.gem_version }}-x86_64-darwin-3.3 - - uses: ruby/setup-ruby@v1 - with: - ruby-version: 3.3 - - name: Repackage - run: | - ruby bin/jenkins/repackage-extension.rb - - uses: actions/upload-artifact@v4 - with: - name: couchbase-${{ needs.debug_source.outputs.gem_version }}-x86_64-darwin - path: | - pkg/fat/*.gem - - debug_mock_macos_x86_64: - timeout-minutes: 15 - needs: - - debug_source - - debug_repackage_macos_x86_64 - runs-on: macos-15-intel - strategy: - fail-fast: false - matrix: - ruby: - - '3.3' - steps: - - uses: actions/download-artifact@v4 - with: - name: couchbase-${{ needs.debug_source.outputs.gem_version }}-x86_64-darwin - - uses: actions/download-artifact@v4 - with: - name: scripts-${{ needs.debug_source.outputs.gem_version }} - - uses: actions/download-artifact@v4 - with: - name: tests-${{ needs.debug_source.outputs.gem_version }} - - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - - name: Install - run: | - COUCHBASE_GEM_PATH=$(realpath couchbase-*.gem) - UNPACKED_GEM_PATH=$(gem unpack ${COUCHBASE_GEM_PATH} | grep "Unpacked gem" | cut -d "'" -f 2) - gem unpack --spec --target ${UNPACKED_GEM_PATH} ${COUCHBASE_GEM_PATH} - ruby -i.bak -pe "gsub(/gemspec/, 'gem \"couchbase\", path: \"${UNPACKED_GEM_PATH}\"')" Gemfile - bundle install - export DYLD_BIND_AT_LAUNCH=1 - export DYLD_PRINT_LIBRARIES=1 - bundle exec ruby -r bundler/setup -r couchbase -e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO' - - - name: Check ALL gem library dependencies - run: | - set -ex - - echo "=== Before exports ===" - echo "DYLD_LIBRARY_PATH: $DYLD_LIBRARY_PATH" - echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH" - echo "PATH: $PATH" - - echo "DYLD_LIBRARY_PATH: $DYLD_LIBRARY_PATH" - echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH" - - echo "=== libruby.3.3.dylib ===" - otool -L /Users/runner/hostedtoolcache/Ruby/3.3.10/x64/lib/libruby.3.3.dylib || true - - echo "=== ALL Gem shared objects (dylib/bundle/so) ===" - bundle exec ruby -e ' - libs = Gem.loaded_specs.values.map{|x| Dir["#{x.full_gem_path}/**/*.{dylib,bundle,so}"]}.flatten.sort.uniq - puts "Found #{libs.size} libraries:" - puts libs - libs.each do |lib| - puts "=== #{lib} ===" - system("otool", "-L", lib) - system("nm", "-uU", lib) - end - ' || true - - export DYLD_LIBRARY_PATH="/usr/local/lib:/opt/homebrew/lib:$DYLD_LIBRARY_PATH" - export LD_LIBRARY_PATH="/usr/local/lib:/opt/homebrew/lib:$LD_LIBRARY_PATH" - - echo "=== After exports ===" - echo "DYLD_LIBRARY_PATH: $DYLD_LIBRARY_PATH" - echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH" - echo "PATH: $PATH" - - echo "=== libruby.3.3.dylib ===" - otool -L /Users/runner/hostedtoolcache/Ruby/3.3.10/x64/lib/libruby.3.3.dylib || true - - echo "=== ALL Gem shared objects (dylib/bundle/so) ===" - bundle exec ruby -e ' - libs = Gem.loaded_specs.values.map{|x| Dir["#{x.full_gem_path}/**/*.{dylib,bundle,so}"]}.flatten.sort.uniq - puts "Found #{libs.size} libraries:" - puts libs - libs.each do |lib| - puts "=== #{lib} ===" - system("otool", "-L", lib) - system("nm", "-uU", lib) - end - ' || true - - export DYLD_PRINT_LIBRARIES=1 - bundle exec ruby -r bundler/setup -r couchbase -e 'pp Couchbase::Cluster.connect("couchbases://127.0.0.1", "Administrator", "password")' diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 5b52512c..a905c6c2 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -4,14 +4,12 @@ permissions: {} on: push: branches: - - do_not_run - # - main - # - release* + - main + - release* pull_request: branches: - - do_not_run - # - main - # - release* + - main + - release* env: LLVM_VERSION: 20 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index d2a5bc54..8a522445 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -4,14 +4,12 @@ permissions: {} on: push: branches: - - do_not_run - # - main - # - release* + - main + - release* pull_request: branches: - - do_not_run - # - main - # - release* + - main + - release* concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}