Skip to content

Commit 0c396bc

Browse files
committed
debug openssl on macos
1 parent 3aaf4c3 commit 0c396bc

File tree

3 files changed

+266
-0
lines changed

3 files changed

+266
-0
lines changed

.github/workflows/debug.yml

Lines changed: 264 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,264 @@
1+
name: tests
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+
source:
20+
runs-on: ubuntu-22.04
21+
outputs:
22+
gem_version: ${{ steps.build_gem.outputs.gem_version }}
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
submodules: recursive
27+
fetch-depth: 0
28+
fetch-tags: true
29+
- uses: ruby/setup-ruby@v1
30+
with:
31+
ruby-version: 3.3
32+
bundler-cache: true
33+
- name: Build
34+
id: build_gem
35+
run: |
36+
COMMITS_SINCE_LAST_TAG=$(git describe --tags --always --long | awk -F '-' '{print $2}')
37+
ruby bin/jenkins/patch-version.rb ${COMMITS_SINCE_LAST_TAG}
38+
GEM_VERSION=$(ruby -r ./lib/couchbase/version.rb -e "puts Couchbase::VERSION[:sdk]")
39+
echo "gem_version=${GEM_VERSION}" >> "$GITHUB_OUTPUT"
40+
bundle exec rake build
41+
- name: RDoc
42+
run: |
43+
cat > patch-readme.rb <<EOF
44+
require_relative "./lib/couchbase/version.rb"
45+
gemfile = <<EOS.strip
46+
gem "couchbase", "#{Couchbase::VERSION[:sdk]}"
47+
EOS
48+
old_content = File.read("README.md")
49+
new_content = old_content.gsub(/(gem "couchbase", ").*?"/, gemfile)
50+
File.write("README.md", new_content)
51+
EOF
52+
ruby patch-readme.rb
53+
bundle exec yard doc --hide-api private --output-dir docs/couchbase-ruby-client-${{ steps.build_gem.outputs.gem_version }} lib --main README.md
54+
- uses: actions/upload-artifact@v4
55+
with:
56+
name: couchbase-${{ steps.build_gem.outputs.gem_version }}
57+
path: |
58+
pkg/*.gem
59+
- uses: actions/upload-artifact@v4
60+
with:
61+
retention-days: 1
62+
name: scripts-${{ steps.build_gem.outputs.gem_version }}
63+
path: |
64+
Gemfile
65+
Rakefile
66+
bin/**/*
67+
couchbase.gemspec
68+
lib/couchbase/version.rb
69+
task/**/*
70+
- uses: actions/upload-artifact@v4
71+
with:
72+
retention-days: 1
73+
name: tests-${{ steps.build_gem.outputs.gem_version }}
74+
path: |
75+
test/**/*
76+
test_data/**/*
77+
- uses: actions/upload-artifact@v4
78+
with:
79+
name: docs-${{ steps.build_gem.outputs.gem_version }}
80+
path: |
81+
docs/**/*
82+
83+
84+
build_macos_x86_64:
85+
needs: source
86+
runs-on: macos-15-intel
87+
strategy:
88+
fail-fast: false
89+
matrix:
90+
ruby:
91+
- '3.3'
92+
steps:
93+
- uses: hendrikmuhs/[email protected]
94+
with:
95+
max-size: 2G
96+
key: ${{ github.job }}-${{ matrix.ruby }}
97+
- uses: ruby/setup-ruby@v1
98+
with:
99+
ruby-version: ${{ matrix.ruby }}
100+
101+
- name: Check system OpenSSL
102+
run: |
103+
echo "System OpenSSL:"
104+
/usr/bin/otool -L /usr/lib/libssl.48.dylib 2>/dev/null || echo "libssl.48.dylib not found via otool"
105+
openssl version || echo "OpenSSL command not found"
106+
ls -la /usr/lib/libssl* || echo "No system libssl*"
107+
108+
- name: Check Ruby OpenSSL
109+
run: |
110+
ruby -r openssl -e "
111+
puts 'Ruby OpenSSL version: OpenSSL::OPENSSL_VERSION'
112+
ctx = OpenSSL::SSL::SSLContext.new
113+
puts 'SSLContext min_version support: ' + (ctx.respond_to?(:min_version) ? ctx.min_version.inspect : 'No')
114+
puts 'SSLContext max_version support: ' + (ctx.respond_to?(:max_version) ? ctx.max_version.inspect : 'No')
115+
puts 'SSL library: ' + OpenSSL::OPENSSL_LIBRARIES.inspect
116+
puts 'SSL config file: ' + OpenSSL::OPENSSL_CONF.inspect
117+
"
118+
119+
- name: Test OpenSSL HTTPS fetch
120+
run: |
121+
ruby -e "
122+
require 'net/http'; require 'uri'; require 'openssl'
123+
uri = URI('https://www.couchbase.com/')
124+
http = Net::HTTP.new(uri.host, uri.port)
125+
http.use_ssl = true
126+
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
127+
begin
128+
response = http.get(uri.path.empty? ? '/' : uri.path)
129+
puts 'SUCCESS: HTTP ' + response.code + ' - ' + response['content-type']
130+
rescue OpenSSL::SSL::SSLError => e
131+
puts 'SSL Error: ' + e.message
132+
rescue => e
133+
puts 'Error: ' + e.class.name + ' - ' + e.message
134+
end
135+
"
136+
137+
build_macos_x86_64:
138+
needs: source
139+
runs-on: macos-15-intel
140+
strategy:
141+
fail-fast: false
142+
matrix:
143+
ruby:
144+
- '3.3'
145+
steps:
146+
- uses: hendrikmuhs/[email protected]
147+
with:
148+
max-size: 2G
149+
key: ${{ github.job }}-${{ matrix.ruby }}
150+
- uses: ruby/setup-ruby@v1
151+
with:
152+
ruby-version: ${{ matrix.ruby }}
153+
- uses: actions/download-artifact@v4
154+
with:
155+
name: couchbase-${{ needs.source.outputs.gem_version }}
156+
- name: Precompile
157+
env:
158+
CB_STATIC_BORINGSSL: 1
159+
CB_STATIC_STDLIB: 1
160+
CB_REMOVE_EXT_DIRECTORY: 1
161+
run: |
162+
gem install gem-compiler
163+
gem compile --prune couchbase-${{ needs.source.outputs.gem_version }}.gem
164+
- uses: actions/upload-artifact@v4
165+
with:
166+
retention-days: 1
167+
name: couchbase-${{ needs.source.outputs.gem_version }}-x86_64-darwin-${{ matrix.ruby }}
168+
path: |
169+
*-x86_64-darwin*.gem
170+
171+
repackage_macos_x86_64:
172+
needs:
173+
- source
174+
- build_macos_x86_64
175+
runs-on: macos-15-intel
176+
steps:
177+
- uses: actions/download-artifact@v4
178+
with:
179+
name: scripts-${{ needs.source.outputs.gem_version }}
180+
- uses: actions/download-artifact@v4
181+
with:
182+
path: pkg/binary/3.1
183+
name: couchbase-${{ needs.source.outputs.gem_version }}-x86_64-darwin-3.1
184+
- uses: actions/download-artifact@v4
185+
with:
186+
path: pkg/binary/3.2
187+
name: couchbase-${{ needs.source.outputs.gem_version }}-x86_64-darwin-3.2
188+
- uses: actions/download-artifact@v4
189+
with:
190+
path: pkg/binary/3.3
191+
name: couchbase-${{ needs.source.outputs.gem_version }}-x86_64-darwin-3.3
192+
- uses: actions/download-artifact@v4
193+
with:
194+
path: pkg/binary/3.4
195+
name: couchbase-${{ needs.source.outputs.gem_version }}-x86_64-darwin-3.4
196+
- uses: ruby/setup-ruby@v1
197+
with:
198+
ruby-version: 3.4
199+
- name: Repackage
200+
run: |
201+
ruby bin/jenkins/repackage-extension.rb
202+
- uses: actions/upload-artifact@v4
203+
with:
204+
name: couchbase-${{ needs.source.outputs.gem_version }}-x86_64-darwin
205+
path: |
206+
pkg/fat/*.gem
207+
208+
mock_macos_x86_64:
209+
timeout-minutes: 15
210+
needs:
211+
- source
212+
- repackage_macos_x86_64
213+
runs-on: macos-15-intel
214+
strategy:
215+
fail-fast: false
216+
matrix:
217+
ruby:
218+
- '3.3'
219+
steps:
220+
- uses: actions/download-artifact@v4
221+
with:
222+
name: couchbase-${{ needs.source.outputs.gem_version }}-x86_64-darwin
223+
- uses: actions/download-artifact@v4
224+
with:
225+
name: scripts-${{ needs.source.outputs.gem_version }}
226+
- uses: actions/download-artifact@v4
227+
with:
228+
name: tests-${{ needs.source.outputs.gem_version }}
229+
- uses: ruby/setup-ruby@v1
230+
with:
231+
ruby-version: ${{ matrix.ruby }}
232+
- name: Install
233+
run: |
234+
COUCHBASE_GEM_PATH=$(realpath couchbase-*.gem)
235+
UNPACKED_GEM_PATH=$(gem unpack ${COUCHBASE_GEM_PATH} | grep "Unpacked gem" | cut -d "'" -f 2)
236+
gem unpack --spec --target ${UNPACKED_GEM_PATH} ${COUCHBASE_GEM_PATH}
237+
ruby -i.bak -pe "gsub(/gemspec/, 'gem \"couchbase\", path: \"${UNPACKED_GEM_PATH}\"')" Gemfile
238+
bundle install
239+
bundle exec ruby -r bundler/setup -r couchbase -e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO'
240+
- name: Test
241+
env:
242+
CB_CAVES_LOGS_DIR: caves-logs
243+
COUCHBASE_BACKEND_DONT_WRITE_TO_STDERR: true
244+
COUCHBASE_BACKEND_LOG_PATH: logs/couchbase.log
245+
run: |
246+
bundle exec rake test
247+
- name: Upload logs
248+
if: failure()
249+
uses: actions/upload-artifact@v4
250+
with:
251+
name: ${{ github.job }}-${{ github.run_attempt }}-${{ matrix.ruby }}-logs
252+
path: |
253+
caves-logs/*
254+
logs/*
255+
test/**/*.{log,xml}
256+
retention-days: 5
257+
- name: Publish Test Report
258+
uses: mikepenz/[email protected]
259+
if: always()
260+
with:
261+
check_name: 🍏caves, ruby-${{ matrix.ruby }}
262+
report_paths: test/reports/*.xml
263+
require_tests: true
264+
annotate_only: true

.github/workflows/linters.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: linters
22
permissions: {}
33

4+
if: false
45
on:
56
push:
67
branches: [ main ]

.github/workflows/tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
name: tests
22
permissions: {}
33

4+
if: false
45
on:
56
push:
67
branches:

0 commit comments

Comments
 (0)