Skip to content

Commit

Permalink
Touch up CI; add jruby to CI; fix jruby issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mullermp committed Jul 27, 2024
1 parent 78d268c commit eb90120
Show file tree
Hide file tree
Showing 16 changed files with 82 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Build SDK
run: bundle exec rake codegen:build

- name: Benchmark Gems
- name: Benchmark gems
run: bundle exec rake benchmark:run

- name: Configure AWS credentials
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/codegen_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ env:
ruby_version: 3.3

jobs:

ruby-rbs-type-check:
whitelabel-rbs:
runs-on: ubuntu-latest

steps:
Expand All @@ -29,7 +28,7 @@ jobs:
with:
ruby-version: ${{ env.ruby_version }}

- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install gems
run: bundle install
Expand All @@ -43,12 +42,12 @@ jobs:
- name: rbs:test
run: bundle exec rake rbs:white_label

ruby-specs:
codegen-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: ['3.0', 3.1, 3.2, 3.3]
ruby: [jruby-9.4, '3.0', 3.1, 3.2, 3.3]

steps:
- uses: actions/checkout@v4
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/downstream_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@ env:
ruby_version: 3.3

jobs:

aws-sdk-v4-tests:
aws-sdk-ruby-v4-tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v1
with:
Expand All @@ -32,7 +29,9 @@ jobs:
ruby-version: ${{ env.ruby_version }}
bundler-cache: true

- name: publish smithy-ruby to maven local
- uses: actions/checkout@v4

- name: Publish smithy-ruby to mavenLocal
run: bundle exec rake codegen:publish-local

- name: v4 setup and build
Expand Down
32 changes: 16 additions & 16 deletions .github/workflows/hearth_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,44 +13,44 @@ env:
ruby_version: 3.3

jobs:
rspec:
hearth-rbs:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: ['3.0', 3.1, 3.2, 3.3]

steps:
- uses: actions/checkout@v4

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
ruby-version: ${{ env.ruby_version }}
bundler-cache: true

- name: Unit tests
run: rake test:hearth
- name: Steep
run: rake steep:hearth

- name: RBS
run: rake rbs:hearth

type-check:
hearth-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: [jruby-9.4, '3.0', 3.1, 3.2, 3.3]

steps:
- uses: actions/checkout@v4

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.ruby_version }}
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Steep Check
run: rake steep:hearth

- name: RBS Validate
run: rake rbs:hearth
- name: Test
run: rake test:hearth

rubocop:
hearth-rubocop:
runs-on: ubuntu-latest

steps:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/rails_codegen_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:
ruby_version: 3.3

jobs:
ruby-rbs-type-check:
railsjson-rbs:
runs-on: ubuntu-latest

steps:
Expand All @@ -28,7 +28,7 @@ jobs:
with:
ruby-version: ${{ env.ruby_version }}

- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install gems
run: bundle install
Expand All @@ -42,12 +42,12 @@ jobs:
- name: RBS Checks
run: bundle exec rake rbs:rails_json

ruby-specs:
railsjson-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: ['3.0', 3.1, 3.2, 3.3]
ruby: [jruby-9.4, '3.0', 3.1, 3.2, 3.3]

steps:
- name: Setup Ruby
Expand All @@ -60,7 +60,7 @@ jobs:
with:
java-version: ${{ env.java_version }}

- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Install gems
run: bundle install
Expand Down
6 changes: 2 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ source 'https://rubygems.org'

gem 'hearth', path: './hearth'
gem 'jmespath'
gem 'rake', require: false
gem 'rexml'

group :benchmark do
Expand All @@ -16,11 +15,9 @@ group :benchmark do
end

group :development do
gem 'byebug'
gem 'rbs'
gem 'byebug', platforms: :ruby
gem 'rubocop'
gem 'rubocop-rake'
gem 'steep'
end

group :docs do
Expand All @@ -29,6 +26,7 @@ end

group :rbs do
gem 'rbs', platforms: :ruby
gem 'steep', platforms: :ruby
end

group :test do
Expand Down
3 changes: 3 additions & 0 deletions codegen/projections/rails_json/rails_json.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ Gem::Specification.new do |spec|
spec.version = File.read(File.expand_path('VERSION', __dir__)).strip
spec.author = 'Amazon Web Services'
spec.summary = 'RailsJson Protocol Test Service'
spec.homepage = 'https://github.com/smithy-lang/smithy-ruby'
spec.files = Dir['lib/**/*.rb', 'VERSION']
spec.license = 'Apache-2.0'

spec.required_ruby_version = '>= 3.0'
spec.add_runtime_dependency 'hearth', '~> 1.0.0.pre3'
end
3 changes: 3 additions & 0 deletions codegen/projections/rpcv2_cbor/rpcv2_cbor.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ Gem::Specification.new do |spec|
spec.version = File.read(File.expand_path('VERSION', __dir__)).strip
spec.author = 'Amazon Web Services'
spec.summary = 'Rpcv2Cbor Protocol Test Service'
spec.homepage = 'https://github.com/smithy-lang/smithy-ruby'
spec.files = Dir['lib/**/*.rb', 'VERSION']
spec.license = 'Apache-2.0'

spec.required_ruby_version = '>= 3.0'
spec.add_runtime_dependency 'hearth', '~> 1.0.0.pre3'
end
3 changes: 3 additions & 0 deletions codegen/projections/white_label/white_label.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ Gem::Specification.new do |spec|
spec.version = File.read(File.expand_path('VERSION', __dir__)).strip
spec.author = 'Amazon Web Services'
spec.summary = 'White Label Test Service'
spec.homepage = 'https://github.com/smithy-lang/smithy-ruby'
spec.files = Dir['lib/**/*.rb', 'VERSION']
spec.license = 'Apache-2.0'

spec.required_ruby_version = '>= 3.0'
spec.add_runtime_dependency 'hearth', '~> 1.0.0.pre3'
end
6 changes: 4 additions & 2 deletions codegen/smithy-ruby-codegen-test/base-smithy-build.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"gemspec": {
"gemName": "white_label",
"gemVersion": "0.0.1",
"gemSummary": "White Label Test Service"
"gemSummary": "White Label Test Service",
"gemHomepage": "https://github.com/smithy-lang/smithy-ruby"
}
}
}
Expand All @@ -36,7 +37,8 @@
"gemspec": {
"gemName": "rpcv2_cbor",
"gemVersion": "0.0.1",
"gemSummary": "Rpcv2Cbor Protocol Test Service"
"gemSummary": "Rpcv2Cbor Protocol Test Service",
"gemHomepage": "https://github.com/smithy-lang/smithy-ruby"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ public final class RubySettings {
private static final String GEM_NAME = "gemName";
private static final String GEM_VERSION = "gemVersion";
private static final String GEM_SUMMARY = "gemSummary";
private static final String GEM_HOMEPAGE = "gemHomepage";

private ShapeId service;
private String module;
private String gemName;
private String gemVersion;
private String gemSummary;
private String gemHomepage;

/**
* Create a settings object from a configuration object node.
Expand All @@ -67,6 +69,10 @@ public static RubySettings from(ObjectNode config) {
settings.setGemName(gemspec.expectStringMember(GEM_NAME).getValue());
settings.setGemVersion(gemspec.expectStringMember(GEM_VERSION).getValue());
settings.setGemSummary(gemspec.expectStringMember(GEM_SUMMARY).getValue());
// optional gemspec values
if (gemspec.getMember(GEM_HOMEPAGE).isPresent()) {
settings.setGemHomepage(gemspec.getStringMember(GEM_HOMEPAGE).get().getValue());
}

LOGGER.info("Created Ruby Settings: " + settings);

Expand Down Expand Up @@ -143,11 +149,24 @@ public void setGemSummary(String gemSummary) {
this.gemSummary = gemSummary;
}

/**
* @return homepage of the gem.
*/
public String getGemHomepage() {
return gemHomepage;
}

/**
* @param gemHomepage homepage of the gem.
*/
public void setGemHomepage(String gemHomepage) {
this.gemHomepage = gemHomepage;
}

/**
* @return default/base dependencies to include.
*/
public Set<RubyDependency> getBaseDependencies() {
//TODO: Read from config (eg allow override of hearth version?)
return (Set.of(RubyDependency.HEARTH));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,15 @@ public void render() {
.write("spec.version = File.read(File.expand_path('VERSION', __dir__)).strip")
.write("spec.author = 'Amazon Web Services'")
.write("spec.summary = '$L'", settings.getGemSummary())
.call(() -> {
if (settings.getGemHomepage() != null) {
writer.write("spec.homepage = '$L'", settings.getGemHomepage());
}
})
.write("spec.files = Dir['lib/**/*.rb', 'VERSION']")
.write("spec.license = 'Apache-2.0'")
.write("")
.write("spec.required_ruby_version = '>= 3.0'")
.call(() -> {
// determine set of indirect dependencies - covered by requiring another
Set<RubyDependency> indirectDependencies = new HashSet<>();
Expand Down
3 changes: 2 additions & 1 deletion codegen/smithy-ruby-rails-codegen-test/smithy-build.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"gemspec": {
"gemName": "rails_json",
"gemVersion": "0.0.1",
"gemSummary": "RailsJson Protocol Test Service"
"gemSummary": "RailsJson Protocol Test Service",
"gemHomepage": "https://github.com/smithy-lang/smithy-ruby"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions hearth/hearth.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Gem::Specification.new do |spec|

spec.required_ruby_version = '>= 3.0'

spec.add_dependency 'jmespath'
spec.add_dependency 'rexml'
spec.add_dependency 'jmespath', '~> 1.6'
spec.add_dependency 'rexml', '~> 3'

spec.license = 'Apache-2.0'
end
8 changes: 4 additions & 4 deletions hearth/lib/hearth/http/fields.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ def clear
@entries = {}
end

# @api private
def inspect
super.gsub(/ @entries={.*},/, '')
super
.gsub(/ @entries={.*},/, '')
.gsub(/, @entries={.*}/, '')
end

# Proxy class that wraps Fields to create Headers and Trailers
Expand Down Expand Up @@ -107,9 +108,8 @@ def each(&block)
end
alias each_pair each

# @api private
def inspect
to_h
to_h.to_s
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions hearth/sig/lib/hearth/http/request.rbs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module Hearth
module HTTP
class Request < Hearth::Request
def initialize: (?http_method: Symbol?, ?fields: Fields, ?uri: URI, ?body: IO) -> void
def initialize: (?http_method: String?, ?fields: Fields, ?uri: URI, ?body: IO) -> void

attr_accessor http_method: Symbol
attr_accessor http_method: String?

attr_reader fields: Fields

Expand Down

0 comments on commit eb90120

Please sign in to comment.