2020 runs-on : ubuntu-22.04
2121 outputs :
2222 gem_version : ${{ steps.build_gem.outputs.gem_version }}
23+ otel_gem_version : ${{ steps.build_otel_gem.outputs.otel_gem_version }}
2324 steps :
2425 - uses : actions/checkout@v4
2526 with :
@@ -30,15 +31,22 @@ jobs:
3031 with :
3132 ruby-version : 3.3
3233 bundler-cache : true
33- - name : Build
34+ - name : Build couchbase gem
3435 id : build_gem
3536 run : |
3637 COMMITS_SINCE_LAST_TAG=$(git describe --tags --always --long | awk -F '-' '{print $2}')
3738 ruby bin/jenkins/patch-version.rb ${COMMITS_SINCE_LAST_TAG}
3839 GEM_VERSION=$(ruby -r ./lib/couchbase/version.rb -e "puts Couchbase::VERSION[:sdk]")
3940 echo "gem_version=${GEM_VERSION}" >> "$GITHUB_OUTPUT"
4041 bundle exec rake build
41- - name : RDoc
42+ - name : Build couchbase-opentelemetry gem
43+ id : build_otel_gem
44+ run : |
45+ cd couchbase-opentelemetry
46+ OTEL_GEM_VERSION=$(ruby -r ./lib/couchbase/opentelemetry/version.rb -e "puts Couchbase::OpenTelemetry::VERSION")
47+ echo "otel_gem_version=${OTEL_GEM_VERSION}" >> "$GITHUB_OUTPUT"
48+ bundle exec rake build
49+ - name : Generate documentation for the couchbase gem
4250 run : |
4351 cat > patch-readme.rb <<EOF
4452 require_relative "./lib/couchbase/version.rb"
@@ -50,36 +58,69 @@ jobs:
5058 File.write("README.md", new_content)
5159 EOF
5260 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
61+ bundle exec rake doc
62+ - name : Generate documentation for the couchbase-opentelemetry gem
63+ run : |
64+ cd couchbase-opentelemetry
65+ cat > patch-readme.rb <<EOF
66+ require_relative "./lib/couchbase/opentelemetry/version.rb"
67+ gemfile = <<EOS.strip
68+ gem "couchbase-opentelemetry", "#{Couchbase::OpenTelemetry::VERSION}"
69+ EOS
70+ old_content = File.read("README.md")
71+ new_content = old_content.gsub(/(gem "couchbase-opentelemetry", ").*?"/, gemfile)
72+ File.write("README.md", new_content)
73+ EOF
74+ ruby patch-readme.rb
75+ bundle exec rake doc
76+ - name : Upload artifact - couchbase gem
77+ uses : actions/upload-artifact@v4
5578 with :
5679 name : couchbase-${{ steps.build_gem.outputs.gem_version }}
5780 path : |
5881 pkg/*.gem
59- - uses : actions/upload-artifact@v4
82+ - name : Upload artifact - couchbase-opentelemetry gem
83+ uses : actions/upload-artifact@v4
84+ with :
85+ name : couchbase-opentelemetry-${{ steps.build_otel_gem.outputs.otel_gem_version }}
86+ path : |
87+ couchbase-opentelemetry/pkg/*.gem
88+ - name : Upload artifact - scripts
89+ uses : actions/upload-artifact@v4
6090 with :
6191 retention-days : 1
6292 name : scripts-${{ steps.build_gem.outputs.gem_version }}
6393 path : |
64- Gemfile
6594 Rakefile
95+ couchbase*.gemspec
96+ lib/couchbase/**/version.rb
97+ Gemfile
6698 bin/**/*
67- couchbase.gemspec
68- lib/couchbase/version.rb
6999 task/**/*
70- - uses : actions/upload-artifact@v4
100+ couchbase-opentelemetry/Rakefile
101+ couchbase-opentelemetry/couchbase-opentelemetry*.gemspec
102+ couchbase-opentelemetry/lib/couchbase/opentelemetry/version.rb
103+ - name : Upload artifact - tests and test data
104+ uses : actions/upload-artifact@v4
71105 with :
72106 retention-days : 1
73107 name : tests-${{ steps.build_gem.outputs.gem_version }}
74108 path : |
75109 test/**/*
76110 test_data/**/*
77- - uses : actions/upload-artifact@v4
111+ - name : Upload artifact - couchbase gem docs
112+ uses : actions/upload-artifact@v4
78113 with :
79114 name : docs-${{ steps.build_gem.outputs.gem_version }}
80115 path : |
81- docs/**/*
82-
116+ doc/**/*
117+ - name : Upload artifact - couchbase-opentelemetry gem docs
118+ uses : actions/upload-artifact@v4
119+ with :
120+ name : otel-docs-${{ steps.build_otel_gem.outputs.otel_gem_version }}
121+ path : |
122+ couchbase-opentelemetry/doc/**/*
123+
83124 build_alpine_x86_64 :
84125 # FIXME(SA): add aarch64 for Alpine Linux
85126 # Right now github does not allow to execute JS-based actions (like
@@ -131,6 +172,10 @@ jobs:
131172 with :
132173 path : pkg
133174 name : couchbase-${{ needs.source.outputs.gem_version }}
175+ - uses : actions/download-artifact@v4
176+ with :
177+ path : pkg
178+ name : couchbase-opentelemetry-${{ needs.source.outputs.otel_gem_version }}
134179 - name : Build gem
135180 env :
136181 SUPPORTED_RUBY_VERSIONS : " 3.2 3.3 3.4 4.0"
@@ -457,6 +502,9 @@ jobs:
457502 - uses : actions/download-artifact@v4
458503 with :
459504 name : couchbase-${{ needs.source.outputs.gem_version }}-x86_64-linux
505+ - uses : actions/download-artifact@v4
506+ with :
507+ name : couchbase-opentelemetry-${{ needs.source.outputs.otel_gem_version }}
460508 - uses : actions/download-artifact@v4
461509 with :
462510 name : scripts-${{ needs.source.outputs.gem_version }}
@@ -468,12 +516,17 @@ jobs:
468516 ruby-version : ${{ matrix.ruby }}
469517 - name : Install
470518 run : |
471- COUCHBASE_GEM_PATH=$(realpath couchbase-*.gem)
472- UNPACKED_GEM_PATH=$(gem unpack ${COUCHBASE_GEM_PATH} | grep "Unpacked gem" | cut -d "'" -f 2)
473- gem unpack --spec --target ${UNPACKED_GEM_PATH} ${COUCHBASE_GEM_PATH}
474- ruby -i.bak -pe "gsub(/gemspec/, 'gem \"couchbase\", path: \"${UNPACKED_GEM_PATH}\"')" Gemfile
519+ COUCHBASE_GEM_PATH=$(realpath couchbase-${{ needs.source.outputs.gem_version }}-*.gem)
520+ COUCHBASE_OPENTELEMETRY_GEM_PATH=$(realpath couchbase-opentelemetry-${{ needs.source.outputs.otel_gem_version }}.gem)
521+ mkdir -p local-gem-repo/gems
522+ mv ${COUCHBASE_GEM_PATH} local-gem-repo/gems
523+ mv ${COUCHBASE_OPENTELEMETRY_GEM_PATH} local-gem-repo/gems
524+ GEM_REPO_PATH=$(realpath local-gem-repo)
525+ gem generate_index --directory local-gem-repo
526+ ruby -i.bak -pe "gsub(/gemspec$/, 'gem \"couchbase\", source: \"file://${GEM_REPO_PATH}\"')" Gemfile
527+ ruby -i.bak -pe "gsub(/gemspec path: \"couchbase-opentelemetry\"$/, 'gem \"couchbase-opentelemetry\", source: \"file://${GEM_REPO_PATH}\"')" Gemfile
475528 bundle install
476- bundle exec ruby -r bundler/setup -r couchbase -e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO'
529+ bundle exec ruby -r bundler/setup -r couchbase -r couchbase/opentelemetry - e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO, {otel: Couchbase::OpenTelemetry::VERSION} '
477530 - name : Test
478531 env :
479532 CB_CAVES_LOGS_DIR : caves-logs
@@ -518,6 +571,9 @@ jobs:
518571 - uses : actions/download-artifact@v4
519572 with :
520573 name : couchbase-${{ needs.source.outputs.gem_version }}-arm64-darwin
574+ - uses : actions/download-artifact@v4
575+ with :
576+ name : couchbase-opentelemetry-${{ needs.source.outputs.otel_gem_version }}
521577 - uses : actions/download-artifact@v4
522578 with :
523579 name : scripts-${{ needs.source.outputs.gem_version }}
@@ -530,14 +586,17 @@ jobs:
530586 - name : Install
531587 run : |
532588 set -xe
533- COUCHBASE_GEM_PATH=$(realpath couchbase-*.gem)
534- UNPACKED_GEM_PATH=$(gem unpack ${COUCHBASE_GEM_PATH} | grep "Unpacked gem" | cut -d "'" -f 2)
535- gem unpack --spec --target ${UNPACKED_GEM_PATH} ${COUCHBASE_GEM_PATH}
536- ruby -i.bak -pe "gsub(/gemspec/, 'gem \"couchbase\", path: \"${UNPACKED_GEM_PATH}\"')" Gemfile
537- find .
538- ls -ld ${UNPACKED_GEM_PATH}
589+ COUCHBASE_GEM_PATH=$(realpath couchbase-${{ needs.source.outputs.gem_version }}-*.gem)
590+ COUCHBASE_OPENTELEMETRY_GEM_PATH=$(realpath couchbase-opentelemetry-${{ needs.source.outputs.otel_gem_version }}.gem)
591+ mkdir -p local-gem-repo/gems
592+ mv ${COUCHBASE_GEM_PATH} local-gem-repo/gems
593+ mv ${COUCHBASE_OPENTELEMETRY_GEM_PATH} local-gem-repo/gems
594+ GEM_REPO_PATH=$(realpath local-gem-repo)
595+ gem generate_index --directory local-gem-repo
596+ ruby -i.bak -pe "gsub(/gemspec$/, 'gem \"couchbase\", source: \"file://${GEM_REPO_PATH}\"')" Gemfile
597+ ruby -i.bak -pe "gsub(/gemspec path: \"couchbase-opentelemetry\"$/, 'gem \"couchbase-opentelemetry\", source: \"file://${GEM_REPO_PATH}\"')" Gemfile
539598 bundle install
540- bundle exec ruby -r bundler/setup -r couchbase -e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO'
599+ bundle exec ruby -r bundler/setup -r couchbase -r couchbase/opentelemetry - e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO, {otel: Couchbase::OpenTelemetry::VERSION} '
541600 - name : Test
542601 env :
543602 CB_CAVES_LOGS_DIR : caves-logs
@@ -591,6 +650,9 @@ jobs:
591650 - uses : actions/download-artifact@v4
592651 with :
593652 name : couchbase-${{ needs.source.outputs.gem_version }}-x86_64-darwin
653+ - uses : actions/download-artifact@v4
654+ with :
655+ name : couchbase-opentelemetry-${{ needs.source.outputs.otel_gem_version }}
594656 - uses : actions/download-artifact@v4
595657 with :
596658 name : scripts-${{ needs.source.outputs.gem_version }}
@@ -602,12 +664,17 @@ jobs:
602664 ruby-version : ${{ matrix.ruby }}
603665 - name : Install
604666 run : |
605- COUCHBASE_GEM_PATH=$(realpath couchbase-*.gem)
606- UNPACKED_GEM_PATH=$(gem unpack ${COUCHBASE_GEM_PATH} | grep "Unpacked gem" | cut -d "'" -f 2)
607- gem unpack --spec --target ${UNPACKED_GEM_PATH} ${COUCHBASE_GEM_PATH}
608- ruby -i.bak -pe "gsub(/gemspec/, 'gem \"couchbase\", path: \"${UNPACKED_GEM_PATH}\"')" Gemfile
667+ COUCHBASE_GEM_PATH=$(realpath couchbase-${{ needs.source.outputs.gem_version }}-*.gem)
668+ COUCHBASE_OPENTELEMETRY_GEM_PATH=$(realpath couchbase-opentelemetry-${{ needs.source.outputs.otel_gem_version }}.gem)
669+ mkdir -p local-gem-repo/gems
670+ mv ${COUCHBASE_GEM_PATH} local-gem-repo/gems
671+ mv ${COUCHBASE_OPENTELEMETRY_GEM_PATH} local-gem-repo/gems
672+ GEM_REPO_PATH=$(realpath local-gem-repo)
673+ gem generate_index --directory local-gem-repo
674+ ruby -i.bak -pe "gsub(/gemspec$/, 'gem \"couchbase\", source: \"file://${GEM_REPO_PATH}\"')" Gemfile
675+ ruby -i.bak -pe "gsub(/gemspec path: \"couchbase-opentelemetry\"$/, 'gem \"couchbase-opentelemetry\", source: \"file://${GEM_REPO_PATH}\"')" Gemfile
609676 bundle install
610- bundle exec ruby -r bundler/setup -r couchbase -e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO'
677+ bundle exec ruby -r bundler/setup -r couchbase -r couchbase/opentelemetry - e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO, {otel: Couchbase::OpenTelemetry::VERSION} '
611678 - name : Test
612679 env :
613680 CB_CAVES_LOGS_DIR : caves-logs
@@ -696,6 +763,9 @@ jobs:
696763 - uses : actions/download-artifact@v4
697764 with :
698765 name : couchbase-${{ needs.source.outputs.gem_version }}-x86_64-linux
766+ - uses : actions/download-artifact@v4
767+ with :
768+ name : couchbase-opentelemetry-${{ needs.source.outputs.otel_gem_version }}
699769 - uses : actions/download-artifact@v4
700770 with :
701771 name : scripts-${{ needs.source.outputs.gem_version }}
@@ -707,12 +777,17 @@ jobs:
707777 ruby-version : 3.3
708778 - name : Install
709779 run : |
710- COUCHBASE_GEM_PATH=$(realpath couchbase-*.gem)
711- UNPACKED_GEM_PATH=$(gem unpack ${COUCHBASE_GEM_PATH} | grep "Unpacked gem" | cut -d "'" -f 2)
712- gem unpack --spec --target ${UNPACKED_GEM_PATH} ${COUCHBASE_GEM_PATH}
713- ruby -i.bak -pe "gsub(/gemspec/, 'gem \"couchbase\", path: \"${UNPACKED_GEM_PATH}\"')" Gemfile
780+ COUCHBASE_GEM_PATH=$(realpath couchbase-${{ needs.source.outputs.gem_version }}-*.gem)
781+ COUCHBASE_OPENTELEMETRY_GEM_PATH=$(realpath couchbase-opentelemetry-${{ needs.source.outputs.otel_gem_version }}.gem)
782+ mkdir -p local-gem-repo/gems
783+ mv ${COUCHBASE_GEM_PATH} local-gem-repo/gems
784+ mv ${COUCHBASE_OPENTELEMETRY_GEM_PATH} local-gem-repo/gems
785+ GEM_REPO_PATH=$(realpath local-gem-repo)
786+ gem generate_index --directory local-gem-repo
787+ ruby -i.bak -pe "gsub(/gemspec$/, 'gem \"couchbase\", source: \"file://${GEM_REPO_PATH}\"')" Gemfile
788+ ruby -i.bak -pe "gsub(/gemspec path: \"couchbase-opentelemetry\"$/, 'gem \"couchbase-opentelemetry\", source: \"file://${GEM_REPO_PATH}\"')" Gemfile
714789 bundle install
715- bundle exec ruby -r bundler/setup -r couchbase -e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO'
790+ bundle exec ruby -r bundler/setup -r couchbase -r couchbase/opentelemetry - e 'pp Couchbase::VERSION, Couchbase::BUILD_INFO, {otel: Couchbase::OpenTelemetry::VERSION} '
716791 - name : Test
717792 env :
718793 TEST_SERVER_VERSION : ${{ matrix.server }}
0 commit comments