diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 9934474bc..316fbc61b 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -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 diff --git a/.github/workflows/codegen_ci.yml b/.github/workflows/codegen_ci.yml index b0b1b23f9..1a731a26f 100644 --- a/.github/workflows/codegen_ci.yml +++ b/.github/workflows/codegen_ci.yml @@ -14,8 +14,7 @@ env: ruby_version: 3.3 jobs: - - ruby-rbs-type-check: + whitelabel-rbs: runs-on: ubuntu-latest steps: @@ -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 @@ -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 diff --git a/.github/workflows/downstream_ci.yml b/.github/workflows/downstream_ci.yml index 6ef395428..1795e26a9 100644 --- a/.github/workflows/downstream_ci.yml +++ b/.github/workflows/downstream_ci.yml @@ -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: @@ -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 diff --git a/.github/workflows/hearth_ci.yml b/.github/workflows/hearth_ci.yml index 7acfb460f..9e2d3bf56 100644 --- a/.github/workflows/hearth_ci.yml +++ b/.github/workflows/hearth_ci.yml @@ -13,12 +13,8 @@ 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 @@ -26,14 +22,21 @@ jobs: - 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 @@ -41,16 +44,13 @@ jobs: - 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: diff --git a/.github/workflows/rails_codegen_ci.yml b/.github/workflows/rails_codegen_ci.yml index 26ab47b86..0d76afbf4 100644 --- a/.github/workflows/rails_codegen_ci.yml +++ b/.github/workflows/rails_codegen_ci.yml @@ -14,7 +14,7 @@ env: ruby_version: 3.3 jobs: - ruby-rbs-type-check: + railsjson-rbs: runs-on: ubuntu-latest steps: @@ -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 @@ -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 @@ -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 diff --git a/Gemfile b/Gemfile index 46d782772..486f6027e 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,6 @@ source 'https://rubygems.org' gem 'hearth', path: './hearth' gem 'jmespath' -gem 'rake', require: false gem 'rexml' group :benchmark do @@ -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 @@ -29,6 +26,7 @@ end group :rbs do gem 'rbs', platforms: :ruby + gem 'steep', platforms: :ruby end group :test do diff --git a/codegen/projections/rails_json/rails_json.gemspec b/codegen/projections/rails_json/rails_json.gemspec index 114247b0a..a95b3e7fe 100644 --- a/codegen/projections/rails_json/rails_json.gemspec +++ b/codegen/projections/rails_json/rails_json.gemspec @@ -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 diff --git a/codegen/projections/rpcv2_cbor/rpcv2_cbor.gemspec b/codegen/projections/rpcv2_cbor/rpcv2_cbor.gemspec index fafa1cf23..e7f5aaf1a 100644 --- a/codegen/projections/rpcv2_cbor/rpcv2_cbor.gemspec +++ b/codegen/projections/rpcv2_cbor/rpcv2_cbor.gemspec @@ -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 diff --git a/codegen/projections/white_label/white_label.gemspec b/codegen/projections/white_label/white_label.gemspec index f054c3877..185cb5d80 100644 --- a/codegen/projections/white_label/white_label.gemspec +++ b/codegen/projections/white_label/white_label.gemspec @@ -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 diff --git a/codegen/smithy-ruby-codegen-test/base-smithy-build.json b/codegen/smithy-ruby-codegen-test/base-smithy-build.json index fd3bb7b39..100d7cc80 100644 --- a/codegen/smithy-ruby-codegen-test/base-smithy-build.json +++ b/codegen/smithy-ruby-codegen-test/base-smithy-build.json @@ -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" } } } @@ -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" } } } diff --git a/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/RubySettings.java b/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/RubySettings.java index aa385c6d3..939edd449 100644 --- a/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/RubySettings.java +++ b/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/RubySettings.java @@ -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. @@ -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); @@ -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 getBaseDependencies() { - //TODO: Read from config (eg allow override of hearth version?) return (Set.of(RubyDependency.HEARTH)); } diff --git a/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/generators/GemspecGenerator.java b/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/generators/GemspecGenerator.java index fd1e745f0..1dbd0179a 100644 --- a/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/generators/GemspecGenerator.java +++ b/codegen/smithy-ruby-codegen/src/main/java/software/amazon/smithy/ruby/codegen/generators/GemspecGenerator.java @@ -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 indirectDependencies = new HashSet<>(); diff --git a/codegen/smithy-ruby-rails-codegen-test/smithy-build.json b/codegen/smithy-ruby-rails-codegen-test/smithy-build.json index 577505b2f..c01260028 100644 --- a/codegen/smithy-ruby-rails-codegen-test/smithy-build.json +++ b/codegen/smithy-ruby-rails-codegen-test/smithy-build.json @@ -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" } } } diff --git a/hearth/hearth.gemspec b/hearth/hearth.gemspec index c45cfb56a..45d4c972b 100755 --- a/hearth/hearth.gemspec +++ b/hearth/hearth.gemspec @@ -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 diff --git a/hearth/lib/hearth/http/fields.rb b/hearth/lib/hearth/http/fields.rb index e63a35e44..ebf7baafc 100644 --- a/hearth/lib/hearth/http/fields.rb +++ b/hearth/lib/hearth/http/fields.rb @@ -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 @@ -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 diff --git a/hearth/sig/lib/hearth/http/request.rbs b/hearth/sig/lib/hearth/http/request.rbs index ed54d0ff3..39db4c15c 100644 --- a/hearth/sig/lib/hearth/http/request.rbs +++ b/hearth/sig/lib/hearth/http/request.rbs @@ -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