|
| 1 | +name: debug |
| 2 | +permissions: {} |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - main |
| 8 | + - release* |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - main |
| 12 | + - release* |
| 13 | + |
| 14 | +concurrency: |
| 15 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 16 | + cancel-in-progress: true |
| 17 | + |
| 18 | +jobs: |
| 19 | + debug_source: |
| 20 | + runs-on: ubuntu-22.04 |
| 21 | + outputs: |
| 22 | + gem_version: ${{ steps.build_gem.outputs.gem_version }} |
| 23 | + steps: |
| 24 | + - name: Install dependencies |
| 25 | + run: | |
| 26 | + sudo apt-get update |
| 27 | + sudo apt-get install -y libcurl4-openssl-dev |
| 28 | + - uses: actions/checkout@v4 |
| 29 | + with: |
| 30 | + submodules: recursive |
| 31 | + fetch-depth: 0 |
| 32 | + fetch-tags: true |
| 33 | + - uses: ruby/setup-ruby@v1 |
| 34 | + with: |
| 35 | + ruby-version: 3.3 |
| 36 | + bundler-cache: true |
| 37 | + - name: Build |
| 38 | + id: build_gem |
| 39 | + run: | |
| 40 | + COMMITS_SINCE_LAST_TAG=$(git describe --tags --always --long | awk -F '-' '{print $2}') |
| 41 | + ruby bin/jenkins/patch-version.rb ${COMMITS_SINCE_LAST_TAG} |
| 42 | + GEM_VERSION=$(ruby -r ./lib/couchbase/version.rb -e "puts Couchbase::VERSION[:sdk]") |
| 43 | + echo "gem_version=${GEM_VERSION}" >> "$GITHUB_OUTPUT" |
| 44 | + bundle exec rake build |
| 45 | + - name: RDoc |
| 46 | + run: | |
| 47 | + cat > patch-readme.rb <<EOF |
| 48 | + require_relative "./lib/couchbase/version.rb" |
| 49 | + gemfile = <<EOS.strip |
| 50 | + gem "couchbase", "#{Couchbase::VERSION[:sdk]}" |
| 51 | + EOS |
| 52 | + old_content = File.read("README.md") |
| 53 | + new_content = old_content.gsub(/(gem "couchbase", ").*?"/, gemfile) |
| 54 | + File.write("README.md", new_content) |
| 55 | + EOF |
| 56 | + ruby patch-readme.rb |
| 57 | + bundle exec yard doc --hide-api private --output-dir docs/couchbase-ruby-client-${{ steps.build_gem.outputs.gem_version }} lib --main README.md |
| 58 | + - uses: actions/upload-artifact@v4 |
| 59 | + with: |
| 60 | + name: couchbase-${{ steps.build_gem.outputs.gem_version }} |
| 61 | + path: | |
| 62 | + pkg/*.gem |
| 63 | + - uses: actions/upload-artifact@v4 |
| 64 | + with: |
| 65 | + retention-days: 1 |
| 66 | + name: scripts-${{ steps.build_gem.outputs.gem_version }} |
| 67 | + path: | |
| 68 | + Gemfile |
| 69 | + Rakefile |
| 70 | + bin/**/* |
| 71 | + couchbase.gemspec |
| 72 | + lib/couchbase/version.rb |
| 73 | + task/**/* |
| 74 | + - uses: actions/upload-artifact@v4 |
| 75 | + with: |
| 76 | + retention-days: 1 |
| 77 | + name: tests-${{ steps.build_gem.outputs.gem_version }} |
| 78 | + path: | |
| 79 | + test/**/* |
| 80 | + test_data/**/* |
| 81 | + - uses: actions/upload-artifact@v4 |
| 82 | + with: |
| 83 | + name: docs-${{ steps.build_gem.outputs.gem_version }} |
| 84 | + path: | |
| 85 | + docs/**/* |
| 86 | +
|
| 87 | +
|
| 88 | + debug_verify_openssl: |
| 89 | + needs: debug_source |
| 90 | + runs-on: macos-15-intel |
| 91 | + strategy: |
| 92 | + fail-fast: false |
| 93 | + matrix: |
| 94 | + ruby: |
| 95 | + - '3.3' |
| 96 | + steps: |
| 97 | + - uses: hendrikmuhs/[email protected] |
| 98 | + with: |
| 99 | + max-size: 2G |
| 100 | + key: ${{ github.job }}-${{ matrix.ruby }} |
| 101 | + - uses: ruby/setup-ruby@v1 |
| 102 | + with: |
| 103 | + ruby-version: ${{ matrix.ruby }} |
| 104 | + |
| 105 | + - name: Check system OpenSSL & Homebrew |
| 106 | + run: | |
| 107 | + echo "macOS version:" |
| 108 | + /usr/bin/sw_vers |
| 109 | + echo "--- System OpenSSL:" |
| 110 | + find /usr/lib -name '*ssl*' -type f 2>/dev/null | head -10 || echo "No system ssl libs found" |
| 111 | + ls -la /usr/lib/libssl* /System/Library/Frameworks/Security.framework/libssl* 2>/dev/null || echo "No explicit libssl*" |
| 112 | + openssl version || echo "OpenSSL CLI not found" |
| 113 | + echo "--- Homebrew OpenSSL:" |
| 114 | + ls -la /opt/homebrew/lib/libssl* /usr/local/lib/libssl* 2>/dev/null || echo "No Homebrew libssl" |
| 115 | + echo "--- Ruby lib path (for native exts):" |
| 116 | + ruby -e 'puts RbConfig::CONFIG["libdir"] + "/ruby/" + RbConfig::CONFIG["ruby_version"]' |
| 117 | +
|
| 118 | + - name: Check Ruby OpenSSL |
| 119 | + run: | |
| 120 | + ruby -r openssl -e " |
| 121 | + puts 'Ruby OpenSSL version: ' + OpenSSL::OPENSSL_VERSION |
| 122 | + ctx = OpenSSL::SSL::SSLContext.new |
| 123 | + puts 'SSLContext min_version: ' + (ctx.respond_to?(:min_version) ? ctx.min_version.to_s : 'unsupported') |
| 124 | + puts 'SSLContext max_version: ' + (ctx.respond_to?(:max_version) ? ctx.max_version.to_s : 'unsupported') |
| 125 | + puts 'SSL config file: ' + (defined?(OpenSSL::OPENSSL_CONF) ? OpenSSL::OPENSSL_CONF.to_s : 'undefined') |
| 126 | + begin |
| 127 | + engines = OpenSSL::Engine.engines |
| 128 | + puts 'Loaded OpenSSL engines: ' + engines.map(&:name).join(', ') |
| 129 | + rescue NameError |
| 130 | + puts 'OpenSSL::Engine unavailable' |
| 131 | + end |
| 132 | + " || echo "Ruby OpenSSL check completed (ignore NameError)" |
| 133 | +
|
| 134 | + - name: Test OpenSSL HTTPS fetch |
| 135 | + run: | |
| 136 | + ruby -e " |
| 137 | + require 'net/http'; require 'uri'; require 'openssl' |
| 138 | + uri = URI('https://www.couchbase.com/') |
| 139 | + http = Net::HTTP.new(uri.host, uri.port) |
| 140 | + http.use_ssl = true |
| 141 | + http.verify_mode = OpenSSL::SSL::VERIFY_PEER |
| 142 | + begin |
| 143 | + response = http.get(uri.path.empty? ? '/' : uri.path) |
| 144 | + puts 'SUCCESS: HTTP ' + response.code + ' - ' + response['content-type'] |
| 145 | + puts 'SSL handshake OK - OpenSSL functional' |
| 146 | + rescue OpenSSL::SSL::SSLError => e |
| 147 | + puts 'SSL Error: ' + e.message |
| 148 | + rescue => e |
| 149 | + puts 'Error: ' + e.class.name + ' - ' + e.message |
| 150 | + end |
| 151 | + " |
| 152 | +
|
| 153 | + debug_build_macos_x86_64: |
| 154 | + needs: debug_source |
| 155 | + runs-on: macos-15-intel |
| 156 | + strategy: |
| 157 | + fail-fast: false |
| 158 | + matrix: |
| 159 | + ruby: |
| 160 | + - '3.3' |
| 161 | + steps: |
| 162 | + - uses: hendrikmuhs/[email protected] |
| 163 | + with: |
| 164 | + max-size: 2G |
| 165 | + key: ${{ github.job }}-${{ matrix.ruby }} |
| 166 | + - uses: ruby/setup-ruby@v1 |
| 167 | + with: |
| 168 | + ruby-version: ${{ matrix.ruby }} |
| 169 | + - uses: actions/download-artifact@v4 |
| 170 | + with: |
| 171 | + name: couchbase-${{ needs.debug_source.outputs.gem_version }} |
| 172 | + - name: Precompile |
| 173 | + env: |
| 174 | + CB_STATIC_BORINGSSL: 1 |
| 175 | + CB_STATIC_STDLIB: 1 |
| 176 | + CB_REMOVE_EXT_DIRECTORY: 1 |
| 177 | + run: | |
| 178 | + gem install gem-compiler |
| 179 | + gem compile --prune couchbase-${{ needs.debug_source.outputs.gem_version }}.gem |
| 180 | + - uses: actions/upload-artifact@v4 |
| 181 | + with: |
| 182 | + retention-days: 1 |
| 183 | + name: couchbase-${{ needs.debug_source.outputs.gem_version }}-x86_64-darwin-${{ matrix.ruby }} |
| 184 | + path: | |
| 185 | + *-x86_64-darwin*.gem |
| 186 | +
|
| 187 | + debug_repackage_macos_x86_64: |
| 188 | + needs: |
| 189 | + - debug_source |
| 190 | + - debug_build_macos_x86_64 |
| 191 | + runs-on: macos-15-intel |
| 192 | + steps: |
| 193 | + - uses: actions/download-artifact@v4 |
| 194 | + with: |
| 195 | + name: scripts-${{ needs.debug_source.outputs.gem_version }} |
| 196 | + - uses: actions/download-artifact@v4 |
| 197 | + with: |
| 198 | + path: pkg/binary/3.3 |
| 199 | + name: couchbase-${{ needs.debug_source.outputs.gem_version }}-x86_64-darwin-3.3 |
| 200 | + - uses: ruby/setup-ruby@v1 |
| 201 | + with: |
| 202 | + ruby-version: 3.3 |
| 203 | + - name: Repackage |
| 204 | + run: | |
| 205 | + ruby bin/jenkins/repackage-extension.rb |
| 206 | + - uses: actions/upload-artifact@v4 |
| 207 | + with: |
| 208 | + name: couchbase-${{ needs.debug_source.outputs.gem_version }}-x86_64-darwin |
| 209 | + path: | |
| 210 | + pkg/fat/*.gem |
| 211 | +
|
| 212 | + debug_mock_macos_x86_64: |
| 213 | + timeout-minutes: 15 |
| 214 | + needs: |
| 215 | + - debug_source |
| 216 | + - debug_repackage_macos_x86_64 |
| 217 | + runs-on: macos-15-intel |
| 218 | + strategy: |
| 219 | + fail-fast: false |
| 220 | + matrix: |
| 221 | + ruby: |
| 222 | + - '3.3' |
| 223 | + steps: |
| 224 | + - uses: actions/download-artifact@v4 |
| 225 | + with: |
| 226 | + name: couchbase-${{ needs.debug_source.outputs.gem_version }}-x86_64-darwin |
| 227 | + - uses: actions/download-artifact@v4 |
| 228 | + with: |
| 229 | + name: scripts-${{ needs.debug_source.outputs.gem_version }} |
| 230 | + - uses: actions/download-artifact@v4 |
| 231 | + with: |
| 232 | + name: tests-${{ needs.debug_source.outputs.gem_version }} |
| 233 | + - uses: ruby/setup-ruby@v1 |
| 234 | + with: |
| 235 | + ruby-version: ${{ matrix.ruby }} |
| 236 | + - name: Install |
| 237 | + run: | |
| 238 | + COUCHBASE_GEM_PATH=$(realpath couchbase-*.gem) |
| 239 | + UNPACKED_GEM_PATH=$(gem unpack ${COUCHBASE_GEM_PATH} | grep "Unpacked gem" | cut -d "'" -f 2) |
| 240 | + gem unpack --spec --target ${UNPACKED_GEM_PATH} ${COUCHBASE_GEM_PATH} |
| 241 | + ruby -i.bak -pe "gsub(/gemspec/, 'gem \"couchbase\", path: \"${UNPACKED_GEM_PATH}\"')" Gemfile |
| 242 | + bundle install |
| 243 | + export DYLD_BIND_AT_LAUNCH=1 |
| 244 | + export DYLD_PRINT_LIBRARIES=1 |
| 245 | + bundle exec ruby -r bundler/setup -r couchbase -e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO' |
| 246 | +
|
| 247 | + - name: Check ALL gem library dependencies |
| 248 | + run: | |
| 249 | + set -ex |
| 250 | +
|
| 251 | + echo "=== Before exports ===" |
| 252 | + echo "DYLD_LIBRARY_PATH: $DYLD_LIBRARY_PATH" |
| 253 | + echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH" |
| 254 | + echo "PATH: $PATH" |
| 255 | +
|
| 256 | + echo "DYLD_LIBRARY_PATH: $DYLD_LIBRARY_PATH" |
| 257 | + echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH" |
| 258 | +
|
| 259 | + echo "=== libruby.3.3.dylib ===" |
| 260 | + otool -L /Users/runner/hostedtoolcache/Ruby/3.3.10/x64/lib/libruby.3.3.dylib || true |
| 261 | +
|
| 262 | + echo "=== ALL Gem shared objects (dylib/bundle/so) ===" |
| 263 | + bundle exec ruby -e ' |
| 264 | + libs = Gem.loaded_specs.values.map{|x| Dir["#{x.full_gem_path}/**/*.{dylib,bundle,so}"]}.flatten.sort.uniq |
| 265 | + puts "Found #{libs.size} libraries:" |
| 266 | + puts libs |
| 267 | + libs.each do |lib| |
| 268 | + puts "=== #{lib} ===" |
| 269 | + system("otool", "-L", lib) |
| 270 | + system("nm", "-uU", lib) |
| 271 | + end |
| 272 | + ' || true |
| 273 | +
|
| 274 | + export DYLD_LIBRARY_PATH="/usr/local/lib:/opt/homebrew/lib:$DYLD_LIBRARY_PATH" |
| 275 | + export LD_LIBRARY_PATH="/usr/local/lib:/opt/homebrew/lib:$LD_LIBRARY_PATH" |
| 276 | +
|
| 277 | + echo "=== After exports ===" |
| 278 | + echo "DYLD_LIBRARY_PATH: $DYLD_LIBRARY_PATH" |
| 279 | + echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH" |
| 280 | + echo "PATH: $PATH" |
| 281 | +
|
| 282 | + echo "=== libruby.3.3.dylib ===" |
| 283 | + otool -L /Users/runner/hostedtoolcache/Ruby/3.3.10/x64/lib/libruby.3.3.dylib || true |
| 284 | +
|
| 285 | + echo "=== ALL Gem shared objects (dylib/bundle/so) ===" |
| 286 | + bundle exec ruby -e ' |
| 287 | + libs = Gem.loaded_specs.values.map{|x| Dir["#{x.full_gem_path}/**/*.{dylib,bundle,so}"]}.flatten.sort.uniq |
| 288 | + puts "Found #{libs.size} libraries:" |
| 289 | + puts libs |
| 290 | + libs.each do |lib| |
| 291 | + puts "=== #{lib} ===" |
| 292 | + system("otool", "-L", lib) |
| 293 | + system("nm", "-uU", lib) |
| 294 | + end |
| 295 | + ' || true |
| 296 | +
|
| 297 | + export DYLD_PRINT_LIBRARIES=1 |
| 298 | + bundle exec ruby -r bundler/setup -r couchbase -e 'pp Couchbase::Cluster.connect("couchbases://127.0.0.1", "Administrator", "password")' |
0 commit comments