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..ea948b4c --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,43 @@ +name: Ruby Test + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +permissions: + contents: read + +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] + 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 + 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 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/). diff --git a/spec/integrations/connection_edge_case_spec.rb b/spec/integrations/connection_edge_case_spec.rb index 826a955c..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,6 +220,10 @@ end describe 'when having problems with UDS communication' do + before do + 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/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 diff --git a/spec/statsd/udp_connection_spec.rb b/spec/statsd/udp_connection_spec.rb index 3a6abd8b..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 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..d32752d8 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 + before do + skip "UDS not supported on Windows" if Gem.win_platform? + end + subject do described_class.new(socket_path, logger: logger, telemetry: telemetry) end