Skip to content
Open
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2e1e41a
Scaffold logic
thompson-tomo Apr 10, 2026
a1c24ac
Testing
thompson-tomo Apr 10, 2026
50a24e9
Update ci-build-ruby.yml
thompson-tomo Apr 10, 2026
5bc2775
fix
thompson-tomo Apr 10, 2026
88ab871
Refactor gem selector
thompson-tomo Apr 10, 2026
135d78c
Finish refactor
thompson-tomo Apr 10, 2026
ffa594a
fix
thompson-tomo Apr 10, 2026
1cf487b
fix
thompson-tomo Apr 10, 2026
f5a58c6
lint
thompson-tomo Apr 10, 2026
f6f21cd
Fix the everything check
thompson-tomo Apr 10, 2026
84b8a1c
Improve job output
thompson-tomo Apr 10, 2026
208ea0e
Consolidate non label scenario
thompson-tomo Apr 10, 2026
224541a
Update action.yml
thompson-tomo Apr 10, 2026
a9d4406
Typo fix
thompson-tomo Apr 10, 2026
a774374
Lint fix
thompson-tomo Apr 10, 2026
18464e8
Use default value in array
thompson-tomo Apr 10, 2026
601dabe
Add caching
thompson-tomo Apr 10, 2026
62a44fa
Lint fix
thompson-tomo Apr 10, 2026
e384548
More cache changes
thompson-tomo Apr 10, 2026
daaf6c2
Finish cache
thompson-tomo Apr 10, 2026
ab2b0bf
update
thompson-tomo Apr 10, 2026
b8ea32b
update
thompson-tomo Apr 10, 2026
cab4903
Update ci-build-ruby.yml
thompson-tomo Apr 11, 2026
a2d8e9b
Update Rakefile
thompson-tomo Apr 11, 2026
6bd293a
Update ci-build-ruby.yml
thompson-tomo Apr 11, 2026
2ff8c93
Update Rakefile
thompson-tomo Apr 11, 2026
60d786c
Update Workflow name
thompson-tomo Apr 15, 2026
213b66c
Adds a verify to ensure builds have run
thompson-tomo Apr 16, 2026
8979d68
Update ci-build-ruby.yml
thompson-tomo Apr 18, 2026
a01d95c
Update ci-build-ruby.yml
thompson-tomo Apr 18, 2026
ead4c98
Update ci-build-ruby.yml
thompson-tomo Apr 18, 2026
a20eb9c
Update ci-build-ruby.yml
thompson-tomo Apr 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/actions/select_gem/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Select Gems
description: Selects the Gems
inputs:
token:
description: Token used to add labels
required: false
type: string
default:
description: Gem string to be used if not able use pr label
required: false
type: string
default: ""
outputs:
gems:
description: The gems which have been changed
value: ${{steps.select.outputs.gems}}

runs:
using: composite
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2

- uses: actions/labeler@634933edcd8ababfe52f92936142cc22ac488b1b # v6.0.1
name: Calculate Gems
if: ${{ github.event_name == 'pull_request' }}
id: label
with:
repo-token: "${{ inputs.token }}"
sync-labels: true

- name: Select Gems
id: select
shell: bash
run: |
# Select Gems
default="${{ inputs.default }}"
deny='["ci", "deprecated"]'
labels="${{ steps.label.outputs.all-labels || inputs.default }}"
# labels is a comma-separated string, convert to JSON array
json=$(printf '%s\n' "$labels" | jq -R 'split(",")')

# Remove deny-listed items
filtered=$(echo "$json" | jq --argjson deny "$deny" '[ .[] | select(. as $l | $deny | index($l) | not) ]')

# Guarantee valid JSON by adding default
if [ -z "$filtered" ] || [ "$filtered" = "null" ] || [ "$(echo "$filtered" | jq 'length')" -eq 0 ]; then
filtered=$(jq -n --arg d "$default" '[ $d ]')
fi

{
echo "gems<<EOF"
echo "$filtered"
echo "EOF"
} >> "$GITHUB_OUTPUT"

- shell: bash
run: |
# Log Gems Selected
echo "Gems selected = ${{ steps.select.outputs.gems }}"
1 change: 1 addition & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
dependencyDashboardCategory: "Min Ruby Runtime",
matchDepNames: ["ruby"],
matchFileNames: [
".github/workflows/ci-build-ruby.yml",
".github/workflows/ci-markdown-checks.yml",
"**/*.gemspec",
],
Expand Down
139 changes: 139 additions & 0 deletions .github/workflows/ci-build-ruby.yml
Comment thread
thompson-tomo marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: Build / Source

on:
workflow_dispatch:
push:
branches:
- main
paths: &path_filters
- ".yardopts"
- "GEMFILE"
- "RAKEFILE"
- "**/.yardopts"
- "**/GEMFILE"
- "**/LICENSE"
- "**/RAKEFILE"
- "**/*.gemspec"
- "**/*.md"
- "**/lib/**"
- ".github/actions/select_gem/action.yml"
- ".github/workflows/ci-buid-ruby.yml"
pull_request:
branches:
- main
paths: *path_filters
merge_group:

Comment thread
thompson-tomo marked this conversation as resolved.
jobs:
analyze:
runs-on: ubuntu-24.04
outputs:
gems: ${{steps.select_gem.outputs.gems}}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- uses: ./.github/actions/select_gem
name: Select Gems
id: select_gem
with:
token: "${{ secrets.GITHUB_TOKEN }}"
default: "Everything"

build:
runs-on: ubuntu-24.04
needs: analyze
if: ${{ needs.analyze.outputs.gems != '[]' }}
strategy:
matrix:
gem: ${{ fromJson(needs.analyze.outputs.gems) }}
fail-fast: false
name: ${{ matrix.gem }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup
if: ${{ matrix.gem != 'Everything' }}
id: setup
shell: bash
run: |
# 🛠️ Setup 🛠️
dir=$(find . -iname 'opentelemetry-${{ matrix.gem }}.gemspec' -exec dirname {} \;)
echo "gem_dir=${dir}" >> $GITHUB_OUTPUT
- name: Install Ruby
uses: ruby/setup-ruby@e65c17d16e57e481586a6a5a0282698790062f92 # v1.300.0
with:
ruby-version: "3.3.11"
- name: Compute Gemfile hash
id: lockhash
shell: bash
working-directory: ${{ steps.setup.outputs.gem_dir }}
run: |
files=$(find . -name "Gemfile" | sort)
if [[ -n "$files" ]]; then
hash=$(sha256sum $files | sha256sum | cut -d ' ' -f1)
echo "hash=$hash" >> $GITHUB_OUTPUT
else
echo "hash=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT
fi
- name: Cache Bundler
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 #v5.0.4
with:
path: |
vendor/bundle
.bundle
${{ steps.setup.outputs.gem_dir }}/vendor/bundle
${{ steps.setup.outputs.gem_dir }}/.bundle
key: bundler-${{ runner.os }}-${{ matrix.gem }}-${{ steps.lockhash.outputs.hash }}
restore-keys: |
bundler-${{ runner.os }}-${{ matrix.gem }}-
- name: Install Tools & Gem Deps
run: |
# Always install tools
bundle config set path vendor/bundle
bundle config set clean false
bundle install --jobs 4 --retry 3

# Conditionally install gem deps
if [ "${{ matrix.gem }}" = "Everything" ]; then
bundle exec rake install
fi
working-directory: "${{ steps.setup.outputs.gem_dir || '' }}"
- name: YARD
shell: bash
run: |
# 📄 Yard Docs 📄
bundle exec rake yard
working-directory: "${{ steps.setup.outputs.gem_dir || '' }}"
- name: Build Gem
shell: bash
run: |
# 📦 Build Gem 📦
bundle exec rake build
working-directory: "${{ steps.setup.outputs.gem_dir || '' }}"

verify:
runs-on: ubuntu-24.04
needs:
- analyze
- build
if: ${{ always() }} # Always run so we can detect failures/skips
steps:
- name: Count builds
run: |
if [ "${{ needs.analyze.outputs.gems }}" = "[]" ]; then
echo "❌ No gems selected — build matrix was empty."
exit 1
fi
gems='${{ needs.analyze.outputs.gems }}'
count=$(echo "$gems" | jq 'length')
echo "ℹ️ Build count: $count"

- name: Check build results
run: |
if [ "${{ needs.build.result }}" = "skipped" ]; then
echo "❌ Build job was skipped — no builds executed."
exit 1
fi
if [ "${{ needs.build.result }}" != "success" ]; then
echo "❌ One or more builds failed."
exit 1
fi
echo "✅ All builds ran and passed."
39 changes: 34 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,53 @@ namespace :each do
task :default do
foreach_gem('bundle exec rake')
end

task :build do
foreach_gem('bundle exec rake build')
end

task :install do
path = File.join(Dir.pwd, "vendor", "bundle")
foreach_gem([
"bundle config set path #{path}",
"bundle config set clean false",
"bundle install --jobs 4 --retry 3"
])
end
end

task each: 'each:default'

task build: ['each:build']
task install: ['each:install']
task yard: ['each:yard']

task default: [:each]

def foreach_gem(cmd)
Dir.glob("**/opentelemetry-*.gemspec") do |gemspec|
EXCLUDED_DIRS = %w[vendor]

def foreach_gem(cmds)
cmds = Array(cmds) # string → ["string"], array stays array
gemspecs =
Dir.glob("**/opentelemetry-*.gemspec")
.reject do |path|
EXCLUDED_DIRS.any? do |d|
path.include?("/#{d}/") || path.start_with?("#{d}/")
end
end
.sort

gemspecs.each do |gemspec|
name = File.basename(gemspec, ".gemspec")
dir = File.dirname(gemspec)
puts "**** Entering #{dir}"
Dir.chdir(dir) do
if defined?(Bundler)
Bundler.with_clean_env do
sh(cmd)
Bundler.with_unbundled_env do
cmds.each { |cmd| sh(cmd) }
end
else
sh(cmd)
cmds.each { |cmd| sh(cmd) }
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion sampler/xray/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# opentelemetry-sampler-xray
# OpenTelemetry::Sampler::XRay

The `opentelemetry-sampler-xray` gem contains the AWS X-Ray Remote Sampler for OpenTelemetry.

Expand Down
Loading