Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Sep 9, 2023
1 parent d876e3d commit cda10ac
Show file tree
Hide file tree
Showing 42 changed files with 404 additions and 94 deletions.
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
15 changes: 9 additions & 6 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ jobs:
- macos

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

gemfile:
- gems.rb
- gems/async-v1.rb
- gems/async-head.rb

experimental: [false]

include:
Expand All @@ -39,17 +43,16 @@ jobs:
ruby: head
experimental: true

steps:
env:
BUNDLE_GEMFILE: ${{matrix.gemfile}}

steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
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
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
5 changes: 5 additions & 0 deletions examples/google/gems.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# frozen_string_literal: true

source "https://rubygems.org"

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

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.

8 changes: 8 additions & 0 deletions gems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,11 @@
# gem "protocol-hpack", path: "../protocol-hpack"

gem "thread-local"

# Moved Development Dependencies
gem "async-container", "~> 0.14"
gem "async-rspec", "~> 1.10"
gem "covered"
gem "localhost"
gem "rack-test"
gem "rspec", "~> 3.6"
1 change: 1 addition & 0 deletions lib/async/http/body/delayed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Released under the MIT License.
# Copyright, 2018-2023, by Samuel Williams.
# Copyright, 2020, by Bruno Sutic.
# Copyright, 2023, by Thomas Morgan.

require 'protocol/http/body/wrapper'

Expand Down
1 change: 1 addition & 0 deletions license.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Copyright, 2021-2022, by Adam Daniels.
Copyright, 2022, by Ian Ker-Seymer.
Copyright, 2022, by Marco Concetto Rudilosso.
Copyright, 2022, by Tim Meusel.
Copyright, 2023, by Thomas Morgan.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 8 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,14 @@ We welcome contributions to this project.
4. Push to the branch (`git push origin my-new-feature`).
5. Create new Pull Request.

### Developer Certificate of Origin

This project uses the [Developer Certificate of Origin](https://developercertificate.org/). All contributors to this project must agree to this document to have their contributions accepted.

### Contributor Covenant

This project is governed by [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.

## See Also

- [benchmark-http](https://github.com/socketry/benchmark-http) — A benchmarking tool to report on web server concurrency.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit cda10ac

Please sign in to comment.