Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modernize gem #135

Merged
merged 3 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: 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.2"

steps:
- uses: actions/checkout@v3
- 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@v2
with:
name: coverage-${{matrix.os}}-${{matrix.ruby}}
path: .covered.db

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

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

- uses: actions/download-artifact@v3

- name: Validate coverage
timeout-minutes: 5
run: bundle exec bake covered:validate --paths */.covered.db \;
33 changes: 0 additions & 33 deletions .github/workflows/test-async-head.yaml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/test-async-v1.yaml

This file was deleted.

1 change: 0 additions & 1 deletion .github/workflows/test-external.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
- macos

ruby:
- "2.7"
- "3.0"
- "3.1"
- "3.2"
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ jobs:
- macos

ruby:
- "2.7"
- "3.0"
- "3.1"
- "3.2"
Expand All @@ -46,10 +45,6 @@ jobs:
ruby-version: ${{matrix.ruby}}
bundler-cache: true

- name: Installing packages (ubuntu)
if: matrix.os == 'ubuntu'
run: sudo apt-get install apache2-utils

- name: Run tests
timeout-minutes: 10
run: bundle exec bake test
16 changes: 3 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
.tags

/.bundle/
/.yardoc
/gems.locked
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/

.rspec_status
.covered.db
/h2spec
/gems.locked
/.covered.db
/external
202 changes: 202 additions & 0 deletions .rspec_status

Large diffs are not rendered by default.

11 changes: 3 additions & 8 deletions async-http.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
spec.version = Async::HTTP::VERSION

spec.summary = "A HTTP client and server library."
spec.authors = ["Samuel Williams", "Brian Morearty", "Bruno Sutic", "Janko Marohnić", "Adam Daniels", "Cyril Roelandt", "Denis Talakevich", "Ian Ker-Seymer", "Igor Sidorov", "Marco Concetto Rudilosso", "Olle Jonsson", "Orgad Shaneh", "Sam Shadwell", "Stefan Wrobel", "Tim Meusel", "Trevor Turk", "Viacheslav Koval"]
spec.authors = ["Samuel Williams", "Brian Morearty", "Bruno Sutic", "Janko Marohnić", "Adam Daniels", "Thomas Morgan", "Cyril Roelandt", "Denis Talakevich", "Ian Ker-Seymer", "Igor Sidorov", "Marco Concetto Rudilosso", "Olle Jonsson", "Orgad Shaneh", "Sam Shadwell", "Stefan Wrobel", "Tim Meusel", "Trevor Turk", "Viacheslav Koval"]
spec.license = "MIT"

spec.cert_chain = ['release.cert']
Expand All @@ -17,18 +17,13 @@ Gem::Specification.new do |spec|

spec.files = Dir.glob(['{bake,lib}/**/*', '*.md'], File::FNM_DOTMATCH, base: __dir__)

spec.required_ruby_version = ">= 3.0"

spec.add_dependency "async", ">= 1.25"
spec.add_dependency "async-io", ">= 1.28"
spec.add_dependency "async-pool", ">= 0.2"
spec.add_dependency "protocol-http", "~> 0.24.0"
spec.add_dependency "protocol-http1", "~> 0.15.0"
spec.add_dependency "protocol-http2", "~> 0.15.0"
spec.add_dependency "traces", ">= 0.10.0"

spec.add_development_dependency "async-container", "~> 0.14"
spec.add_development_dependency "async-rspec", "~> 1.10"
spec.add_development_dependency "covered"
spec.add_development_dependency "localhost"
spec.add_development_dependency "rack-test"
spec.add_development_dependency "rspec", "~> 3.6"
end
2 changes: 1 addition & 1 deletion config/external.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
falcon:
url: https://github.com/socketry/falcon.git
command: bundle exec rspec
command: bundle exec bake test
async-rest:
url: https://github.com/socketry/async-rest.git
command: bundle exec rspec
Expand Down
13 changes: 13 additions & 0 deletions config/sus.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2017-2023, by Samuel Williams.
# Copyright, 2018, by Janko Marohnić.

ENV['CONSOLE_LEVEL'] ||= 'fatal'

require 'covered/sus'
include Covered::Sus

require 'traces'
ENV['TRACES_BACKEND'] ||= 'traces/backend/test'
16 changes: 16 additions & 0 deletions examples/google/about.html

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions examples/google/gems.locked
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
GEM
remote: https://rubygems.org/
specs:
async (2.3.1)
console (~> 1.10)
io-event (~> 1.1)
timers (~> 4.1)
async-http (0.60.1)
async (>= 1.25)
async-io (>= 1.28)
async-pool (>= 0.2)
protocol-http (~> 0.24.0)
protocol-http1 (~> 0.15.0)
protocol-http2 (~> 0.15.0)
traces (>= 0.8.0)
async-io (1.34.3)
async
async-pool (0.3.12)
async (>= 1.25)
console (1.16.2)
fiber-local
fiber-local (1.0.0)
io-event (1.1.6)
protocol-hpack (1.4.2)
protocol-http (0.24.1)
protocol-http1 (0.15.0)
protocol-http (~> 0.22)
protocol-http2 (0.15.1)
protocol-hpack (~> 1.4)
protocol-http (~> 0.18)
timers (4.3.5)
traces (0.8.0)

PLATFORMS
x86_64-linux

DEPENDENCIES
async-http (~> 0.60.0)

BUNDLED WITH
2.4.6
8 changes: 8 additions & 0 deletions examples/google/gems.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2023, by Samuel Williams.

source "https://rubygems.org"

gem "async-http", "~> 0.60.0"
31 changes: 31 additions & 0 deletions examples/google/multiple.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env ruby
# frozen_string_literal: true

# Released under the MIT License.
# Copyright, 2023, by Samuel Williams.

require 'async'
require 'async/barrier'
require 'async/semaphore'
require 'async/http/internet'

TOPICS = ["ruby", "python", "rust"]

Async do
internet = Async::HTTP::Internet.new
barrier = Async::Barrier.new
semaphore = Async::Semaphore.new(2, parent: barrier)

# Spawn an asynchronous task for each topic:
TOPICS.each do |topic|
semaphore.async do
response = internet.get "https://www.google.com/search?q=#{topic}"
puts "Found #{topic}: #{response.read.scan(topic).size} times."
end
end

# Ensure we wait for all requests to complete before continuing:
barrier.wait
ensure
internet&.close
end
22 changes: 22 additions & 0 deletions examples/google/ruby.html

Large diffs are not rendered by default.

Loading