Skip to content

Commit b423675

Browse files
Moved pydp folder under src (#332)
* added installation for clang-format in docker file * moved pydp folver under src * moved pydp folver under src * moved pydp folver under src * moved pydp folder under src * moved pydp folder under src * moved pydp folder under src * moved pydp folder under src * moved pydp folder under src * moved pydp folder under src * moved pydp folder under src * moved pydp folder under src * moved pydp folder under src * moved pydp folder under src * moved pydp folder under src * Explicitly tell pybind which python to use * Fix CI tests * removed bin files * Install and test wheel in a different job * Split py35 tests * Include package from src * Add macos wheel fix Co-authored-by: Alejandro Sánchez Medina <[email protected]>
1 parent dbf75ee commit b423675

File tree

27 files changed

+416
-91
lines changed

27 files changed

+416
-91
lines changed

.github/workflows/pypipublish_linux.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,16 @@ jobs:
5656
run: |
5757
bazel build --config Linux src/python:bindings_test --verbose_failures
5858
rm -f _pydp.so
59-
cp -f ./bazel-bin/src/bindings/_pydp.so ./pydp
59+
cp -f ./bazel-bin/src/bindings/_pydp.so ./src/pydp
6060
6161
- name: Build wheel
6262
run: |
6363
python setup.py bdist_wheel
6464
65+
- name: Check the wheel
66+
run: |
67+
twine check dist/*
68+
6569
- name: Renaming wheel
6670
run: |
6771
find . -name '*linux*.whl' -type f -exec bash -c 'mv "$1" "${1/linux/manylinux1}"' -- {} \;

.github/workflows/pypipublish_osx.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
run: |
3838
bazel build --config macOS src/python:bindings_test --verbose_failures
3939
rm -f _pydp.so
40-
cp -f ./bazel-bin/src/bindings/_pydp.so ./pydp
40+
cp -f ./bazel-bin/src/bindings/_pydp.so ./src/pydp
4141
4242
4343
- name: Build wheel

.github/workflows/pypipublish_windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- name: Build PyDP
3131
run: |
3232
bazel build --cxxopt='/std:c++17' src/python:bindings_test --verbose_failures
33-
copy bazel-bin\src\bindings\_pydp.so pydp\_pydp.pyd
33+
copy bazel-bin\src\bindings\_pydp.so src\pydp\_pydp.pyd
3434
python setup.py bdist_wheel
3535
$version=(python -c "import pydp; print(pydp.__version__)")
3636
echo "::set-output name=version::$version"

.github/workflows/tests-py35.yml

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
name: Tests-py35
2+
3+
on:
4+
push:
5+
branches:
6+
- master, dev
7+
pull_request:
8+
types: [opened, synchronize, reopened]
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ${{ matrix.os }}
14+
strategy:
15+
fail-fast: false
16+
# max-parallel: 6
17+
matrix:
18+
os: [ubuntu-20.04, macOS-10.15, windows-2019]
19+
python-version: [3.5]
20+
21+
# Timeout: https://stackoverflow.com/a/59076067/4521646
22+
timeout-minutes: 35
23+
24+
steps:
25+
- uses: actions/checkout@v2
26+
with:
27+
submodules: true
28+
29+
- name: Set up Python ${{ matrix.python-version }}
30+
uses: actions/setup-python@v1
31+
with:
32+
python-version: ${{ matrix.python-version }}
33+
34+
- name: Setup Bazel
35+
uses: abhinavsingh/setup-bazel@v3
36+
37+
- name: Set up packages
38+
run: |
39+
python -m pip install --upgrade pip
40+
python -m pip install setuptools wheel pytest gcovr coverage twine==1.15.0
41+
42+
- name: Build PyDP with coverage (Unix)
43+
if: runner.os != 'Windows'
44+
# --expunge is needed as there is an intermittent error on macOS for which this seems to be the solution
45+
# Ref: https://github.com/bazelbuild/rules_go/issues/2221
46+
run: |
47+
bazel clean --expunge
48+
./build_PyDP.sh
49+
- name: Build PyDP with coverage (Windows)
50+
if: runner.os == 'Windows'
51+
run: |
52+
bazel clean --expunge
53+
54+
$PYTHONHOME=$(python -c 'import sys; print(sys.executable);').Replace('\', '/')
55+
$PYTHONPATH=$(python -c "import sys; print([x for x in sys.path if 'site-packages' in x][0]);").Replace('\', '/')
56+
57+
echo "PYTHONHOME=$PYTHONHOME"
58+
echo "PYTHONPATH=$PYTHONPATH"
59+
60+
bazel build src/python:bindings_test `
61+
--config Windows `
62+
--verbose_failures `
63+
--action_env=PYTHON_BIN_PATH=$PYTHONHOME `
64+
--action_env=PYTHON_LIB_PATH=$PYTHONPATH
65+
66+
copy bazel-bin\src\bindings\_pydp.so src\pydp\_pydp.pyd
67+
68+
- name: Make wheel (linux and windows)
69+
if: runner.os != 'macOS'
70+
run: |
71+
python setup.py sdist
72+
python setup.py bdist_wheel
73+
74+
- name: Make wheel (macOS)
75+
if: runner.os == 'macOS'
76+
run: |
77+
python setup.py sdist
78+
python setup.py bdist_wheel --plat-name macosx_10_15_x86_64
79+
80+
- name: Upload dist folder as artifact
81+
uses: actions/upload-artifact@v2
82+
with:
83+
name: dist-${{matrix.os}}-${{matrix.python-version}}
84+
path: dist
85+
retention-days: 3
86+
87+
- name: Upload test folder as artifact
88+
uses: actions/upload-artifact@v2
89+
with:
90+
name: tests-${{matrix.os}}-${{matrix.python-version}}
91+
path: tests
92+
retention-days: 3
93+
94+
- name: Mypy test
95+
run: |
96+
python -m pip install mypy
97+
mypy tests/ src/pydp/
98+
mypy examples/Tutorial_1-carrots_demo
99+
mypy examples/Tutorial_2-restaurant_demo
100+
101+
####################################################################
102+
#####
103+
####################################################################
104+
105+
# Currently failing
106+
# poetry run mypy examples/Tutorial_3-Titanic_demo
107+
108+
# Need to see how to run the c++ code coverage
109+
# - name: Check C++ code coverage
110+
# if: runner.os == 'Linux' # Coverage will be the same on all systems so only running the check on Linux
111+
# run: |
112+
# make check-coverage-cpp
113+
114+
fresh-wheel-install:
115+
needs: build
116+
runs-on: ${{ matrix.os }}
117+
strategy:
118+
fail-fast: false
119+
matrix:
120+
os: [ubuntu-20.04, macOS-10.15, windows-2019]
121+
python-version: [3.5]
122+
timeout-minutes: 35
123+
124+
steps:
125+
- name: Set up Python ${{ matrix.python-version }}
126+
uses: actions/setup-python@v1
127+
with:
128+
python-version: ${{ matrix.python-version }}
129+
130+
- name: Install needed packages
131+
run: |
132+
python -m pip install --upgrade pip
133+
python -m pip install setuptools wheel pytest gcovr coverage twine==1.15.0
134+
python -m pip install matplotlib
135+
python -m pip install seaborn
136+
python -m pip install coverage
137+
138+
- name: Download dist folder as artifact
139+
uses: actions/download-artifact@v1
140+
with:
141+
name: dist-${{matrix.os}}-${{matrix.python-version}}
142+
path: dist
143+
144+
- name: Download test folder as artifact
145+
uses: actions/download-artifact@v1
146+
with:
147+
name: tests-${{matrix.os}}-${{matrix.python-version}}
148+
path: tests
149+
150+
- name: Install PyDP wheel (Unix)
151+
if: runner.os != 'Windows'
152+
run: |
153+
python -m pip install --upgrade --force-reinstall ./dist/*.whl
154+
155+
- name: Install PyDP wheel (Windows)
156+
if: runner.os == 'Windows'
157+
run: |
158+
python -m pip install --upgrade --force-reinstall (get-item .\dist\*.whl)
159+
160+
- name: Run tests
161+
run: |
162+
coverage run -m pytest tests
163+
164+
- name: Check Python code coverage
165+
if: runner.os == 'Linux' # Coverage will be the same on all systems so only running the check on Linux
166+
run: |
167+
coverage report --fail-under ${MIN_COVERAGE}
168+
env:
169+
MIN_COVERAGE: 75

0 commit comments

Comments
 (0)