diff --git a/.toys/kokoro-ci.rb b/.toys/kokoro-ci.rb index 7659846b6..e3bdfd031 100644 --- a/.toys/kokoro-ci.rb +++ b/.toys/kokoro-ci.rb @@ -148,17 +148,27 @@ def list_products # Filter out products whose tests will not run on the current Ruby version # def filter_by_ruby_versions + rails_cloudsql = [ + "appengine/rails-cloudsql-postgres", + "appengine/rails-cloudsql-mysql" + ] + unless newest_ruby? # Spanner tests are too slow. Run only on newest. @products.delete "spanner" # run/rails uses Rails 7 and requires newest Ruby. @products.delete "run/rails" + # Rails 7 cloud-sql samples require Ruby 3.2+, so run only on newest. + @products -= rails_cloudsql end if newest_ruby? # getting-started uses an old Rails and is incompatible with newest. @products.delete_if { |dir| dir.start_with? "getting-started/" } - # appengine tests are slow and some use an old Rails. Run only on oldest. - @products.delete_if { |dir| dir.start_with? "appengine/" } + # appengine tests are slow and some use an old Rails. Run only on oldest, + # except for rails-cloudsql which require newest Ruby because they use Rails 7. + @products.delete_if do |dir| + dir.start_with?("appengine/") && !rails_cloudsql.include?(dir) + end end end @@ -257,7 +267,7 @@ def install_gcloud_cli return if defined? @gcloud_cli_installed exec ["gcloud", "config", "set", "disable_prompts", "True"] exec ["gcloud", "config", "set", "project", assert_env("E2E_GOOGLE_CLOUD_PROJECT")] - exec ["gcloud", "config", "set", "app/promote_by_default", "false"] + exec ["gcloud", "config", "set", "app/promote_by_default", "false"] exec ["gcloud", "auth", "activate-service-account", "--key-file", gac_path] exec ["gcloud", "info"] @gcloud_cli_installed = true @@ -283,7 +293,7 @@ def test_globals # Run tests in the given directory. # def test_product dir - is_e2e = !presubmit? && newest_ruby? || dir.start_with?("run/") || dir.start_with?("appengine/") + is_e2e = (!presubmit? && newest_ruby?) || dir.start_with?("run/") || dir.start_with?("appengine/") ENV["E2E"] = is_e2e.to_s ENV["TEST_DIR"] = dir start_time = Time.now.to_i @@ -319,7 +329,7 @@ def test_rspec dir # def test_minitest dir test_exec "MINITEST:#{dir}" do - test_files = Dir.glob("test/**/*_test.rb") + test_files = Dir.glob "test/**/*_test.rb" args = ["-Itest", "-w"] args += ["-", "--junit", "--junit-filename=sponge_log.xml"] unless presubmit? exec_ruby args, in: :controller do |controller| @@ -339,7 +349,7 @@ def test_exec name, command = nil puts "**** RUNNING: #{name} ...", :cyan, :bold result = if command - exec(command) + exec command elsif block_given? yield end @@ -371,7 +381,8 @@ def gac_path def presubmit? unless defined? @is_presubmit - @is_presubmit = (/system-tests/ =~ assert_env("KOKORO_BUILD_ARTIFACTS_SUBDIR")).nil? + dir = assert_env "KOKORO_BUILD_ARTIFACTS_SUBDIR" + @is_presubmit = (/system-tests/ =~ dir).nil? end @is_presubmit end diff --git a/appengine/rails-cloudsql-mysql/Gemfile b/appengine/rails-cloudsql-mysql/Gemfile index a0586e4d2..8aa319469 100644 --- a/appengine/rails-cloudsql-mysql/Gemfile +++ b/appengine/rails-cloudsql-mysql/Gemfile @@ -13,6 +13,7 @@ # limitations under the License. source "https://rubygems.org" +ruby ">= 3.2.0" git_source :github do |repo_name| repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include? "/" @@ -63,4 +64,5 @@ gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby] # [START gems] gem "appengine", "~> 0.7" gem "mysql2", "~> 0.5.5" +gem "ostruct" # [END gems] diff --git a/appengine/rails-cloudsql-mysql/Gemfile.lock b/appengine/rails-cloudsql-mysql/Gemfile.lock index 1d68e8fe8..e1f216f45 100644 --- a/appengine/rails-cloudsql-mysql/Gemfile.lock +++ b/appengine/rails-cloudsql-mysql/Gemfile.lock @@ -223,10 +223,10 @@ GEM net-smtp (0.3.3) net-protocol nio4r (2.5.9) - nokogiri (1.18.9) - mini_portile2 (~> 2.8.2) + nokogiri (1.18.9-arm64-darwin) racc (~> 1.4) os (1.1.4) + ostruct (0.6.3) psych (5.1.2) stringio public_suffix (5.0.3) @@ -354,7 +354,7 @@ GEM zeitwerk (2.6.11) PLATFORMS - ruby + arm64-darwin-24 DEPENDENCIES appengine (~> 0.7) @@ -364,6 +364,7 @@ DEPENDENCIES jbuilder (~> 2.11) listen (~> 3.8) mysql2 (~> 0.5.5) + ostruct puma (~> 6.3) rails (~> 7.0) rails-controller-testing @@ -374,5 +375,8 @@ DEPENDENCIES tzinfo-data web-console (>= 4.2.0) +RUBY VERSION + ruby 3.4.5p51 + BUNDLED WITH 2.4.19 diff --git a/appengine/rails-cloudsql-mysql/app.yaml b/appengine/rails-cloudsql-mysql/app.yaml index 56879ad60..dee928f50 100644 --- a/appengine/rails-cloudsql-mysql/app.yaml +++ b/appengine/rails-cloudsql-mysql/app.yaml @@ -18,6 +18,8 @@ entrypoint: bundle exec rackup --port $PORT env: flex runtime: ruby +runtime_config: + operating_system: "ubuntu22" # [END step_1] env_variables: diff --git a/appengine/rails-cloudsql-postgres/Gemfile b/appengine/rails-cloudsql-postgres/Gemfile index 67abc5919..ac128a390 100644 --- a/appengine/rails-cloudsql-postgres/Gemfile +++ b/appengine/rails-cloudsql-postgres/Gemfile @@ -13,6 +13,7 @@ # limitations under the License. source "https://rubygems.org" +ruby ">= 3.2.0" git_source :github do |repo_name| repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include? "/" @@ -63,4 +64,5 @@ gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby] # [START gems] gem "appengine", "~> 0.7" gem "pg", "~> 1.5" +gem "ostruct" # [END gems] diff --git a/appengine/rails-cloudsql-postgres/Gemfile.lock b/appengine/rails-cloudsql-postgres/Gemfile.lock index 56bcb2933..ee1d60afd 100644 --- a/appengine/rails-cloudsql-postgres/Gemfile.lock +++ b/appengine/rails-cloudsql-postgres/Gemfile.lock @@ -229,6 +229,7 @@ GEM mini_portile2 (~> 2.8.2) racc (~> 1.4) os (1.1.4) + ostruct (0.6.3) pg (1.5.3) pp (0.6.2) prettyprint @@ -362,7 +363,7 @@ GEM zeitwerk (2.6.13) PLATFORMS - ruby + arm64-darwin-24 DEPENDENCIES appengine (~> 0.7) @@ -371,6 +372,7 @@ DEPENDENCIES cuprite jbuilder (~> 2.11) listen (~> 3.8) + ostruct pg (~> 1.5) puma (~> 6.4) rails (~> 7.0) @@ -382,5 +384,8 @@ DEPENDENCIES tzinfo-data web-console (>= 4.2.0) +RUBY VERSION + ruby 3.4.5p51 + BUNDLED WITH 2.4.19 diff --git a/appengine/rails-cloudsql-postgres/app.yaml b/appengine/rails-cloudsql-postgres/app.yaml index 56879ad60..dee928f50 100644 --- a/appengine/rails-cloudsql-postgres/app.yaml +++ b/appengine/rails-cloudsql-postgres/app.yaml @@ -18,6 +18,8 @@ entrypoint: bundle exec rackup --port $PORT env: flex runtime: ruby +runtime_config: + operating_system: "ubuntu22" # [END step_1] env_variables: diff --git a/functions/Gemfile b/functions/Gemfile index 9a0889b55..433cfcb8e 100644 --- a/functions/Gemfile +++ b/functions/Gemfile @@ -15,6 +15,7 @@ source "https://rubygems.org" gem "functions_framework", "~> 1.4", ">= 1.4.1" +gem "ostruct" group "test" do gem "google-apis-kgsearch_v1", "~> 0.13" diff --git a/functions/Gemfile.lock b/functions/Gemfile.lock index e6a425349..d90f90746 100644 --- a/functions/Gemfile.lock +++ b/functions/Gemfile.lock @@ -125,6 +125,7 @@ GEM multipart-post (2.3.0) nio4r (2.7.0) os (1.1.4) + ostruct (0.6.3) public_suffix (5.0.3) puma (6.4.2) nio4r (~> 2.0) @@ -167,8 +168,9 @@ DEPENDENCIES minitest (~> 5.20) minitest-focus (~> 1.4) minitest-junit (~> 1.1) + ostruct rake (>= 13.0) slack-ruby-client (>= 2.0, < 3) BUNDLED WITH - 2.4.10 + 4.0.10 diff --git a/run/helloworld/Gemfile b/run/helloworld/Gemfile index 3622c7a06..ec67db306 100644 --- a/run/helloworld/Gemfile +++ b/run/helloworld/Gemfile @@ -14,3 +14,4 @@ end gem "puma", "~> 6.6" gem "rackup", "~> 1.0" +gem "ostruct" diff --git a/run/helloworld/Gemfile.lock b/run/helloworld/Gemfile.lock index 4068f7e96..3388df991 100644 --- a/run/helloworld/Gemfile.lock +++ b/run/helloworld/Gemfile.lock @@ -16,6 +16,7 @@ GEM ruby2_keywords (~> 0.0.1) netrc (0.11.0) nio4r (2.7.4) + ostruct (0.6.3) puma (6.6.0) nio4r (~> 2.0) rack (2.2.8.1) @@ -69,6 +70,7 @@ PLATFORMS ruby DEPENDENCIES + ostruct puma (~> 6.6) rack-test rackup (~> 1.0) @@ -81,4 +83,4 @@ DEPENDENCIES thin BUNDLED WITH - 2.6.6 + 4.0.10