Skip to content

Commit

Permalink
Modernize gem.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Jul 14, 2024
1 parent 99ffdd5 commit 3bb6685
Show file tree
Hide file tree
Showing 64 changed files with 23,857 additions and 1,299 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ root = true
[*]
indent_style = tab
indent_size = 2

[*.{yml,yaml}]
indent_style = space
indent_size = 2
25 changes: 25 additions & 0 deletions .github/workflows/documentation-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Documentation Coverage

on: [push, pull_request]

permissions:
contents: read

env:
CONSOLE_OUTPUT: XTerm
COVERAGE: PartialSummary

jobs:
validate:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true

- name: Validate coverage
timeout-minutes: 5
run: bundle exec bake decode:index:coverage lib
58 changes: 58 additions & 0 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Documentation

on:
push:
branches:
- main

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages:
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment:
concurrency:
group: "pages"
cancel-in-progress: true

env:
CONSOLE_OUTPUT: XTerm
BUNDLE_WITH: maintenance

jobs:
generate:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true

- name: Installing packages
run: sudo apt-get install wget

- name: Generate documentation
timeout-minutes: 5
run: bundle exec bake utopia:project:static --force no

- name: Upload documentation artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs

deploy:
runs-on: ubuntu-latest

environment:
name: github-pages
url: ${{steps.deployment.outputs.page_url}}

needs: generate
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
32 changes: 0 additions & 32 deletions .github/workflows/documentation.yml

This file was deleted.

57 changes: 57 additions & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Test Coverage

on: [push, pull_request]

permissions:
contents: read

env:
CONSOLE_OUTPUT: XTerm
COVERAGE: PartialSummary

jobs:
test:
name: ${{matrix.ruby}} on ${{matrix.os}}
runs-on: ${{matrix.os}}-latest

strategy:
matrix:
os:
- ubuntu
- macos

ruby:
- "3.3"

steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{matrix.ruby}}
bundler-cache: true

- name: Run tests
timeout-minutes: 5
run: bundle exec bake test

- uses: actions/upload-artifact@v3
with:
name: coverage-${{matrix.os}}-${{matrix.ruby}}
path: .covered.db

validate:
needs: test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true

- uses: actions/download-artifact@v3

- name: Validate coverage
timeout-minutes: 5
run: bundle exec bake covered:validate --paths */.covered.db \;
36 changes: 36 additions & 0 deletions .github/workflows/test-external.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Test External

on: [push, pull_request]

permissions:
contents: read

env:
CONSOLE_OUTPUT: XTerm

jobs:
test:
name: ${{matrix.ruby}} on ${{matrix.os}}
runs-on: ${{matrix.os}}-latest

strategy:
matrix:
os:
- ubuntu
- macos

ruby:
- "3.1"
- "3.2"
- "3.3"

steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{matrix.ruby}}
bundler-cache: true

- name: Run tests
timeout-minutes: 10
run: bundle exec bake test:external
21 changes: 13 additions & 8 deletions .github/workflows/development.yml → .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
name: Development
name: Test

on: [push, pull_request]

permissions:
contents: read

env:
CONSOLE_OUTPUT: XTerm

jobs:
test:
name: ${{matrix.ruby}} on ${{matrix.os}}
Expand All @@ -15,12 +21,11 @@ jobs:
- macos

ruby:
- "2.6"
- "2.7"
- "3.0"
- "3.1"
- "3.2"
- "3.3"

experimental: [false]
env: [""]

include:
- os: ubuntu
Expand All @@ -34,12 +39,12 @@ jobs:
experimental: true

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{matrix.ruby}}
bundler-cache: true

- name: Run tests
timeout-minutes: 5
run: ${{matrix.env}} bundle exec rspec
timeout-minutes: 10
run: bundle exec bake test
13 changes: 3 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
/.bundle/
/.yardoc
/gems.locked
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/
/gems.locked
/.covered.db
/external

/spec/**/log/

# rspec failure tracking
.rspec_status
2 changes: 2 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Hal Brodigan <postmodern.mod3@gmail.com>
Hendrik Beskow <hendrik@beskow.de> <Asmod4n@users.noreply.github.com>
3 changes: 0 additions & 3 deletions .rspec

This file was deleted.

19 changes: 9 additions & 10 deletions async-dns.gemspec
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true

require_relative "lib/async/dns/version"

Expand All @@ -6,23 +7,21 @@ Gem::Specification.new do |spec|
spec.version = Async::DNS::VERSION

spec.summary = "An easy to use DNS client resolver and server for Ruby."
spec.authors = ["Samuel Williams"]
spec.authors = ["Samuel Williams", "Tony Arcieri", "Olle Jonsson", "Greg Thornton", "Hal Brodigan", "Hendrik Beskow", "Mike Perham", "Sean Dilda", "Stefan Wrobel"]
spec.license = "MIT"

spec.cert_chain = ['release.cert']
spec.signing_key = File.expand_path('~/.gem/release.pem')

spec.homepage = "https://github.com/socketry/async-dns"

spec.files = Dir.glob('{lib}/**/*', File::FNM_DOTMATCH, base: __dir__)
spec.metadata = {
"source_code_uri" => "https://github.com/socketry/async-dns.git",
}

spec.add_dependency "async-io", "~> 1.15"
spec.files = Dir.glob(['{lib}/**/*', '*.md'], File::FNM_DOTMATCH, base: __dir__)

spec.required_ruby_version = ">= 3.1"

spec.add_development_dependency "async-rspec", "~> 1.0"
spec.add_development_dependency "bundler"
spec.add_development_dependency "covered"
spec.add_development_dependency "process-daemon", "~> 1.0"
spec.add_development_dependency "rspec", "~> 3.0"
spec.add_development_dependency "rspec-files", "~> 1.0"
spec.add_development_dependency "rspec-memory", "~> 1.0"
spec.add_dependency "async-io", "~> 1.15"
end
Original file line number Diff line number Diff line change
@@ -1,28 +1,14 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# Released under the MIT License.
# Copyright, 2015-2024, by Samuel Williams.

require 'async/dns'

RSpec.describe Async::DNS::Resolver , timeout: 30 do
require 'benchmark'

describe Async::DNS::Resolver , timeout: 30 do
context 'benchmark' do
domains = %W{
Facebook.com
Expand Down Expand Up @@ -75,12 +61,8 @@
Mail.ru
Jimdo.com
}

before do
require 'benchmark'
end

include_context Async::RSpec::Reactor
include Sus::Fixtures::Async::ReactorContext

it 'should be faster than native resolver' do
Benchmark.bm(30) do |x|
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2015-2024, by Samuel Williams.

File.open("local.zone", "w") do |f|
f.write(DATA.read)
Expand Down
File renamed without changes.
Loading

0 comments on commit 3bb6685

Please sign in to comment.