Skip to content

Commit

Permalink
Merge branch 'master' into quinna/update-gemfiles-workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
quinna-h authored Sep 19, 2024
2 parents 40d5982 + 9b1d33b commit de10de9
Show file tree
Hide file tree
Showing 96 changed files with 7,665 additions and 128 deletions.
9 changes: 9 additions & 0 deletions .github/dependency_filters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
dependencies:
- Gemfile
- Appraisals
- datadog.gemspec
- tasks/appraisal.rake
- .github/workflows/lock-dependency.yml
- lib/datadog/version.rb
- appraisal/**
- gemfiles/**
2 changes: 1 addition & 1 deletion .github/workflows/add-milestone-to-pull-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
steps:
- name: Checkout code
# Checks out the branch that the pull request is merged into
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.ref }}

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build-gem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
run: |
find pkg
- name: Upload artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: 'datadog-gem-${{ matrix.type }}-gha${{ github.run_id }}-g${{ github.sha }}'
path: 'pkg/*.gem'
Expand All @@ -77,7 +77,7 @@ jobs:
- build
steps:
- name: Download artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: 'datadog-gem-${{ matrix.type }}-gha${{ github.run_id }}-g${{ github.sha }}'
path: 'pkg'
Expand All @@ -103,7 +103,7 @@ jobs:
if: ${{ inputs.push }}
steps:
- name: Download artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: 'datadog-gem-${{ matrix.type }}-gha${{ github.run_id }}-g${{ github.sha }}'
path: 'pkg'
Expand Down
128 changes: 128 additions & 0 deletions .github/workflows/lock-dependency.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
name: Lock Dependency

# TODO: Make this job mandatory
# TODO: Make this on workflow_dispatch

on:
# Limitation about `paths` types:
# > https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#git-diff-comparisons
push:
branches-ignore:
- master
- release
- '*-stable'
pull_request:
# Run this job when a PR is opened, covering the scenario where branch is ready and pushed before PR is opened.
types:
- opened


# TODO: Improve concurrency between push event and pull_request event
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pr:
name: Pull Request attached
runs-on: ubuntu-latest
outputs:
pr_found: ${{ steps.pr.outputs.pr_found }}
pr_base_ref: ${{ steps.pr.outputs.pr.base.ref }}
steps:
# Limitation with pull_request trigger: https://github.com/8BitJonny/gh-get-current-pr/tree/3.0.0/?tab=readme-ov-file#limitations
- uses: 8BitJonny/gh-get-current-pr@3.0.0
id: pr
with:
filterOutClosed: true # Don't trigger on commits with closed PRs, including merges into `master`.

dependency:
name: Depenedency changes
needs: pr
if: ${{ needs.pr.outputs.pr_found == 'true' }}
runs-on: ubuntu-latest
outputs:
changes: ${{ steps.changes.outputs.dependencies }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
with:
# This is the best effort to get the diff comparison.
# The result remains time-sensitive since the `base` is constantly changing and
# the PR cannot be guaranteed to be up-to-date.
#
# Unless enable `Require branches to be up to date before merging` in the repository rule settings
base: ${{ needs.pr.outputs.pr_base_ref }}
filters: .github/dependency_filters.yml

lock:
runs-on: ubuntu-latest
needs: dependency
if: ${{ needs.dependency.outputs.changes == 'true' }}
strategy:
fail-fast: false
matrix:
engine:
# ADD NEW RUBIES HERE
- name: ruby
version: '3.4'
- name: ruby
version: '3.3'
- name: ruby
version: '3.2'
- name: ruby
version: '3.1'
- name: ruby
version: '3.0'
- name: ruby
version: '2.7'
- name: ruby
version: '2.6'
- name: ruby
version: '2.5'
- name: jruby
version: '9.4'
- name: jruby
version: '9.3'
- name: jruby
version: '9.2'
container:
image: ghcr.io/datadog/images-rb/engines/${{ matrix.engine.name }}:${{ matrix.engine.version }}
env:
BUNDLE_WITHOUT: check
steps:
- uses: actions/checkout@v4
- run: |
ruby -v
gem -v
bundler -v
- run: bundle install

# TODO: Migrate away from `appraisal`
- run: bundle exec appraisal generate
- run: bundle exec rake dependency:lock
- uses: actions/upload-artifact@v4
with:
name: lock-dependency-${{ github.run_id }}-${{ matrix.engine.name }}-${{ matrix.engine.version }}
path: gemfiles/${{ matrix.engine.name }}_${{ matrix.engine.version }}*

# TODO: Change token to trigger workflow automation
# > New commit by GITHUB_TOKEN does not trigger workflow automation to prevent infinite loop
commit:
name: Commit changes
needs: lock
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: gemfiles
pattern: lock-dependency-${{ github.run_id }}-*
merge-multiple: true
- uses: stefanzweifel/git-auto-commit-action@v5
with:
file_pattern: 'gemfiles/*'
commit_message: "[🤖] Lock Dependency: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
3 changes: 1 addition & 2 deletions .github/workflows/pull-request-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ jobs:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: kachkaev/labeler@d89797c51d07680aec17049cc6790e9d323d9a93 # actions/labeler@v4 + https://github.com/actions/labeler/pull/316
- uses: actions/labeler@v5
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: .github/labeler.yml
dot: true # From https://github.com/actions/labeler/pull/316
2 changes: 1 addition & 1 deletion .github/workflows/system-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ jobs:
- name: Log in to the Container registry
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ${{ env.REGISTRY }} -u ${{ github.actor }} --password-stdin
- uses: actions/delete-package-versions@v4
- uses: actions/delete-package-versions@v5
with:
package-version-ids: 'gha${{ github.run_id }}-g${{ github.sha }}'
package-name: 'system-tests/${{ matrix.image }}'
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/yard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ jobs:
- name: Generate YARD documentation
run: bundle exec rake docs --rakefile=tasks/yard.rake
- name: Setup Pages
uses: actions/configure-pages@v3
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
# Upload generated YARD directory
path: 'doc/'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,4 @@ Style/ClassVars:
- 'spec/datadog/tracing/contrib/rails/support/rails4.rb'
- 'spec/datadog/tracing/contrib/rails/support/rails5.rb'
- 'spec/datadog/tracing/contrib/rails/support/rails6.rb'
- 'spec/datadog/tracing/contrib/rails/support/rails7.rb'
2 changes: 1 addition & 1 deletion Appraisals
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def build_coverage_matrix(integration, range, gem: nil, min: nil, meta: {})

if min
appraise "#{integration}-min" do
gem gem, "= #{n}"
gem gem, "= #{min}"
meta.each { |k, v| gem k, v }
end
end
Expand Down
7 changes: 6 additions & 1 deletion Matrixfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
'opentelemetry' => '❌ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ❌ jruby'
},
'action_pack' => {
'activesupport' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
'rails5-mysql2' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ❌ 3.0 / ❌ 3.1 / ❌ 3.2 / ❌ 3.3 / ❌ 3.4 / ✅ jruby',
'rails6-mysql2' => '❌ 2.5 / ❌ 2.6 / ❌ 2.7 / ❌ 3.0 / ❌ 3.1 / ❌ 3.2 / ❌ 3.3 / ❌ 3.4 / ✅ jruby',
'rails7' => '❌ 2.5 / ❌ 2.6 / ❌ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ❌ jruby',
'rails71' => '❌ 2.5 / ❌ 2.6 / ❌ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ❌ jruby',
},
'action_view' => {
'activesupport' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
Expand Down Expand Up @@ -173,6 +176,8 @@
'stripe-9' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
'stripe-8' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
'stripe-7' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby',
# TODO: Add stripe-5 and stripe-6
'stripe-min' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby', # 5.15.0
},
'sucker_punch' => {
'contrib' => '✅ 2.5 / ✅ 2.6 / ✅ 2.7 / ✅ 3.0 / ✅ 3.1 / ✅ 3.2 / ✅ 3.3 / ✅ 3.4 / ✅ jruby'
Expand Down
2 changes: 1 addition & 1 deletion appraisal/jruby-9.2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
gem 'typhoeus'
end

build_coverage_matrix('stripe', 7..12)
build_coverage_matrix('stripe', 7..12, min: '5.15.0')
build_coverage_matrix('opensearch', 2..3, gem: 'opensearch-ruby')
build_coverage_matrix('elasticsearch', 7..8)

Expand Down
2 changes: 1 addition & 1 deletion appraisal/jruby-9.3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
gem 'typhoeus'
end

build_coverage_matrix('stripe', 7..12)
build_coverage_matrix('stripe', 7..12, min: '5.15.0')
build_coverage_matrix('opensearch', 2..3, gem: 'opensearch-ruby')
build_coverage_matrix('elasticsearch', 7..8)

Expand Down
2 changes: 1 addition & 1 deletion appraisal/jruby-9.4.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
gem 'typhoeus'
end

build_coverage_matrix('stripe', 7..12)
build_coverage_matrix('stripe', 7..12, min: '5.15.0')
build_coverage_matrix('opensearch', 2..3, gem: 'opensearch-ruby')
build_coverage_matrix('elasticsearch', 7..8)

Expand Down
2 changes: 1 addition & 1 deletion appraisal/ruby-2.5.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@
gem 'typhoeus'
end

build_coverage_matrix('stripe', 7..12)
build_coverage_matrix('stripe', 7..12, min: '5.15.0')
build_coverage_matrix('opensearch', 2..3, gem: 'opensearch-ruby')
build_coverage_matrix('elasticsearch', 7..8)

Expand Down
6 changes: 5 additions & 1 deletion appraisal/ruby-2.6.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
gem 'typhoeus'
end

build_coverage_matrix('stripe', 7..12)
build_coverage_matrix('stripe', 7..12, min: '5.15.0')
build_coverage_matrix('opensearch', 2..3, gem: 'opensearch-ruby')
build_coverage_matrix('elasticsearch', 7..8)

Expand All @@ -189,6 +189,10 @@
gem 'ruby-kafka', '>= 0.7.10'
end

appraise 'actionpack-5.0' do
gem 'rails', '~> 5.0'
end

appraise 'contrib' do
gem 'concurrent-ruby'
gem 'dalli', '>= 3.0.0'
Expand Down
2 changes: 1 addition & 1 deletion appraisal/ruby-2.7.rb
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
gem 'typhoeus'
end

build_coverage_matrix('stripe', 7..12)
build_coverage_matrix('stripe', 7..12, min: '5.15.0')
build_coverage_matrix('opensearch', 2..3, gem: 'opensearch-ruby')
build_coverage_matrix('elasticsearch', 7..8)

Expand Down
10 changes: 9 additions & 1 deletion appraisal/ruby-3.0.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@
gem 'net-smtp'
end

appraise 'rails7' do
gem 'rails', '~> 7.0.0'
end

appraise 'rails71' do
gem 'rails', '~> 7.1.0'
end

appraise 'resque2-redis3' do
gem 'redis', '< 4.0'
gem 'resque', '>= 2.0'
Expand All @@ -75,7 +83,7 @@
gem 'typhoeus'
end

build_coverage_matrix('stripe', 7..12)
build_coverage_matrix('stripe', 7..12, min: '5.15.0')
build_coverage_matrix('opensearch', 2..3, gem: 'opensearch-ruby')
build_coverage_matrix('elasticsearch', 7..8)

Expand Down
10 changes: 9 additions & 1 deletion appraisal/ruby-3.1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@
gem 'net-smtp'
end

appraise 'rails7' do
gem 'rails', '~> 7.0.0'
end

appraise 'rails71' do
gem 'rails', '~> 7.1.0'
end

appraise 'resque2-redis3' do
gem 'redis', '< 4.0'
gem 'resque', '>= 2.0'
Expand All @@ -75,7 +83,7 @@
gem 'typhoeus'
end

build_coverage_matrix('stripe', 7..12)
build_coverage_matrix('stripe', 7..12, min: '5.15.0')
build_coverage_matrix('opensearch', 2..3, gem: 'opensearch-ruby')
build_coverage_matrix('elasticsearch', 7..8)

Expand Down
10 changes: 9 additions & 1 deletion appraisal/ruby-3.2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@
gem 'net-smtp'
end

appraise 'rails7' do
gem 'rails', '~> 7.0.0'
end

appraise 'rails71' do
gem 'rails', '~> 7.1.0'
end

appraise 'resque2-redis3' do
gem 'redis', '< 4.0'
gem 'resque', '>= 2.0'
Expand All @@ -75,7 +83,7 @@
gem 'typhoeus'
end

build_coverage_matrix('stripe', 7..12)
build_coverage_matrix('stripe', 7..12, min: '5.15.0')
build_coverage_matrix('opensearch', 2..3, gem: 'opensearch-ruby')
build_coverage_matrix('elasticsearch', 7..8)

Expand Down
Loading

0 comments on commit de10de9

Please sign in to comment.