From 66ddae66dac609e302b94815e8a112c839e0d17d Mon Sep 17 00:00:00 2001 From: Grant Hutchins Date: Wed, 5 Jun 2024 16:09:43 -0500 Subject: [PATCH 01/10] Fix method name in CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b9cc412e0..3b7bdc69b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ ## Release v1.3.0 (28 May 2024) * (#1042) Align Java Executor Service behavior for `shuttingdown?`, `shutdown?` -* (#1038) Add `Concurrent.usable_processor_count` that is cgroups aware. +* (#1038) Add `Concurrent.available_processor_count` that is cgroups aware. ## Release v1.2.3 (16 Jan 2024) From 8f07f578bd5ee78ccb7b079749ad8c974adcfe03 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Fri, 7 Jun 2024 21:10:17 +0200 Subject: [PATCH 02/10] Get RakeCompilerDock to work with either podman or docker, based on what is installed * See 479a557564a62d697da22c3ba1b8e801e46fc5f8 --- Rakefile | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index f167f4659..ecace9ffb 100644 --- a/Rakefile +++ b/Rakefile @@ -28,6 +28,10 @@ unless Concurrent.on_jruby? || Concurrent.on_truffleruby? end end +def which?(executable) + !`which #{executable} 2>/dev/null`.empty? +end + require 'rake_compiler_dock' namespace :repackage do desc '* with Windows fat distributions' @@ -42,12 +46,19 @@ namespace :repackage do Rake::Task['lib/concurrent-ruby/concurrent/concurrent_ruby.jar'].invoke # build all gem files + rack_compiler_dock_kwargs = {} + if which?('podman') and (!which?('docker') || `docker --version`.include?('podman')) + # podman and only podman available, so RakeCompilerDock will use podman, otherwise it uses docker + rack_compiler_dock_kwargs = { + options: ['--privileged'], # otherwise the directory in the image is empty + runas: false + } + end %w[x86-mingw32 x64-mingw32].each do |plat| RakeCompilerDock.sh( "bundle install --local && bundle exec rake native:#{plat} gem --trace", platform: plat, - options: ['--privileged'], # otherwise the directory in the image is empty - runas: false) + **rack_compiler_dock_kwargs) end end end From 397da1f70e84dbaabc6e4becf3cc68c4a705fd9c Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Fri, 7 Jun 2024 21:13:24 +0200 Subject: [PATCH 03/10] Fix concurrent-ruby-edge to depend on `~> MAJOR.MINOR` of concurrent-ruby * i.e. >= MAJOR.MINOR & < (MAJOR+1) * See https://github.com/ruby-concurrency/concurrent-ruby/issues/1052 --- concurrent-ruby-edge.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/concurrent-ruby-edge.gemspec b/concurrent-ruby-edge.gemspec index 02383d346..4eedb53f0 100644 --- a/concurrent-ruby-edge.gemspec +++ b/concurrent-ruby-edge.gemspec @@ -25,5 +25,5 @@ Please see http://concurrent-ruby.com for more information. s.required_ruby_version = '>= 2.3' - s.add_runtime_dependency 'concurrent-ruby', "~> #{Concurrent::VERSION}" + s.add_runtime_dependency 'concurrent-ruby', "~> #{Concurrent::VERSION.split('.')[0..1].join('.')}" end From 152b3029ae202bf20038dc6da00fa7f7cb835ada Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Fri, 7 Jun 2024 21:19:19 +0200 Subject: [PATCH 04/10] Ensure JRuby is used in release tests --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index ecace9ffb..74cd2d723 100644 --- a/Rakefile +++ b/Rakefile @@ -269,7 +269,7 @@ namespace :release do sh 'ruby -v' sh 'bundle exec rake spec:installed' - env = { "PATH" => "#{ENV['CONCURRENT_JRUBY_HOME']}/bin:#{ENV['PATH']}" } + env = { "PATH" => "#{ENV.fetch('CONCURRENT_JRUBY_HOME')}/bin:#{ENV['PATH']}" } sh env, 'ruby -v' sh env, 'bundle exec rake spec:installed' end From 28c1cb42df0ee4f3e4e36bf3d881cfb15e3c157a Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Fri, 7 Jun 2024 21:20:49 +0200 Subject: [PATCH 05/10] Make it possible to publish edge without base --- Rakefile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Rakefile b/Rakefile index 74cd2d723..642c9e096 100644 --- a/Rakefile +++ b/Rakefile @@ -282,8 +282,8 @@ namespace :release do task :publish => ['publish:ask', 'publish:tag', 'publish:rubygems', 'publish:post_steps'] namespace :publish do - publish_base = true - publish_edge = false + publish_base = nil + publish_edge = nil task :ask do begin @@ -291,8 +291,15 @@ namespace :release do input = STDIN.gets.strip.downcase end until %w(y n).include?(input) exit 1 if input == 'n' + + begin + STDOUT.puts 'Do you want to publish `concurrent-ruby`? (y/n)' + input = STDIN.gets.strip.downcase + end until %w(y n).include?(input) + publish_base = input == 'y' + begin - STDOUT.puts 'It will publish `concurrent-ruby`. Do you want to publish `concurrent-ruby-edge`? (y/n)' + STDOUT.puts 'Do you want to publish `concurrent-ruby-edge`? (y/n)' input = STDIN.gets.strip.downcase end until %w(y n).include?(input) publish_edge = input == 'y' From 9ff477fb39edcd75e7a8a141fa90502cfa051589 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Fri, 7 Jun 2024 21:25:29 +0200 Subject: [PATCH 06/10] Release edge 0.7.1 --- CHANGELOG.md | 6 ++++++ lib/concurrent-ruby-edge/concurrent/edge/version.rb | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b7bdc69b..5d0aef8e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ ## Current +## Edge 0.7.1 (7 June 2024) + +concurrent-ruby-edge: + +* (#1052) Fix dependency on `concurrent-ruby` to allow the latest release. + ## Release v1.3.1 (29 May 2024) * Release 1.3.0 was broken when pushed to RubyGems. 1.3.1 is a packaging fix. diff --git a/lib/concurrent-ruby-edge/concurrent/edge/version.rb b/lib/concurrent-ruby-edge/concurrent/edge/version.rb index 4a129936d..26ae15ef6 100644 --- a/lib/concurrent-ruby-edge/concurrent/edge/version.rb +++ b/lib/concurrent-ruby-edge/concurrent/edge/version.rb @@ -1,3 +1,3 @@ module Concurrent - EDGE_VERSION = '0.7.0' + EDGE_VERSION = '0.7.1' end From 22f337cca5564d83c3d0e618b02d5b07bad5aee4 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Fri, 7 Jun 2024 21:35:15 +0200 Subject: [PATCH 07/10] Automatically run bundle install before running tests --- Rakefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Rakefile b/Rakefile index 642c9e096..006fcb993 100644 --- a/Rakefile +++ b/Rakefile @@ -267,10 +267,12 @@ namespace :release do Bundler.with_original_env do sh 'ruby -v' + sh 'bundle install' sh 'bundle exec rake spec:installed' env = { "PATH" => "#{ENV.fetch('CONCURRENT_JRUBY_HOME')}/bin:#{ENV['PATH']}" } sh env, 'ruby -v' + sh env, 'bundle install' sh env, 'bundle exec rake spec:installed' end From 393ad72b9d537d6694fd8c9cd062e2cd52329e3e Mon Sep 17 00:00:00 2001 From: Earlopain <14981592+Earlopain@users.noreply.github.com> Date: Thu, 6 Jun 2024 11:10:58 +0200 Subject: [PATCH 08/10] Remove dependency on `win32ole` This will become bundled in Ruby 3.5 Unfortunately there is no portable way of checking for this. The wmic command is deprecated, though I don't observe this myself on W11 (yet?) --- .../concurrent/utility/processor_counter.rb | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/lib/concurrent-ruby/concurrent/utility/processor_counter.rb b/lib/concurrent-ruby/concurrent/utility/processor_counter.rb index e31808722..d5274620e 100644 --- a/lib/concurrent-ruby/concurrent/utility/processor_counter.rb +++ b/lib/concurrent-ruby/concurrent/utility/processor_counter.rb @@ -68,10 +68,20 @@ def compute_physical_processor_count end cores.count when /mswin|mingw/ - require 'win32ole' - result_set = WIN32OLE.connect("winmgmts://").ExecQuery( - "select NumberOfCores from Win32_Processor") - result_set.to_enum.collect(&:NumberOfCores).reduce(:+) + # Get-CimInstance introduced in PowerShell 3 or earlier: https://learn.microsoft.com/en-us/previous-versions/powershell/module/cimcmdlets/get-ciminstance?view=powershell-3.0 + result = run('powershell -command "Get-CimInstance -ClassName Win32_Processor | Select-Object -Property NumberOfCores"') + if !result || $?.exitstatus != 0 + # fallback to deprecated wmic for older systems + result = run("wmic cpu get NumberOfCores") + end + if !result || $?.exitstatus != 0 + # Bail out if both commands returned something unexpected + processor_count + else + # powershell: "\nNumberOfCores\n-------------\n 4\n\n\n" + # wmic: "NumberOfCores \n\n4 \n\n\n\n" + result.scan(/\d+/).map(&:to_i).reduce(:+) + end else processor_count end @@ -81,6 +91,11 @@ def compute_physical_processor_count return 1 end + def run(command) + IO.popen(command, &:read) + rescue Errno::ENOENT + end + def compute_cpu_quota if RbConfig::CONFIG["target_os"].include?("linux") if File.exist?("/sys/fs/cgroup/cpu.max") From c672d6e1abfefe64396fa5f48e52c7fb43b9a5d3 Mon Sep 17 00:00:00 2001 From: Earlopain <14981592+Earlopain@users.noreply.github.com> Date: Thu, 6 Jun 2024 11:57:08 +0200 Subject: [PATCH 09/10] Add a windows job to CI --- .github/workflows/ci.yml | 8 ++++++-- spec/concurrent/channel/integration_spec.rb | 2 +- spec/concurrent/promises_spec.rb | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb118f400..ab1d23db8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,20 +6,24 @@ concurrency: jobs: build: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }}-latest timeout-minutes: 10 strategy: fail-fast: false matrix: ruby: [2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, 3.2, 3.3, jruby, truffleruby] + os: [ubuntu] + include: + - ruby: 3.3 + os: windows env: JAVA_OPTS: '-Xmx1024m' RUBYOPT: '-w' JRUBY_OPTS: '--dev' - name: "Tests: Ruby ${{ matrix.ruby }}" + name: "Tests: Ruby ${{ matrix.ruby }} - ${{ matrix.os }}" steps: - name: Clone Repo uses: actions/checkout@v4 diff --git a/spec/concurrent/channel/integration_spec.rb b/spec/concurrent/channel/integration_spec.rb index 01f490dc9..4d4c073ee 100644 --- a/spec/concurrent/channel/integration_spec.rb +++ b/spec/concurrent/channel/integration_spec.rb @@ -68,7 +68,7 @@ end specify 'default-selection.rb' do - skip('flaky') if Concurrent.on_jruby? || Concurrent.on_truffleruby? + skip('flaky') if Concurrent.on_jruby? || Concurrent.on_truffleruby? || Concurrent.on_windows? expected = <<-STDOUT . . diff --git a/spec/concurrent/promises_spec.rb b/spec/concurrent/promises_spec.rb index d89ce309f..2aa88fdfa 100644 --- a/spec/concurrent/promises_spec.rb +++ b/spec/concurrent/promises_spec.rb @@ -758,6 +758,7 @@ def behaves_as_delay(delay, value) describe 'value!' do %w[with without].each do |timeout| it "does not return spuriously #{timeout} timeout" do + skip "SIGHUP not supported" if Concurrent.on_windows? # https://github.com/ruby-concurrency/concurrent-ruby/issues/1015 trapped = false original_handler = Signal.trap(:SIGHUP) { trapped = true } From d1d29ac07ee48648f672e22a92d9bdc0160375c1 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Fri, 7 Jun 2024 22:05:42 +0200 Subject: [PATCH 10/10] 1.3.2 --- CHANGELOG.md | 6 +++++- lib/concurrent-ruby/concurrent/version.rb | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d0aef8e8..db8fd7964 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ ## Current -## Edge 0.7.1 (7 June 2024) +## Release v1.3.2, edge v0.7.1 (29 May 2024) + +concurrent-ruby: + +* (#1051) Remove dependency on `win32ole`. concurrent-ruby-edge: diff --git a/lib/concurrent-ruby/concurrent/version.rb b/lib/concurrent-ruby/concurrent/version.rb index afa6a4b04..e449c62bc 100644 --- a/lib/concurrent-ruby/concurrent/version.rb +++ b/lib/concurrent-ruby/concurrent/version.rb @@ -1,3 +1,3 @@ module Concurrent - VERSION = '1.3.1' + VERSION = '1.3.2' end