Skip to content

Commit 1eafcd2

Browse files
authored
Modernize gem (#9)
* Refactor tests.
1 parent 89cba7e commit 1eafcd2

28 files changed

+447
-353
lines changed

.editorconfig

+4
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@ root = true
33
[*]
44
indent_style = tab
55
indent_size = 2
6+
7+
[*.{yml,yaml}]
8+
indent_style = space
9+
indent_size = 2

.github/workflows/coverage.yaml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Coverage
2+
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: read
7+
8+
env:
9+
CONSOLE_OUTPUT: XTerm
10+
COVERAGE: PartialSummary
11+
12+
jobs:
13+
test:
14+
name: ${{matrix.ruby}} on ${{matrix.os}}
15+
runs-on: ${{matrix.os}}-latest
16+
17+
strategy:
18+
matrix:
19+
os:
20+
- ubuntu
21+
- macos
22+
23+
ruby:
24+
- "3.3"
25+
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: ruby/setup-ruby@v1
29+
with:
30+
ruby-version: ${{matrix.ruby}}
31+
bundler-cache: true
32+
33+
- name: Run tests
34+
timeout-minutes: 5
35+
run: bundle exec bake test
36+
37+
- uses: actions/upload-artifact@v3
38+
with:
39+
name: coverage-${{matrix.os}}-${{matrix.ruby}}
40+
path: .covered.db
41+
42+
validate:
43+
needs: test
44+
runs-on: ubuntu-latest
45+
46+
steps:
47+
- uses: actions/checkout@v4
48+
- uses: ruby/setup-ruby@v1
49+
with:
50+
ruby-version: "3.3"
51+
bundler-cache: true
52+
53+
- uses: actions/download-artifact@v3
54+
55+
- name: Validate coverage
56+
timeout-minutes: 5
57+
run: bundle exec bake covered:validate --paths */.covered.db \;

.github/workflows/documentation.yaml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages:
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
# Allow one concurrent deployment:
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: true
18+
19+
env:
20+
CONSOLE_OUTPUT: XTerm
21+
BUNDLE_WITH: maintenance
22+
23+
jobs:
24+
generate:
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- uses: ruby/setup-ruby@v1
31+
with:
32+
ruby-version: "3.3"
33+
bundler-cache: true
34+
35+
- name: Installing packages
36+
run: sudo apt-get install wget
37+
38+
- name: Generate documentation
39+
timeout-minutes: 5
40+
run: bundle exec bake utopia:project:static --force no
41+
42+
- name: Upload documentation artifact
43+
uses: actions/upload-pages-artifact@v3
44+
with:
45+
path: docs
46+
47+
deploy:
48+
runs-on: ubuntu-latest
49+
50+
environment:
51+
name: github-pages
52+
url: ${{steps.deployment.outputs.page_url}}
53+
54+
needs: generate
55+
steps:
56+
- name: Deploy to GitHub Pages
57+
id: deployment
58+
uses: actions/deploy-pages@v4

.github/workflows/documentation.yml

-32
This file was deleted.

.github/workflows/test-external.yaml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Test External
2+
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: read
7+
8+
env:
9+
CONSOLE_OUTPUT: XTerm
10+
11+
jobs:
12+
test:
13+
name: ${{matrix.ruby}} on ${{matrix.os}}
14+
runs-on: ${{matrix.os}}-latest
15+
16+
strategy:
17+
matrix:
18+
os:
19+
- ubuntu
20+
- macos
21+
22+
ruby:
23+
- "3.1"
24+
- "3.2"
25+
- "3.3"
26+
27+
steps:
28+
- uses: actions/checkout@v4
29+
- uses: ruby/setup-ruby@v1
30+
with:
31+
ruby-version: ${{matrix.ruby}}
32+
bundler-cache: true
33+
34+
- name: Run tests
35+
timeout-minutes: 10
36+
run: bundle exec bake test:external

.github/workflows/development.yml renamed to .github/workflows/test.yaml

+13-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1-
name: Development
1+
name: Test
22

33
on: [push, pull_request]
44

5+
permissions:
6+
contents: read
7+
8+
env:
9+
CONSOLE_OUTPUT: XTerm
10+
511
jobs:
612
test:
713
name: ${{matrix.ruby}} on ${{matrix.os}}
@@ -15,12 +21,11 @@ jobs:
1521
- macos
1622

1723
ruby:
18-
- "2.6"
19-
- "2.7"
20-
- "3.0"
24+
- "3.1"
25+
- "3.2"
26+
- "3.3"
2127

2228
experimental: [false]
23-
env: [""]
2429

2530
include:
2631
- os: ubuntu
@@ -34,12 +39,12 @@ jobs:
3439
experimental: true
3540

3641
steps:
37-
- uses: actions/checkout@v2
42+
- uses: actions/checkout@v4
3843
- uses: ruby/setup-ruby@v1
3944
with:
4045
ruby-version: ${{matrix.ruby}}
4146
bundler-cache: true
4247

4348
- name: Run tests
44-
timeout-minutes: 5
45-
run: ${{matrix.env}} bundle exec rspec
49+
timeout-minutes: 10
50+
run: bundle exec bake test

.gitignore

+3-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
/.bundle/
2-
/.yardoc
3-
/gems.locked
4-
/_yardoc/
5-
/coverage/
6-
/doc/
72
/pkg/
8-
/spec/reports/
9-
/tmp/
10-
11-
# rspec failure tracking
12-
.rspec_status
3+
/gems.locked
4+
/.covered.db
5+
/external

.rspec

-3
This file was deleted.

README.md

-81
This file was deleted.

async-await.gemspec

+11-7
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,21 @@ Gem::Specification.new do |spec|
77
spec.version = Async::Await::VERSION
88

99
spec.summary = "Implements the async/await pattern on top of async :)"
10-
spec.authors = ["Samuel Williams"]
10+
spec.authors = ["Samuel Williams", "Kent 'picat' Gruber", "Olle Jonsson"]
1111
spec.license = "MIT"
1212

13+
spec.cert_chain = ['release.cert']
14+
spec.signing_key = File.expand_path('~/.gem/release.pem')
15+
1316
spec.homepage = "https://github.com/socketry/async-await"
1417

15-
spec.files = Dir.glob('{lib}/**/*', File::FNM_DOTMATCH, base: __dir__)
18+
spec.metadata = {
19+
"source_code_uri" => "https://github.com/socketry/async-await.git",
20+
}
1621

17-
spec.add_dependency "async"
18-
spec.add_dependency "ruby2_keywords"
22+
spec.files = Dir.glob(['{lib}/**/*', '*.md'], File::FNM_DOTMATCH, base: __dir__)
1923

20-
spec.add_development_dependency "async-rspec", "~> 1.1"
21-
spec.add_development_dependency "covered"
22-
spec.add_development_dependency "rspec", "~> 3.0"
24+
spec.required_ruby_version = ">= 3.1"
25+
26+
spec.add_dependency "async"
2327
end

config/sus.rb

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# frozen_string_literal: true
2+
3+
# Released under the MIT License.
4+
# Copyright, 2024, by Samuel Williams.
5+
6+
require 'covered/sus'
7+
include Covered::Sus

examples/chickens.rb

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# frozen_string_literal: true
2+
3+
# Released under the MIT License.
4+
# Copyright, 2018-2024, by Samuel Williams.
15

26
require_relative '../lib/async/await'
37

examples/echo.rb

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# frozen_string_literal: true
2+
3+
# Released under the MIT License.
4+
# Copyright, 2018-2024, by Samuel Williams.
15

26
require_relative '../lib/async/await'
37

0 commit comments

Comments
 (0)