From 2589b5a6bc85ae04eb0ed75a42e9719d553fdef6 Mon Sep 17 00:00:00 2001 From: Stephen Wakely Date: Thu, 3 Jul 2025 14:57:06 +0100 Subject: [PATCH 1/9] Move to github actions testing windows and Macos --- .circleci/config.yml | 69 -------------------------------------- .github/workflows/test.yml | 27 +++++++++++++++ 2 files changed, 27 insertions(+), 69 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/test.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index b82bc805..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,69 +0,0 @@ -version: 2 - -x-dockerbuild: &dockerbuild - steps: - - checkout - - run: bundle install --with development - - run: bundle exec rake spec - -jobs: - test-ruby-2.1: - <<: *dockerbuild - docker: - - image: circleci/ruby:2.1-node - test-ruby-2.2: - <<: *dockerbuild - docker: - - image: circleci/ruby:2.2-node - test-ruby-2.3: - <<: *dockerbuild - docker: - - image: circleci/ruby:2.3-node - test-ruby-2.4: - <<: *dockerbuild - docker: - - image: cimg/ruby:2.4-node - test-ruby-2.5: - <<: *dockerbuild - docker: - - image: cimg/ruby:2.5-node - test-ruby-2.6: - <<: *dockerbuild - docker: - - image: cimg/ruby:2.6-node - test-ruby-2.7: - <<: *dockerbuild - docker: - - image: cimg/ruby:2.7-node - test-ruby-3.0: - <<: *dockerbuild - docker: - - image: cimg/ruby:3.0-node - test-ruby-3.1: - <<: *dockerbuild - docker: - - image: cimg/ruby:3.1-node - test-ruby-3.2: - <<: *dockerbuild - docker: - - image: cimg/ruby:3.2-node - test-ruby-3.3: - <<: *dockerbuild - docker: - - image: cimg/ruby:3.3-node - -workflows: - version: 2 - check_compile: - jobs: - - test-ruby-2.1 - - test-ruby-2.2 - - test-ruby-2.3 - - test-ruby-2.4 - - test-ruby-2.5 - - test-ruby-2.6 - - test-ruby-2.7 - - test-ruby-3.0 - - test-ruby-3.1 - - test-ruby-3.2 - - test-ruby-3.3 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..862436eb --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,27 @@ +name: Ruby Test + +jobs: + test: + name: Ruby ${{ matrix.ruby }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + ruby: [2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2, 3.3, 3.4] + + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + + - name: Install dependencies + run: bundle install --with development + + - name: Run tests + run: bundle exec rake spec From ffc541298245bf596876cbbbb16a850c7b97cc55 Mon Sep 17 00:00:00 2001 From: Stephen Wakely Date: Thu, 3 Jul 2025 15:16:16 +0100 Subject: [PATCH 2/9] Add on --- .github/workflows/test.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 862436eb..a2f42bde 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,14 @@ name: Ruby Test +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +permissions: + contents: read + jobs: test: name: Ruby ${{ matrix.ruby }} on ${{ matrix.os }} From 4a4e31c26b98b53485e23647c9f13ffa9638d450 Mon Sep 17 00:00:00 2001 From: Stephen Wakely Date: Thu, 3 Jul 2025 15:30:05 +0100 Subject: [PATCH 3/9] Kick off ci From d723a9429bfac36e6ddcddbca7d1355620336551 Mon Sep 17 00:00:00 2001 From: Stephen Wakely Date: Thu, 3 Jul 2025 15:41:23 +0100 Subject: [PATCH 4/9] Exclude < 2.6 on macos latest as it isn't supported --- .github/workflows/test.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a2f42bde..ea948b4c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,6 +18,13 @@ jobs: matrix: os: [ubuntu-latest, macos-latest, windows-latest] ruby: [2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 3.0, 3.1, 3.2, 3.3, 3.4] + exclude: + # CRuby < 2.6 does not support macos-arm64. + - { os: macos-latest, ruby: '2.1' } + - { os: macos-latest, ruby: '2.2' } + - { os: macos-latest, ruby: '2.3' } + - { os: macos-latest, ruby: '2.4' } + - { os: macos-latest, ruby: '2.5' } steps: - name: Checkout repo From aadc45e5ba9a44cd50517dd6bc86be7ac06e9524 Mon Sep 17 00:00:00 2001 From: Stephen Wakely Date: Thu, 3 Jul 2025 16:55:43 +0100 Subject: [PATCH 5/9] Fix windows failures --- spec/integrations/connection_edge_case_spec.rb | 6 +++++- spec/statsd/udp_connection_spec.rb | 2 +- spec/statsd/uds_connection_spec.rb | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/spec/integrations/connection_edge_case_spec.rb b/spec/integrations/connection_edge_case_spec.rb index 826a955c..637d07c3 100644 --- a/spec/integrations/connection_edge_case_spec.rb +++ b/spec/integrations/connection_edge_case_spec.rb @@ -220,6 +220,10 @@ end describe 'when having problems with UDS communication' do + def setup + skip "UDS not supported on Windows" if Gem.win_platform? + end + subject do Datadog::Statsd::UDSConnection.new('/tmp/socket', logger: logger) end @@ -481,4 +485,4 @@ end end end -end \ No newline at end of file +end diff --git a/spec/statsd/udp_connection_spec.rb b/spec/statsd/udp_connection_spec.rb index 3a6abd8b..2a253aa0 100644 --- a/spec/statsd/udp_connection_spec.rb +++ b/spec/statsd/udp_connection_spec.rb @@ -532,7 +532,7 @@ it 'logs the error message' do subject.write('foobar') - expect(log.string).to match 'Errno::ECONNREFUSED Connection refused - yolo' + expect(log.string).to match(/'Errno::ECONNREFUSED .* - yolo'/) end it 'tries to send through the initial socket' do diff --git a/spec/statsd/uds_connection_spec.rb b/spec/statsd/uds_connection_spec.rb index 7990746e..a556231d 100644 --- a/spec/statsd/uds_connection_spec.rb +++ b/spec/statsd/uds_connection_spec.rb @@ -1,6 +1,10 @@ require 'spec_helper' describe Datadog::Statsd::UDSConnection do + def setup + skip "UDS not supported on Windows" if Gem.win_platform? + end + subject do described_class.new(socket_path, logger: logger, telemetry: telemetry) end From 8653aff8e08381f1c65b9999a80d8bc2f532e88f Mon Sep 17 00:00:00 2001 From: Stephen Wakely Date: Thu, 3 Jul 2025 17:02:56 +0100 Subject: [PATCH 6/9] Fix test --- spec/statsd/udp_connection_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/statsd/udp_connection_spec.rb b/spec/statsd/udp_connection_spec.rb index 2a253aa0..058b8a7d 100644 --- a/spec/statsd/udp_connection_spec.rb +++ b/spec/statsd/udp_connection_spec.rb @@ -532,7 +532,7 @@ it 'logs the error message' do subject.write('foobar') - expect(log.string).to match(/'Errno::ECONNREFUSED .* - yolo'/) + expect(log.string).to match(/Errno::ECONNREFUSED .* - yolo/) end it 'tries to send through the initial socket' do From d9385b6bf7a465f4de6ed7c06330a78c0c844d2c Mon Sep 17 00:00:00 2001 From: Stephen Wakely Date: Thu, 3 Jul 2025 17:11:02 +0100 Subject: [PATCH 7/9] Skip propely --- spec/integrations/connection_edge_case_spec.rb | 4 ++-- spec/statsd/uds_connection_spec.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/integrations/connection_edge_case_spec.rb b/spec/integrations/connection_edge_case_spec.rb index 637d07c3..b99332dd 100644 --- a/spec/integrations/connection_edge_case_spec.rb +++ b/spec/integrations/connection_edge_case_spec.rb @@ -212,7 +212,7 @@ it 'logs the error message' do subject.write('foobar') - expect(log.string).to match 'Errno::ECONNREFUSED Connection refused - yolo' + expect(log.string).to match(/Errno::ECONNREFUSED .* - yolo/) end end end @@ -220,7 +220,7 @@ end describe 'when having problems with UDS communication' do - def setup + before do skip "UDS not supported on Windows" if Gem.win_platform? end diff --git a/spec/statsd/uds_connection_spec.rb b/spec/statsd/uds_connection_spec.rb index a556231d..d32752d8 100644 --- a/spec/statsd/uds_connection_spec.rb +++ b/spec/statsd/uds_connection_spec.rb @@ -1,7 +1,7 @@ require 'spec_helper' describe Datadog::Statsd::UDSConnection do - def setup + before do skip "UDS not supported on Windows" if Gem.win_platform? end From ff38f73f890a1a42ab394412009c54e4a3d882c3 Mon Sep 17 00:00:00 2001 From: Stephen Wakely Date: Thu, 3 Jul 2025 17:16:03 +0100 Subject: [PATCH 8/9] Increase time range --- spec/statsd/timer_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/statsd/timer_spec.rb b/spec/statsd/timer_spec.rb index 4295ec82..08aa7c05 100644 --- a/spec/statsd/timer_spec.rb +++ b/spec/statsd/timer_spec.rb @@ -50,8 +50,8 @@ second_call_time = call_times.pop # the third call is made immediatelly after the second call third_call_time = call_times.pop - expect(second_call_time - first_call_time).to be_within(0.01).of(interval * 2) - expect(third_call_time - second_call_time).to be_within(0.01).of(0) + expect(second_call_time - first_call_time).to be_within(0.02).of(interval * 2) + expect(third_call_time - second_call_time).to be_within(0.02).of(0) end end end From f4d38ae4252dc2c8d9641a208a308b8d4638db7b Mon Sep 17 00:00:00 2001 From: Stephen Wakely Date: Thu, 3 Jul 2025 17:58:03 +0100 Subject: [PATCH 9/9] Update build status in Readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 10335f31..5c7e3941 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ A client for DogStatsD, an extension of the StatsD metric server for Datadog. Full API documentation is available in [DogStatsD-ruby rubydoc](https://www.rubydoc.info/github/DataDog/dogstatsd-ruby/master/Datadog/Statsd). -[![Build Status](https://secure.travis-ci.org/DataDog/dogstatsd-ruby.svg)](http://travis-ci.org/DataDog/dogstatsd-ruby) +[![Build Status](https://github.com/DataDog/dogstatsd-ruby/actions/workflows/test.yml/badge.svg)](https://github.com/DataDog/dogstatsd-ruby/actions/workflows/test.yml) See [CHANGELOG.md](CHANGELOG.md) for changes. To suggest a feature, report a bug, or general discussion, [open an issue](http://github.com/DataDog/dogstatsd-ruby/issues/).