Skip to content

Validate#45

Open
lloeki wants to merge 3 commits into
mainfrom
lloeki/builder-ci-validate
Open

Validate#45
lloeki wants to merge 3 commits into
mainfrom
lloeki/builder-ci-validate

Conversation

@lloeki
Copy link
Copy Markdown
Member

@lloeki lloeki commented May 26, 2026

Why?

FUP to #34 (chained PR)

What does this PR do?

Ensure that all variants of the gem:

  • can be installed properly on every target platform
  • can be used to compile C against the shared library on every target platform

How to test the change?

CI

Additional Notes:

This is intentionally additive: the previous workflow is kept to allow a release "the old way" in short order until the "new way" is fully validated.

JIRA:

@lloeki lloeki requested review from a team as code owners May 26, 2026 13:26
@lloeki lloeki mentioned this pull request May 26, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8bd9a1041a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tasks/gem.rake
@lloeki lloeki force-pushed the lloeki/builder-ci-validate branch from 882a9ea to cf18bad Compare May 26, 2026 14:22
@lloeki lloeki changed the title Lloeki/builder ci validate Validate May 26, 2026
Copy link
Copy Markdown
Member

@ivoanjo ivoanjo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Added some final notes based on discussion, nothing blocking

Comment on lines 153 to +185
@@ -169,10 +177,107 @@ jobs:
for tarball in vendor-*.tar; do
tar xf "${tarball}"
done
- name: Package gems
run: bundle exec rake package
- name: Upload gems
- name: Package gem
run: bundle exec rake "gem:package[${{ matrix.gem_platform }}]"
- name: Upload gem
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: gems
name: gem-${{ matrix.gem_platform }}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: We discussed that here we actually download all of the binary tarballs; but it's kinda awkward to describe that in github, so for now every run downloads every tarball.

Also it would be nice to only download the ones we need to make sure we don't package anything extra, but probably not for this PR.

We could also do all the packaging in one step, but maybe not for now.

Comment on lines +210 to +283
name: Validate (${{ matrix.platform.ruby_platform }}, ${{ matrix.gem_source }})
needs: [package]
runs-on: ${{ matrix.platform.base }}
steps:
- name: Download gem
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: gem-${{ matrix.gem_source == 'ruby' && 'ruby' || matrix.platform.gem_platform }}
path: pkg
- name: Start container
run: docker run --rm --detach --name validate --volume "${PWD}:${PWD}" -w "${PWD}" ${{ matrix.platform.image }} sleep 86400
- name: Install gem
run: docker exec validate gem install pkg/*.gem
- name: Validate gem
run: |
docker exec validate ruby -e '
require "libdatadog"
puts "version: #{Libdatadog::VERSION}"
puts "platform: #{RUBY_PLATFORM}"
puts "binaries: #{Libdatadog.available_binaries}"
puts "pkgconfig: #{Libdatadog.pkgconfig_folder}"
puts "receiver: #{Libdatadog.path_to_crashtracking_receiver_binary}"
raise "pkgconfig_folder is nil" unless Libdatadog.pkgconfig_folder
raise "crashtracking receiver not found" unless Libdatadog.path_to_crashtracking_receiver_binary
'
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
sparse-checkout: spec/smoke
- name: Smoke test (compile and run C program against libdatadog)
run: docker exec validate ruby spec/smoke/run.rb
- name: Stop container
if: always()
run: docker stop validate || true

validate-macos:
strategy:
fail-fast: false
matrix:
gem_source: [binary, ruby]
platform:
- ruby_platform: arm64-darwin
gem_platform: arm64-darwin
base: macos-15
name: Validate (${{ matrix.platform.ruby_platform }}, ${{ matrix.gem_source }})
needs: [package]
runs-on: ${{ matrix.platform.base }}
steps:
- uses: ruby/setup-ruby@7372622e62b60b3cb750dcd2b9e32c247ffec26a # v1.302.0
with:
ruby-version: "4.0"
- name: Download gem
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: gem-${{ matrix.gem_source == 'ruby' && 'ruby' || matrix.platform.gem_platform }}
path: pkg
- name: Install gem
run: gem install pkg/*.gem
- name: Validate gem
run: |
ruby -e '
require "libdatadog"
puts "version: #{Libdatadog::VERSION}"
puts "platform: #{RUBY_PLATFORM}"
puts "binaries: #{Libdatadog.available_binaries}"
puts "pkgconfig: #{Libdatadog.pkgconfig_folder}"
puts "receiver: #{Libdatadog.path_to_crashtracking_receiver_binary}"
raise "pkgconfig_folder is nil" unless Libdatadog.pkgconfig_folder
raise "crashtracking receiver not found" unless Libdatadog.path_to_crashtracking_receiver_binary
'
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
sparse-checkout: spec/smoke
- name: Smoke test (compile and run C program against libdatadog)
run: ruby spec/smoke/run.rb
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: Maybe we could combine these, to avoid having two variants of the logic

(It needs two variants because we can't say "use docker on linux; don't use docker on macOS")

Comment thread spec/smoke/run.rb
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: We discussed that this setup may get out-of-sync with how dd-trace-rb consumes libdatadog-rb; and that we could have a very small gem to try to mimic things more closely but not for this PR. (maybe never?)

@ivoanjo
Copy link
Copy Markdown
Member

ivoanjo commented May 29, 2026

Ok, as promised, I did a run of downloading the binary artifacts from this PR and comparing them with the ones on upstream libdatadog/rubygems.org.

It's in great shape -- I was only able to find two very small things to improve/fix.


Notes on comparing builds/gems:

  • The tasks/ folder with rake tasks is being included in the packaged gem. This is a (very small) regression from moving to libdatadog-rb, is not new to this branch, but worth fixing IMO.

  • The vendor-arm64-darwin.zip includes a lot of crap since it includes a bunch of gemspecs and other gems that were in the vendor folder in the builder. This does not impact the packaged gems, but worth fixing IMO, just in case it bites us in the future? (Especially since it's only on one of the builds...)

~/check-gems/new/vendor-arm64-darwin$ find -type d
.
./vendor
./vendor/libdatadog-33.0.0
./vendor/libdatadog-33.0.0/arm64-darwin
./vendor/libdatadog-33.0.0/arm64-darwin/cmake
./vendor/libdatadog-33.0.0/arm64-darwin/lib
./vendor/libdatadog-33.0.0/arm64-darwin/lib/pkgconfig
./vendor/libdatadog-33.0.0/arm64-darwin/bin
./vendor/libdatadog-33.0.0/arm64-darwin/include
./vendor/libdatadog-33.0.0/arm64-darwin/include/datadog
./vendor/bundle
./vendor/bundle/ruby
./vendor/bundle/ruby/4.0.0
./vendor/bundle/ruby/4.0.0/cache
./vendor/bundle/ruby/4.0.0/extensions
./vendor/bundle/ruby/4.0.0/extensions/arm64-darwin-23
./vendor/bundle/ruby/4.0.0/extensions/arm64-darwin-23/4.0.0
./vendor/bundle/ruby/4.0.0/extensions/arm64-darwin-23/4.0.0/date-3.5.1
./vendor/bundle/ruby/4.0.0/extensions/arm64-darwin-23/4.0.0/json-2.19.5
./vendor/bundle/ruby/4.0.0/extensions/arm64-darwin-23/4.0.0/json-2.19.5/json
./vendor/bundle/ruby/4.0.0/extensions/arm64-darwin-23/4.0.0/json-2.19.5/json/ext
./vendor/bundle/ruby/4.0.0/extensions/arm64-darwin-23/4.0.0/psych-5.3.1
./vendor/bundle/ruby/4.0.0/extensions/arm64-darwin-23/4.0.0/erb-6.0.4
./vendor/bundle/ruby/4.0.0/extensions/arm64-darwin-23/4.0.0/erb-6.0.4/erb
./vendor/bundle/ruby/4.0.0/extensions/arm64-darwin-23/4.0.0/prism-1.9.0
./vendor/bundle/ruby/4.0.0/extensions/arm64-darwin-23/4.0.0/prism-1.9.0/prism
./vendor/bundle/ruby/4.0.0/extensions/arm64-darwin-23/4.0.0/stringio-3.2.0
./vendor/bundle/ruby/4.0.0/extensions/arm64-darwin-23/4.0.0/racc-1.8.1
./vendor/bundle/ruby/4.0.0/extensions/arm64-darwin-23/4.0.0/racc-1.8.1/racc
./vendor/bundle/ruby/4.0.0/extensions/arm64-darwin-23/4.0.0/io-console-0.8.2
./vendor/bundle/ruby/4.0.0/extensions/arm64-darwin-23/4.0.0/io-console-0.8.2/io
./vendor/bundle/ruby/4.0.0/extensions/arm64-darwin-23/4.0.0/ffi-1.17.4
./vendor/bundle/ruby/4.0.0/extensions/arm64-darwin-23/4.0.0/llhttp-ffi-0.5.1
./vendor/bundle/ruby/4.0.0/plugins
./vendor/bundle/ruby/4.0.0/doc
./vendor/bundle/ruby/4.0.0/gems
./vendor/bundle/ruby/4.0.0/gems/parser-3.3.11.1
./vendor/bundle/ruby/4.0.0/gems/parser-3.3.11.1/lib
./vendor/bundle/ruby/4.0.0/gems/parser-3.3.11.1/lib/parser
./vendor/bundle/ruby/4.0.0/gems/parser-3.3.11.1/lib/parser/builders
./vendor/bundle/ruby/4.0.0/gems/parser-3.3.11.1/lib/parser/source
...
  • Folder names in build are different between upstream releases and libdatadog-rb builds (libdatadog-x86_64-unknown-linux-gnu => ./libdatadog-33.0.0/x86_64-linux). I believe this is not a problem since we didn't rely on those folder names (lib/libdatadog.rb searches the filesystem for datadog_profiling_with_rpath.pc and does things relative to that file)

  • Noticed build sizes are slighty different between upstream releases and libdatadog-rb builds, I guess this is an artifact of slightly different base image/rust versions?:

-rw-r--r-- 1 ivo.anjo ivo.anjo 2.6K May 26 15:24 ./libdatadog-33.0.0/x86_64-linux/cmake/DatadogConfig.cmake
-rw-r--r-- 1 ivo.anjo ivo.anjo 138 May 26 15:30 ./libdatadog-33.0.0/x86_64-linux/NOTICE
-rw-r--r-- 1 ivo.anjo ivo.anjo 59K May 26 15:30 ./libdatadog-33.0.0/x86_64-linux/LICENSE-3rdparty.csv
-rw-r--r-- 1 ivo.anjo ivo.anjo 12K May 26 15:30 ./libdatadog-33.0.0/x86_64-linux/LICENSE
-rwxr-xr-x 1 ivo.anjo ivo.anjo 10M May 26 15:30 ./libdatadog-33.0.0/x86_64-linux/lib/libdatadog_profiling.so
-rw-r--r-- 1 ivo.anjo ivo.anjo 478 May 26 15:30 ./libdatadog-33.0.0/x86_64-linux/lib/pkgconfig/datadog_profiling_with_rpath.pc
-rw-r--r-- 1 ivo.anjo ivo.anjo 531 May 26 15:30 ./libdatadog-33.0.0/x86_64-linux/lib/pkgconfig/datadog_profiling-static.pc
-rw-r--r-- 1 ivo.anjo ivo.anjo 445 May 26 15:30 ./libdatadog-33.0.0/x86_64-linux/lib/pkgconfig/datadog_profiling.pc
-rw-r--r-- 1 ivo.anjo ivo.anjo 90M May 26 15:30 ./libdatadog-33.0.0/x86_64-linux/lib/libdatadog_profiling.a
-rw-r--r-- 1 ivo.anjo ivo.anjo 34M May 26 15:30 ./libdatadog-33.0.0/x86_64-linux/lib/libdatadog_profiling.debug
-rwxr-xr-x 1 ivo.anjo ivo.anjo 17K May 26 15:30 ./libdatadog-33.0.0/x86_64-linux/bin/libdatadog-crashtracking-receiver
-rw-r--r-- 1 ivo.anjo ivo.anjo 14K May 26 15:30 ./libdatadog-33.0.0/x86_64-linux/include/datadog/telemetry.h
-rw-r--r-- 1 ivo.anjo ivo.anjo 2.4K May 26 15:30 ./libdatadog-33.0.0/x86_64-linux/include/datadog/ddsketch.h
-rw-r--r-- 1 ivo.anjo ivo.anjo 50K May 26 15:30 ./libdatadog-33.0.0/x86_64-linux/include/datadog/profiling.h
-rw-r--r-- 1 ivo.anjo ivo.anjo 46K May 26 15:30 ./libdatadog-33.0.0/x86_64-linux/include/datadog/blazesym.h
-rw-r--r-- 1 ivo.anjo ivo.anjo 4.1K May 26 15:30 ./libdatadog-33.0.0/x86_64-linux/include/datadog/library-config.h
-rw-r--r-- 1 ivo.anjo ivo.anjo 85K May 26 15:30 ./libdatadog-33.0.0/x86_64-linux/include/datadog/common.h
-rw-r--r-- 1 ivo.anjo ivo.anjo 9.3K May 26 15:30 ./libdatadog-33.0.0/x86_64-linux/include/datadog/data-pipeline.h
-rw-r--r-- 1 ivo.anjo ivo.anjo 39K May 26 15:30 ./libdatadog-33.0.0/x86_64-linux/include/datadog/crashtracker.h
-rw-r--r-- 1 ivo.anjo ivo.anjo 1.6K May 26 15:30 ./libdatadog-33.0.0/x86_64-linux/include/datadog/log.h
-rw-r--r-- 1 ivo.anjo ivo.anjo 5.0K May 26 15:30 ./libdatadog-33.0.0/x86_64-linux/include/datadog/ffe.h
-rw-r--r-- 1 ivo.anjo ivo.anjo 2.6K May  7 20:57 ./cmake/DatadogConfig.cmake
-rw-r--r-- 1 ivo.anjo ivo.anjo 138 May  7 21:00 ./NOTICE
-rw-r--r-- 1 ivo.anjo ivo.anjo 59K May  7 21:00 ./LICENSE-3rdparty.csv
-rw-r--r-- 1 ivo.anjo ivo.anjo 12K May  7 21:00 ./LICENSE
-rwxr-xr-x 1 ivo.anjo ivo.anjo 11M May  7 21:00 ./lib/libdatadog_profiling.so
-rw-r--r-- 1 ivo.anjo ivo.anjo 478 May  7 21:00 ./lib/pkgconfig/datadog_profiling_with_rpath.pc
-rw-r--r-- 1 ivo.anjo ivo.anjo 531 May  7 21:00 ./lib/pkgconfig/datadog_profiling-static.pc
-rw-r--r-- 1 ivo.anjo ivo.anjo 445 May  7 21:00 ./lib/pkgconfig/datadog_profiling.pc
-rw-r--r-- 1 ivo.anjo ivo.anjo 91M May  7 21:00 ./lib/libdatadog_profiling.a
-rwxr-xr-x 1 ivo.anjo ivo.anjo 34M May  7 21:00 ./lib/libdatadog_profiling.debug
-rwxr-xr-x 1 ivo.anjo ivo.anjo 17K May  7 21:00 ./bin/libdatadog-crashtracking-receiver
-rw-r--r-- 1 ivo.anjo ivo.anjo 14K May  7 21:00 ./include/datadog/telemetry.h
-rw-r--r-- 1 ivo.anjo ivo.anjo 2.4K May  7 21:00 ./include/datadog/ddsketch.h
-rw-r--r-- 1 ivo.anjo ivo.anjo 50K May  7 21:00 ./include/datadog/profiling.h
-rw-r--r-- 1 ivo.anjo ivo.anjo 46K May  7 21:00 ./include/datadog/blazesym.h
-rw-r--r-- 1 ivo.anjo ivo.anjo 4.1K May  7 21:00 ./include/datadog/library-config.h
-rw-r--r-- 1 ivo.anjo ivo.anjo 85K May  7 21:00 ./include/datadog/common.h
-rw-r--r-- 1 ivo.anjo ivo.anjo 9.3K May  7 21:00 ./include/datadog/data-pipeline.h
-rw-r--r-- 1 ivo.anjo ivo.anjo 39K May  7 21:00 ./include/datadog/crashtracker.h
-rw-r--r-- 1 ivo.anjo ivo.anjo 1.6K May  7 21:00 ./include/datadog/log.h
-rw-r--r-- 1 ivo.anjo ivo.anjo 5.0K May  7 21:00 ./include/datadog/ffe.h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants