Skip to content

Actions test #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Ruby CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
test:
name: Ruby ${{ matrix.ruby }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
ruby: ['3.1', '3.2', '3.3', '3.4']

steps:
- name: Checkout code
uses: actions/checkout@v4

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

- name: Run tests
run: bundle exec rspec

23 changes: 3 additions & 20 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ PATH
GEM
remote: http://rubygems.org/
specs:
ast (2.4.2)
coderay (1.1.3)
diff-lcs (1.5.0)
ffi (1.15.5)
Expand Down Expand Up @@ -34,15 +33,10 @@ GEM
notiffany (0.1.3)
nenv (~> 0.1)
shellany (~> 0.0)
parser (2.4.0.2)
ast (~> 2.3)
power_assert (2.0.2)
powerpack (0.1.3)
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
rainbow (2.2.2)
rake
rake (10.5.0)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
Expand All @@ -60,33 +54,22 @@ GEM
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.12.0)
rspec-support (3.12.0)
rubocop (0.41.2)
parser (>= 2.3.1.1, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
rubocop-lts (2.0.5)
rubocop-ruby1_9 (~> 1.0.5)
rubocop-ruby1_9 (1.0.5)
parser (= 2.4.0.2)
rubocop (= 0.41.2)
ruby-progressbar (1.11.0)
shellany (0.0.1)
test-unit (3.5.5)
power_assert
thor (1.2.1)
unicode-display_width (1.8.0)

PLATFORMS
arm64-darwin-23
x64-mingw-ucrt
x86_64-darwin-19
x86_64-linux

DEPENDENCIES
guard-rspec (~> 4.7)
os!
rake (~> 10.5)
rspec (~> 3.12)
rubocop-lts (~> 2.0)
test-unit (~> 3.5)

BUNDLED WITH
Expand Down
2 changes: 1 addition & 1 deletion lib/os.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def self.iron_ruby?

def self.bits
@bits ||= begin
if host_cpu =~ /_64$/ || RUBY_PLATFORM =~ /x86_64/
if host_cpu =~ /(_|x)64$/ || RUBY_PLATFORM =~ /x86_64/
64
elsif RUBY_PLATFORM == 'java' && ENV_JAVA['sun.arch.data.model'] # "32" or "64":http://www.ruby-forum.com/topic/202173#880613
ENV_JAVA['sun.arch.data.model'].to_i
Expand Down
1 change: 0 additions & 1 deletion os.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,5 @@ Gem::Specification.new do |s|
s.add_development_dependency('guard-rspec'.freeze, ['~> 4.7'])
s.add_development_dependency('rake'.freeze, ['~> 10.5'])
s.add_development_dependency('rspec'.freeze, ['~> 3.12'])
s.add_development_dependency('rubocop-lts'.freeze, ['~> 2.0']) # For Ruby 1.8.7 compat
s.add_development_dependency('test-unit'.freeze, ['~> 3.5'])
end
6 changes: 6 additions & 0 deletions spec/config/rspec/rspec_core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,10 @@
end

config.expect_with :test_unit

config.before(:each) do
OS.instance_variables.each do |var|
OS.remove_instance_variable(var)
end
end
end
4 changes: 1 addition & 3 deletions spec/os_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
else
assert OS.windows? == true
assert OS.doze? == true
assert OS.posix? == false # can fail in error at times...I guess because some other spec has reset ENV on us...
assert OS.posix? == false
end
assert OS::Underlying.windows?
elsif [/linux/, /darwin/].any? { |posix_pattern| (RbConfig::CONFIG['host_os'] =~ posix_pattern) || RUBY_PLATFORM =~ posix_pattern }
Expand Down Expand Up @@ -117,8 +117,6 @@
it 'has working cpu count method' do
cpu_count = OS.cpu_count
assert cpu_count >= 1
# CPU count is usually either a power of 2 or an even number.
assert ((cpu_count & (cpu_count - 1)) == 0) || cpu_count.even?
end

it 'has working cpu count method with no env. variable' do
Expand Down