Skip to content

Commit dd1cf50

Browse files
authored
Merge pull request #137 from mrkn/windows_ci
Set up CI for window and debug version of Ruby
2 parents aa5cc46 + c9cfe9c commit dd1cf50

File tree

5 files changed

+47
-107
lines changed

5 files changed

+47
-107
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,29 @@ jobs:
2121
os:
2222
- ubuntu-20.04
2323
- macos-latest
24+
- windows-latest
2425
ruby:
2526
- "3.0"
2627
- 2.7
2728
- 2.6
28-
- 2.5
29-
- 2.4
3029
python:
3130
- 3.x
3231
- 2.x
3332
python_architecture:
3433
- x64
3534
include:
36-
- { os: ubuntu-20.04 , ruby: 2.7 , python: 3.8 }
37-
- { os: ubuntu-20.04 , ruby: 2.7 , python: 3.7 }
38-
- { os: ubuntu-20.04 , ruby: 2.7 , python: 3.6 }
39-
- { os: ubuntu-18.04 , ruby: 2.7 , python: 3.8 }
35+
- { os: ubuntu-20.04 , ruby: 2.5 , python: 3.x , python_architecture: x64 }
36+
- { os: ubuntu-20.04 , ruby: 2.4 , python: 3.x , python_architecture: x64 }
37+
- { os: ubuntu-20.04 , ruby: 2.5 , python: 2.x , python_architecture: x64 }
38+
- { os: ubuntu-20.04 , ruby: 2.4 , python: 2.x , python_architecture: x64 }
39+
- { os: ubuntu-20.04 , ruby: 2.7 , python: 3.8 , python_architecture: x64 }
40+
- { os: ubuntu-20.04 , ruby: 2.7 , python: 3.7 , python_architecture: x64 }
41+
- { os: ubuntu-20.04 , ruby: 2.7 , python: 3.6 , python_architecture: x64 }
42+
- { os: ubuntu-18.04 , ruby: 2.7 , python: 3.8 , python_architecture: x64 }
43+
- { os: ubuntu-20.04 , ruby: debug , python: 3.x , python_architecture: x64 }
44+
#- { os: macos-latest , ruby: debug , python: 3.x , python_architecture: x64 }
45+
#- { os: windows-latest , ruby: mswin , python: 3.x , python_architecture: x64 }
46+
#- { os: windows-latest , ruby: mingw , python: 3.x , python_architecture: x64 }
4047

4148
steps:
4249
- uses: actions/checkout@v2
@@ -53,8 +60,6 @@ jobs:
5360
python-version: ${{ matrix.python }}
5461
architecture: ${{ matrix.python_architecture }}
5562

56-
- run: gem install bundler
57-
5863
- run: pip install --user numpy
5964

6065
- run: bundle install
@@ -96,8 +101,6 @@ jobs:
96101
with:
97102
python-version: ${{ matrix.python }}
98103

99-
- run: gem install bundler
100-
101104
- run: conda install numpy
102105

103106
- run: bundle install

Rakefile

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,26 @@ def run_extconf(build_dir, extension_dir, *arguments)
1313
end
1414
end
1515

16+
def make_command
17+
if RUBY_PLATFORM =~ /mswin/
18+
"nmake"
19+
else
20+
ENV["MAKE"] || find_make
21+
end
22+
end
23+
24+
def find_make
25+
candidates = ["gmake", "make"]
26+
paths = ENV.fetch("PATH", "").split(File::PATH_SEPARATOR)
27+
exeext = RbConfig::CONFIG["EXEEXT"]
28+
candidates.each do |candidate|
29+
paths.each do |path|
30+
cmd = File.join(path, "#{candidate}#{exeext}")
31+
return cmd if File.executable?(cmd)
32+
end
33+
end
34+
end
35+
1636
Dir[File.expand_path('../tasks/**/*.rake', __FILE__)].each {|f| load f }
1737

1838
spec.extensions.each do |extension|
@@ -39,13 +59,13 @@ spec.extensions.each do |extension|
3959
desc "Compile"
4060
task compile: makefile do
4161
cd(build_dir) do
42-
sh("make")
62+
sh(make_command)
4363
end
4464
end
4565

4666
task :clean do
4767
cd(build_dir) do
48-
sh("make", "clean") if File.exist?("Makefile")
68+
sh(make_command, "clean") if File.exist?("Makefile")
4969
end
5070
end
5171
end

appveyor.yml

Lines changed: 0 additions & 92 deletions
This file was deleted.

ext/pycall/pycall_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ Py_ssize_t pycall_python_hexversion(void);
663663

664664
void pycall_Py_DecRef(PyObject *);
665665

666-
RUBY_EXTERN const rb_data_type_t pycall_pyptr_data_type;
666+
extern const rb_data_type_t pycall_pyptr_data_type;
667667
size_t pycall_pyptr_memsize(void const *);
668668
void pycall_pyptr_free(void *);
669669

ext/pycall/ruby_wrapper.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,11 +356,16 @@ PyRuby_getattro_with_gvl(PyRubyObject *pyro, PyObject *pyobj_name)
356356

357357
VALUE cPyRubyPtr;
358358

359-
const rb_data_type_t pycall_pyrubyptr_data_type = {
359+
static rb_data_type_t pycall_pyrubyptr_data_type = {
360360
"PyCall::PyRubyPtr",
361361
{ 0, pycall_pyptr_free, pycall_pyptr_memsize, },
362362
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
363-
&pycall_pyptr_data_type, 0, RUBY_TYPED_FREE_IMMEDIATELY
363+
# if defined _WIN32 && !defined __CYGWIN__
364+
0,
365+
# else
366+
&pycall_pyptr_data_type,
367+
# endif
368+
0, RUBY_TYPED_FREE_IMMEDIATELY
364369
#endif
365370
};
366371

@@ -462,6 +467,10 @@ pycall_init_ruby_wrapper(void)
462467

463468
/* PyCall::PyRubyPtr */
464469

470+
#if defined _WIN32 && !defined __CYGWIN__
471+
pycall_pyrubyptr_data_type.parent = &pycall_pyptr_data_type;
472+
#endif
473+
465474
cPyRubyPtr = rb_define_class_under(mPyCall, "PyRubyPtr", cPyPtr);
466475
rb_define_alloc_func(cPyRubyPtr, pycall_pyruby_allocate);
467476
rb_define_method(cPyRubyPtr, "__ruby_object_id__", pycall_pyruby_get_ruby_object_id, 0);

0 commit comments

Comments
 (0)