Skip to content

Commit 539e7fa

Browse files
authored
Merge pull request #139 from mrkn/windows_conda_ci
Set up CI for conda on windows-latest and venv environment
2 parents 66354df + e4663cb commit 539e7fa

File tree

5 files changed

+386
-106
lines changed

5 files changed

+386
-106
lines changed

.github/workflows/ci.yml

Lines changed: 51 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212

1313
jobs:
1414
test:
15-
name: ${{ matrix.os }}/${{ matrix.ruby }}/${{ matrix.python }}-${{ matrix.python_architecture }}
15+
name: ${{ matrix.venv }}${{ matrix.os }}/${{ matrix.ruby }}/${{ matrix.python }}-${{ matrix.python_architecture }}
1616
runs-on: ${{ matrix.os }}
1717

1818
strategy:
@@ -21,7 +21,6 @@ jobs:
2121
os:
2222
- ubuntu-20.04
2323
- macos-latest
24-
- windows-latest
2524
ruby:
2625
- "3.0"
2726
- 2.7
@@ -31,19 +30,24 @@ jobs:
3130
- 2.x
3231
python_architecture:
3332
- x64
33+
venv:
34+
- ""
3435
include:
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 }
36+
- { os: ubuntu-20.04 , ruby: 2.5 , python: 3.x , python_architecture: x64 , venv: "" }
37+
- { os: ubuntu-20.04 , ruby: 2.4 , python: 3.x , python_architecture: x64 , venv: "" }
38+
- { os: ubuntu-20.04 , ruby: 2.5 , python: 2.x , python_architecture: x64 , venv: "" }
39+
- { os: ubuntu-20.04 , ruby: 2.4 , python: 2.x , python_architecture: x64 , venv: "" }
40+
- { os: ubuntu-20.04 , ruby: 2.7 , python: 3.8 , python_architecture: x64 , venv: "" }
41+
- { os: ubuntu-20.04 , ruby: 2.7 , python: 3.7 , python_architecture: x64 , venv: "" }
42+
- { os: ubuntu-20.04 , ruby: 2.7 , python: 3.6 , python_architecture: x64 , venv: "" }
43+
- { os: ubuntu-18.04 , ruby: 2.7 , python: 3.8 , python_architecture: x64 , venv: "" }
44+
- { os: ubuntu-20.04 , ruby: debug , python: 3.x , python_architecture: x64 , venv: "" }
45+
- { os: ubuntu-20.04 , ruby: "3.0" , python: 3.x , python_architecture: x64 , venv: "venv:" }
46+
- { os: ubuntu-18.04 , ruby: "3.0" , python: 3.x , python_architecture: x64 , venv: "venv:" }
47+
- { os: ubuntu-18.04 , ruby: "3.0" , python: 3.8 , python_architecture: x64 , venv: "venv:" }
48+
- { os: macos-latest , ruby: "3.0" , python: 3.x , python_architecture: x64 , venv: "venv:" }
49+
- { os: macos-latest , ruby: "3.0" , python: 3.8 , python_architecture: x64 , venv: "venv:" }
50+
#- { os: macos-latest , ruby: debug , python: 3.x , python_architecture: x64 , venv: "" }
4751

4852
steps:
4953
- uses: actions/checkout@v2
@@ -68,6 +72,15 @@ jobs:
6872

6973
- run: python lib/pycall/python/investigator.py
7074

75+
- name: venv examination
76+
run: |
77+
python -m venv ~/test-venv
78+
source ~/test-venv/bin/activate
79+
ruby -Ilib -Iext/pycall -rpycall -ePyCall.builtins
80+
env:
81+
PYCALL_DEBUG_FIND_LIBPYTHON: 1
82+
if: ${{ matrix.venv != '' }}
83+
7184
- run: rake
7285
env:
7386
PYTHON: python
@@ -92,23 +105,44 @@ jobs:
92105
with:
93106
fetch-depth: 1
94107

108+
- uses: conda-incubator/setup-miniconda@v2
109+
with:
110+
activate-environment: test
111+
python-version: ${{ matrix.python }}
112+
95113
- uses: ruby/setup-ruby@v1
96114
if: matrix.ruby_version != 'master-nightly'
97115
with:
98116
ruby-version: ${{ matrix.ruby }}
99117

100-
- uses: s-weigand/setup-conda@v1
101-
with:
102-
python-version: ${{ matrix.python }}
118+
- name: Add Ruby path
119+
run: |
120+
echo >> ~/.profile
121+
echo >> ~/.profile
122+
IFS=:
123+
for p in $PATH; do
124+
case $p in
125+
*/Ruby/*)
126+
echo "export PATH=$p:\$PATH" >> ~/.profile
127+
;;
128+
esac
129+
done
130+
131+
- run: cat ~/.profile
132+
133+
- run: bash -xe ~/.profile
103134

104135
- run: conda install numpy
136+
shell: bash -l {0}
105137

106138
- run: bundle install
107139

108140
- run: rake compile
109141

110142
- run: python lib/pycall/python/investigator.py
143+
shell: bash -l {0}
111144

112145
- run: rake
113146
env:
114147
PYTHON: python
148+
shell: bash -l {0}

.github/workflows/windows.yml

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
name: Windows
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
types:
9+
- opened
10+
- synchronize
11+
- reopened
12+
13+
jobs:
14+
test:
15+
name: ruby-${{ matrix.ruby }}/python-${{ matrix.python }}-${{ matrix.python_architecture }}
16+
runs-on: windows-latest
17+
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
ruby:
22+
- "3.0"
23+
- 2.7
24+
- 2.6
25+
python:
26+
- 3.x
27+
- 2.x
28+
python_architecture:
29+
- x64
30+
#include:
31+
#- { os: windows-latest , ruby: mswin , python: 3.x , python_architecture: x64 }
32+
#- { os: windows-latest , ruby: mingw , python: 3.x , python_architecture: x64 }
33+
34+
steps:
35+
- uses: actions/checkout@v2
36+
with:
37+
fetch-depth: 1
38+
39+
- uses: ruby/setup-ruby@v1
40+
if: matrix.ruby_version != 'master-nightly'
41+
with:
42+
ruby-version: ${{ matrix.ruby }}
43+
44+
- uses: actions/setup-python@v2
45+
with:
46+
python-version: ${{ matrix.python }}
47+
architecture: ${{ matrix.python_architecture }}
48+
49+
- run: pip install --user numpy
50+
51+
- run: bundle install
52+
53+
- run: rake compile
54+
55+
- run: python lib/pycall/python/investigator.py
56+
57+
- run: rake
58+
env:
59+
PYTHON: python
60+
61+
conda:
62+
name: conda:ruby-${{ matrix. ruby }}/python-${{ matrix.python }}
63+
runs-on: windows-latest
64+
65+
strategy:
66+
fail-fast: false
67+
matrix:
68+
ruby:
69+
- "3.0"
70+
python:
71+
- 3.8
72+
73+
defaults:
74+
run:
75+
shell: pwsh
76+
77+
steps:
78+
- uses: actions/checkout@v2
79+
with:
80+
fetch-depth: 1
81+
82+
- uses: conda-incubator/setup-miniconda@v2
83+
with:
84+
activate-environment: test
85+
python-version: ${{ matrix.python }}
86+
87+
- run: set
88+
shell: cmd
89+
90+
- name: Add conda's DLL path
91+
run: |
92+
echo $env:CONDA\Library\bin >> $GITHUB_PATH
93+
echo $env:CONDA_PREFIX\Library\bin >> $GITHUB_PATH
94+
95+
- uses: ruby/setup-ruby@v1
96+
if: matrix.ruby_version != 'master-nightly'
97+
with:
98+
ruby-version: ${{ matrix.ruby }}
99+
100+
- run: conda install numpy
101+
102+
- run: python -c 'import numpy; print(numpy)'
103+
104+
- run: python -c 'import os; print(os.environ)'
105+
106+
- run: bundle install
107+
108+
- run: rake compile
109+
110+
- run: python lib/pycall/python/investigator.py
111+
112+
- run: |
113+
ruby -Ilib -Iext/pycall -rpycall -e "p PyCall.sys.version"
114+
ruby -Ilib -Iext/pycall -rpycall -e "PyCall.import_module(:numpy)"
115+
env:
116+
PYTHON: python
117+
continue-on-error: true
118+
119+
- run: |
120+
echo $env:PATH
121+
rake
122+
env:
123+
PYTHON: python
124+
CONDA_DLL_SEARCH_MODIFICATION_ENABLE: 1
125+
continue-on-error: true

lib/pycall/init.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ class << PyCall::LibPython
3030
remove_method :const_missing
3131
end
3232

33-
ENV['PYTHONPATH'] = [ File.expand_path('../python', __FILE__), ENV['PYTHONPATH'] ].compact.join(File::PATH_SEPARATOR)
34-
3533
LibPython.instance_variable_set(:@handle, LibPython::Finder.find_libpython(python))
3634
class << LibPython
3735
undef_method :handle
@@ -45,6 +43,8 @@ class << LibPython
4543
require 'pycall.so'
4644
end
4745

46+
PyCall.sys.path.append(File.expand_path('../python', __FILE__))
47+
4848
require 'pycall/dict'
4949
require 'pycall/list'
5050
require 'pycall/slice'

0 commit comments

Comments
 (0)