Skip to content

Commit

Permalink
ci: Add appraisals for OTLP exporter (#1499)
Browse files Browse the repository at this point in the history
* ci: Add appraisals for OTLP exporter

This is an attempt to ensure compatability with a range of google-protobuf gem versions

* squash: Bring in @robbkidd changes

---------

Co-authored-by: Robert <[email protected]>
  • Loading branch information
arielvalentin and robertlaurin authored Jul 27, 2023
1 parent 8e4da19 commit c0ebecf
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 37 deletions.
59 changes: 26 additions & 33 deletions .github/actions/test_gem/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ runs:
id: setup
shell: bash
run: |
# 🛠️ Setup 🛠️
dir=$(find . -iname '${{ inputs.gem }}.gemspec' -exec dirname {} \;)
echo "gem_dir=${dir}" >> $GITHUB_OUTPUT
Expand All @@ -57,76 +58,68 @@ runs:
# ...but not for appraisals, sadly.
- name: Install Ruby ${{ inputs.ruby }} with dependencies
if: "${{ steps.setup.outputs.appraisals == 'false' }}"
uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@v1.144.1
with:
ruby-version: "${{ inputs.ruby }}"
working-directory: "${{ steps.setup.outputs.gem_dir }}"
bundler: "latest"
bundler-cache: true
cache-version: "v1-${{ steps.setup.outputs.cache_key }}"

# If we're using appraisals, do it all manually.
- name: Install Ruby ${{ inputs.ruby }} without dependencies
if: "${{ steps.setup.outputs.appraisals == 'true' }}"
uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@v1.144.1
with:
ruby-version: "${{ inputs.ruby }}"
- name: Install dependencies and appraisals
bundler: "latest"
working-directory: "${{ steps.setup.outputs.gem_dir }}"
- name: Install dependencies and generate appraisals
if: "${{ steps.setup.outputs.appraisals == 'true' }}"
shell: bash
run: |
cd "${{ steps.setup.outputs.gem_dir }}"
bundle install
bundle exec appraisal install
# 💎 Install dependencies and generate appraisals 💎
bundle install --quiet --jobs=3 --retry=4
bundle exec appraisal generate
working-directory: "${{ steps.setup.outputs.gem_dir }}"

- name: Test Gem
shell: bash
run: |
cd "${{ steps.setup.outputs.gem_dir }}"
# 🍿 Test Gem 🍿
if [[ -f "Appraisals" ]]; then
bundle exec appraisal rake test
for i in `bundle exec appraisal list | sed 's/-/_/g' `; do
echo "::group::🔎 Appraising ${i}"
BUNDLE_GEMFILE=gemfiles/${i}.gemfile bundle install --quiet --jobs=3 --retry=4 && \
BUNDLE_GEMFILE=gemfiles/${i}.gemfile bundle show && \
BUNDLE_GEMFILE=gemfiles/${i}.gemfile bundle exec rake test
echo "::endgroup::"
done
else
bundle exec rake test
fi
env:
TEST_KAFKA_HOST: "127.0.0.1"
TEST_KAFKA_PORT: 29092
TEST_MYSQL_HOST: "127.0.0.1"
TEST_MYSQL_PORT: 3306
TEST_MYSQL_USER: mysql
TEST_MYSQL_PASSWORD: mysql
TEST_POSTGRES_PASSWORD: postgres
TEST_POSTGRES_USER: postgres
TEST_POSTGRES_HOST: localhost
TEST_POSTGRES_PORT: 5432
TEST_POSTGRES_DB: postgres
TEST_MEMCACHED_HOST: localhost
TEST_MEMCACHED_PORT: 11211
TEST_MONGODB_HOST: localhost
TEST_MONGODB_PORT: 27017
TEST_RABBITMQ_HOST: localhost
TEST_RABBITMQ_PORT: 5672
TEST_RABBITMQ_URL: amqp://guest:guest@localhost:5672
TEST_REDIS_HOST: localhost
TEST_REDIS_PORT: 6379
working-directory: "${{ steps.setup.outputs.gem_dir }}"

- name: YARD
shell: bash
if: "${{ inputs.yard == 'true' }}"
run: |
cd "${{ steps.setup.outputs.gem_dir }}"
# 📄 Yard Docs 📄
bundle exec rake yard
working-directory: "${{ steps.setup.outputs.gem_dir }}"

- name: Rubocop
shell: bash
if: "${{ inputs.rubocop == 'true' }}"
run: |
cd "${{ steps.setup.outputs.gem_dir }}"
# 🤖 Rubocop 🤖
bundle exec rake rubocop
working-directory: "${{ steps.setup.outputs.gem_dir }}"

- name: Build Gem
shell: bash
if: "${{ inputs.build == 'true' }}"
run: |
cd "${{ steps.setup.outputs.gem_dir }}"
# 📦 Build Gem 📦
gem build ${{ inputs.gem }}.gemspec
working-directory: "${{ steps.setup.outputs.gem_dir }}"
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@


# Appraisals
instrumentation/**/gemfiles

# Sqlite file for tests
instrumentation/active_record/db
**/*/gemfiles

# Vendored gems
**/vendor/**/*
Expand Down
12 changes: 12 additions & 0 deletions exporter/otlp/Appraisals
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

# Copyright The OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0

(19..23).each do |i|
version = "3.#{i}"
appraise "google-protobuf-#{version}" do
gem 'google-protobuf', "~> #{version}"
end
end
1 change: 1 addition & 0 deletions exporter/otlp/opentelemetry-exporter-otlp.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Gem::Specification.new do |spec|
spec.add_dependency 'opentelemetry-sdk', '~> 1.2'
spec.add_dependency 'opentelemetry-semantic_conventions'

spec.add_development_dependency 'appraisal', '~> 2.2.0'
spec.add_development_dependency 'bundler', '>= 1.17'
spec.add_development_dependency 'faraday', '~> 0.13'
spec.add_development_dependency 'minitest', '~> 5.0'
Expand Down

0 comments on commit c0ebecf

Please sign in to comment.