Skip to content

Commit 589f3f7

Browse files
committed
GHA: Install couchbase-opentelemetry gem for tests
1 parent 98c7e28 commit 589f3f7

File tree

5 files changed

+48
-26
lines changed

5 files changed

+48
-26
lines changed

.github/workflows/tests.yml

Lines changed: 43 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,9 @@ jobs:
495495
- uses: actions/download-artifact@v4
496496
with:
497497
name: couchbase-${{ needs.source.outputs.gem_version }}-x86_64-linux
498+
- uses: actions/download-artifact@v4
499+
with:
500+
name: couchbase-opentelemetry-${{ needs.source.outputs.otel_gem_version }}
498501
- uses: actions/download-artifact@v4
499502
with:
500503
name: scripts-${{ needs.source.outputs.gem_version }}
@@ -506,12 +509,17 @@ jobs:
506509
ruby-version: ${{ matrix.ruby }}
507510
- name: Install
508511
run: |
509-
COUCHBASE_GEM_PATH=$(realpath couchbase-*.gem)
510-
UNPACKED_GEM_PATH=$(gem unpack ${COUCHBASE_GEM_PATH} | grep "Unpacked gem" | cut -d "'" -f 2)
511-
gem unpack --spec --target ${UNPACKED_GEM_PATH} ${COUCHBASE_GEM_PATH}
512-
ruby -i.bak -pe "gsub(/gemspec$/, 'gem \"couchbase\", path: \"${UNPACKED_GEM_PATH}\"')" Gemfile
512+
COUCHBASE_GEM_PATH=$(realpath couchbase-${{ needs.source.outputs.gem_version }}-*.gem)
513+
COUCHBASE_OPENTELEMETRY_GEM_PATH=$(realpath couchbase-opentelemetry-${{ needs.source.outputs.otel_gem_version }}.gem)
514+
mkdir -p local-gem-repo/gems
515+
mv ${COUCHBASE_GEM_PATH} local-gem-repo/gems
516+
mv ${COUCHBASE_OPENTELEMETRY_GEM_PATH} local-gem-repo/gems
517+
GEM_REPO_PATH=$(realpath local-gem-repo)
518+
gem generate_index --directory local-gem-repo
519+
ruby -i.bak -pe "gsub(/gemspec$/, 'gem \"couchbase\", source: \"file://${GEM_REPO_PATH}\"')" Gemfile
520+
ruby -i.bak -pe "gsub(/gemspec path: \"couchbase-opentelemetry\"$/, 'gem \"couchbase-opentelemetry\", source: \"file://${GEM_REPO_PATH}\"')" Gemfile
513521
bundle install
514-
bundle exec ruby -r bundler/setup -r couchbase -e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO'
522+
bundle exec ruby -r bundler/setup -r couchbase -r couchbase/opentelemetry -e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO, {otel: Couchbase::OpenTelemetry::VERSION}'
515523
- name: Test
516524
env:
517525
CB_CAVES_LOGS_DIR: caves-logs
@@ -568,14 +576,17 @@ jobs:
568576
- name: Install
569577
run: |
570578
set -xe
571-
COUCHBASE_GEM_PATH=$(realpath couchbase-*.gem)
572-
UNPACKED_GEM_PATH=$(gem unpack ${COUCHBASE_GEM_PATH} | grep "Unpacked gem" | cut -d "'" -f 2)
573-
gem unpack --spec --target ${UNPACKED_GEM_PATH} ${COUCHBASE_GEM_PATH}
574-
ruby -i.bak -pe "gsub(/gemspec/, 'gem \"couchbase\", path: \"${UNPACKED_GEM_PATH}\"')" Gemfile
575-
find .
576-
ls -ld ${UNPACKED_GEM_PATH}
579+
COUCHBASE_GEM_PATH=$(realpath couchbase-${{ needs.source.outputs.gem_version }}-*.gem)
580+
COUCHBASE_OPENTELEMETRY_GEM_PATH=$(realpath couchbase-opentelemetry-${{ needs.source.outputs.otel_gem_version }}.gem)
581+
mkdir -p local-gem-repo/gems
582+
mv ${COUCHBASE_GEM_PATH} local-gem-repo/gems
583+
mv ${COUCHBASE_OPENTELEMETRY_GEM_PATH} local-gem-repo/gems
584+
GEM_REPO_PATH=$(realpath local-gem-repo)
585+
gem generate_index --directory local-gem-repo
586+
ruby -i.bak -pe "gsub(/gemspec$/, 'gem \"couchbase\", source: \"file://${GEM_REPO_PATH}\"')" Gemfile
587+
ruby -i.bak -pe "gsub(/gemspec path: \"couchbase-opentelemetry\"$/, 'gem \"couchbase-opentelemetry\", source: \"file://${GEM_REPO_PATH}\"')" Gemfile
577588
bundle install
578-
bundle exec ruby -r bundler/setup -r couchbase -e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO'
589+
bundle exec ruby -r bundler/setup -r couchbase -r couchbase/opentelemetry -e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO, {otel: Couchbase::OpenTelemetry::VERSION}'
579590
- name: Test
580591
env:
581592
CB_CAVES_LOGS_DIR: caves-logs
@@ -640,12 +651,17 @@ jobs:
640651
ruby-version: ${{ matrix.ruby }}
641652
- name: Install
642653
run: |
643-
COUCHBASE_GEM_PATH=$(realpath couchbase-*.gem)
644-
UNPACKED_GEM_PATH=$(gem unpack ${COUCHBASE_GEM_PATH} | grep "Unpacked gem" | cut -d "'" -f 2)
645-
gem unpack --spec --target ${UNPACKED_GEM_PATH} ${COUCHBASE_GEM_PATH}
646-
ruby -i.bak -pe "gsub(/gemspec/, 'gem \"couchbase\", path: \"${UNPACKED_GEM_PATH}\"')" Gemfile
654+
COUCHBASE_GEM_PATH=$(realpath couchbase-${{ needs.source.outputs.gem_version }}-*.gem)
655+
COUCHBASE_OPENTELEMETRY_GEM_PATH=$(realpath couchbase-opentelemetry-${{ needs.source.outputs.otel_gem_version }}.gem)
656+
mkdir -p local-gem-repo/gems
657+
mv ${COUCHBASE_GEM_PATH} local-gem-repo/gems
658+
mv ${COUCHBASE_OPENTELEMETRY_GEM_PATH} local-gem-repo/gems
659+
GEM_REPO_PATH=$(realpath local-gem-repo)
660+
gem generate_index --directory local-gem-repo
661+
ruby -i.bak -pe "gsub(/gemspec$/, 'gem \"couchbase\", source: \"file://${GEM_REPO_PATH}\"')" Gemfile
662+
ruby -i.bak -pe "gsub(/gemspec path: \"couchbase-opentelemetry\"$/, 'gem \"couchbase-opentelemetry\", source: \"file://${GEM_REPO_PATH}\"')" Gemfile
647663
bundle install
648-
bundle exec ruby -r bundler/setup -r couchbase -e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO'
664+
bundle exec ruby -r bundler/setup -r couchbase -r couchbase/opentelemetry -e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO, {otel: Couchbase::OpenTelemetry::VERSION}'
649665
- name: Test
650666
env:
651667
CB_CAVES_LOGS_DIR: caves-logs
@@ -745,12 +761,17 @@ jobs:
745761
ruby-version: 3.3
746762
- name: Install
747763
run: |
748-
COUCHBASE_GEM_PATH=$(realpath couchbase-*.gem)
749-
UNPACKED_GEM_PATH=$(gem unpack ${COUCHBASE_GEM_PATH} | grep "Unpacked gem" | cut -d "'" -f 2)
750-
gem unpack --spec --target ${UNPACKED_GEM_PATH} ${COUCHBASE_GEM_PATH}
751-
ruby -i.bak -pe "gsub(/gemspec/, 'gem \"couchbase\", path: \"${UNPACKED_GEM_PATH}\"')" Gemfile
764+
COUCHBASE_GEM_PATH=$(realpath couchbase-${{ needs.source.outputs.gem_version }}-*.gem)
765+
COUCHBASE_OPENTELEMETRY_GEM_PATH=$(realpath couchbase-opentelemetry-${{ needs.source.outputs.otel_gem_version }}.gem)
766+
mkdir -p local-gem-repo/gems
767+
mv ${COUCHBASE_GEM_PATH} local-gem-repo/gems
768+
mv ${COUCHBASE_OPENTELEMETRY_GEM_PATH} local-gem-repo/gems
769+
GEM_REPO_PATH=$(realpath local-gem-repo)
770+
gem generate_index --directory local-gem-repo
771+
ruby -i.bak -pe "gsub(/gemspec$/, 'gem \"couchbase\", source: \"file://${GEM_REPO_PATH}\"')" Gemfile
772+
ruby -i.bak -pe "gsub(/gemspec path: \"couchbase-opentelemetry\"$/, 'gem \"couchbase-opentelemetry\", source: \"file://${GEM_REPO_PATH}\"')" Gemfile
752773
bundle install
753-
bundle exec ruby -r bundler/setup -r couchbase -e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO'
774+
bundle exec ruby -r bundler/setup -r couchbase -r couchbase/opentelemetry -e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO, {otel: Couchbase::OpenTelemetry::VERSION}'
754775
- name: Test
755776
env:
756777
TEST_SERVER_VERSION: ${{ matrix.server }}

couchbase-opentelemetry/Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ desc "Generate YARD documentation"
2121
task :doc do
2222
require "couchbase/opentelemetry/version"
2323
input_dir = File.join(__dir__, "lib")
24-
output_dir = File.join(__dir__, "doc", "couchbase-ruby-client-#{Couchbase::OpenTelemetry::VERSION}")
24+
output_dir = File.join(__dir__, "doc", "couchbase-ruby-client-opentelemetry-#{Couchbase::OpenTelemetry::VERSION}")
2525
rm_rf output_dir
2626
sh "bundle exec yard doc --no-progress --hide-api private --output-dir #{output_dir} #{input_dir} --main README.md"
2727
puts "#{File.realpath(output_dir)}/index.html"

couchbase-opentelemetry/couchbase-opentelemetry.gemspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616

1717
lib = File.expand_path("lib", __dir__)
1818
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
19+
require "couchbase/opentelemetry/version"
1920

2021
Gem::Specification.new do |spec|
2122
spec.name = "couchbase-opentelemetry"
22-
spec.version = "0.0.1"
23+
spec.version = Couchbase::OpenTelemetry::VERSION
2324
spec.authors = ["Sergey Avseyev"]
2425
spec.email = ["sergey.avseyev@gmail.com"]
2526
spec.summary = "OpenTelemetry integration for the Couchbase Ruby Client"

couchbase-opentelemetry/lib/couchbase/opentelemetry.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@
1616

1717
require_relative "opentelemetry/request_tracer"
1818
require_relative "opentelemetry/meter"
19+
require_relative "opentelemetry/version"

couchbase-opentelemetry/lib/couchbase/opentelemetry/request_span.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ def initialize(span)
2828
end
2929

3030
def set_attribute(key, value)
31-
@wrapped
32-
.set_attribute(key, value)
31+
@wrapped.set_attribute(key, value)
3332
end
3433

3534
def status=(status_code)

0 commit comments

Comments
 (0)