Skip to content

Commit cd65c10

Browse files
authored
Add RBS signature and testing (#25)
* Add RBS signature and testing * Automated annotation
1 parent e30df92 commit cd65c10

File tree

7 files changed

+449
-2
lines changed

7 files changed

+449
-2
lines changed

.github/workflows/sig.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: sig
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
sig:
7+
runs-on: "ubuntu-latest"
8+
steps:
9+
- uses: actions/checkout@v4
10+
- name: Set up Ruby
11+
uses: ruby/setup-ruby@v1
12+
with:
13+
bundler-cache: true
14+
ruby-version: ruby
15+
- name: Install dependencies
16+
run: |
17+
bundle config set with 'sig'
18+
bundle install
19+
- name: Run RBS test, annotate and confirm
20+
run: bundle exec rake rbs:{test,annotate,confirm}

.github/workflows/test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ jobs:
2727
with:
2828
ruby-version: ${{ matrix.ruby }}
2929
- name: Install dependencies
30-
run: bundle install
30+
run: |
31+
bundle config set without 'sig'
32+
bundle install
3133
- name: Run test
3234
run: rake test

Gemfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,8 @@ source "https://rubygems.org"
22

33
gem "rake"
44
gem "test-unit"
5+
6+
group :sig do
7+
gem "rbs"
8+
gem "rdoc", "<= 6.11"
9+
end

Rakefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,25 @@ Rake::TestTask.new(:test) do |t|
77
t.test_files = FileList["test/**/test_*.rb"]
88
end
99

10+
namespace :rbs do
11+
task :test do
12+
sh "ruby -I lib test_sig/test_base64.rb"
13+
end
14+
15+
task :annotate do
16+
require "tmpdir"
17+
require "pathname"
18+
19+
Dir.mktmpdir do |tmpdir|
20+
system("rdoc --ri --output #{tmpdir}/doc --root=. lib")
21+
system("rbs annotate --no-system --no-gems --no-site --no-home -d #{tmpdir}/doc sig")
22+
end
23+
end
24+
25+
task :confirm do
26+
puts "Testing if RBS docs are updated with respect to RDoc"
27+
sh "git diff --exit-code sig/"
28+
end
29+
end
30+
1031
task :default => :test

base64.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
2121
spec.metadata["source_code_uri"] = spec.homepage
2222
spec.metadata["changelog_uri"] = spec.homepage + "/releases"
2323

24-
spec.files = ["README.md", "BSDL", "COPYING", "LEGAL", "lib/base64.rb"]
24+
spec.files = ["README.md", "BSDL", "COPYING", "LEGAL", "lib/base64.rb", "sig/base64.rbs"]
2525
spec.bindir = "exe"
2626
spec.executables = []
2727
spec.require_paths = ["lib"]

0 commit comments

Comments
 (0)