Skip to content

Commit

Permalink
finnaly test works on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesneimog committed Dec 10, 2023
1 parent 785fdfd commit 2fcea49
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 55 deletions.
105 changes: 57 additions & 48 deletions .github/workflows/Builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,59 +50,68 @@ jobs:
with:
python-version: "3.11"

- if: runner.os == 'Windows'
name: "Install mingw deps"
uses: msys2/setup-msys2@v2
with:
install: make autoconf automake libtool mingw-w64-x86_64-gcc mingw-w64-x86_64-libwinpthread-git mingw-w64-x86_64-dlfcn mingw-w64-x86_64-grep mingw-w64-x86_64-curl unzip
update: false

- if: runner.os == 'Windows'
name: Get Pd
shell: msys2 {0}
run: |
curl -L -o pure-data.zip http://msp.ucsd.edu/Software/pd-0.54-0.msw.zip
unzip pure-data.zip
rm pure-data.zip
rename pd-0.54-0 pd pd-0.54-0
- name: Configure Environment
run: |
mkdir py4pd
python -m pip install numpy
python -c "import sysconfig; f = open('pythonincludes.txt', 'w'); print(sysconfig.get_paths()['include'].replace('\\', '/'), file=f); f.close()"
python -c "import os; import sys; f = open('pythonpath.txt', 'w'); print(os.path.dirname(sys.executable).replace('\\', '/'), file=f); f.close()"
python -c "import os; import sys; import numpy.distutils.misc_util as np_utils; f = open('numpyincludes.txt', 'w'); print(np_utils.get_numpy_include_dirs()[0].replace('\\', '/'), file=f); f.close()"
- if: runner.os == 'Windows'
name: Build py4pd
shell: msys2 {0}
run: |
make PYTHON_VERSION=python3.11 PDDIR=./pd extension=m_amd64
- name: Copy Files and Set for Tests
run: |
$pythonpath = Get-Content pythonpath.txt
Copy-Item -Path "$pythonpath\python311.dll" -Destination py4pd\ -Recurse
Copy-Item -Path "$pythonpath\python3.dll" -Destination py4pd\ -Recurse
Copy-Item -Path "py4pd" -Destination "test" -Recurse
Copy-Item -Path "resources" -Destination "test/py4pd/" -Recurse
cp py4pd.m_amd64 py4pd\
cp py4pd.m_amd64 test\py4pd\py4pd.m_amd64
- name: Run tests
continue-on-error: true
shell: cmd
run: |
cd test
python3 -m pip install numpy -t py4pd/resources/py-modules
python3 runTests.py
py -3.11 --version
- name: Upload Object ZIP
uses: actions/upload-artifact@v3
with:
name: py4pd
path: py4pd
- name: Run tests
run: |
py -3.11 --version
# - if: runner.os == 'Windows'
# name: "Install mingw deps"
# uses: msys2/setup-msys2@v2
# with:
# install: make autoconf automake libtool mingw-w64-x86_64-gcc mingw-w64-x86_64-libwinpthread-git mingw-w64-x86_64-dlfcn mingw-w64-x86_64-grep mingw-w64-x86_64-curl unzip
# update: false

# - if: runner.os == 'Windows'
# name: Get Pd
# shell: msys2 {0}
# run: |
# curl -L -o pure-data.zip http://msp.ucsd.edu/Software/pd-0.54-0.msw.zip
# unzip pure-data.zip
# rm pure-data.zip
# rename pd-0.54-0 pd pd-0.54-0

# - name: Configure Environment
# run: |
# mkdir py4pd
# python -m pip install numpy
# python -c "import sysconfig; f = open('pythonincludes.txt', 'w'); print(sysconfig.get_paths()['include'].replace('\\', '/'), file=f); f.close()"
# python -c "import os; import sys; f = open('pythonpath.txt', 'w'); print(os.path.dirname(sys.executable).replace('\\', '/'), file=f); f.close()"
# python -c "import os; import sys; import numpy.distutils.misc_util as np_utils; f = open('numpyincludes.txt', 'w'); print(np_utils.get_numpy_include_dirs()[0].replace('\\', '/'), file=f); f.close()"

# - if: runner.os == 'Windows'
# name: Build py4pd
# shell: msys2 {0}
# run: |
# make PYTHON_VERSION=python3.11 PDDIR=./pd extension=m_amd64

# - name: Copy Files and Set for Tests
# run: |
# $pythonpath = Get-Content pythonpath.txt
# Copy-Item -Path "$pythonpath\python311.dll" -Destination py4pd\ -Recurse
# Copy-Item -Path "$pythonpath\python3.dll" -Destination py4pd\ -Recurse
# Copy-Item -Path "py4pd" -Destination "test" -Recurse
# Copy-Item -Path "resources" -Destination "test/py4pd/" -Recurse
# cp py4pd.m_amd64 py4pd\
# cp py4pd.m_amd64 test\py4pd\py4pd.m_amd64

# - name: Run tests
# continue-on-error: true
# shell: cmd
# run: |
# cd test
# python3 -m pip install numpy -t py4pd/resources/py-modules
# python3 runTests.py

# - name: Upload Object ZIP
# uses: actions/upload-artifact@v3
# with:
# name: py4pd
# path: py4pd

# ==============================================================================
# = MAC INTEL =
Expand Down
20 changes: 13 additions & 7 deletions test/runTests.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,24 @@ def runTest(pdpatch):
print(f"Patch {pathfile} not found")
sys.exit()
py4pdPath = os.path.dirname(scriptfolder)
cmd = ["..\\pd\\bin\\pd.com", "-nogui", "-send", "start-test bang", pathfile]
cmd = ["..\\pd\\bin\\pd.exe", "-nogui", "-send", "start-test bang", pathfile]
try:
# result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, timeout=timeout_seconds)
output = subprocess.run(
process = subprocess.Popen(
cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True,
shell=True,
timeout=60,
universal_newlines=True,
)
outputLines = str(output.stderr).split("\\n")
_, stderr = process.communicate()
if isinstance(stderr, str):
stderrTOKENS = stderr.split("\n")
process.wait()
outputLines = []
for line in stderrTOKENS:
if "error:" in line:
outputLines.append(line.replace("error:", ""))
else:
outputLines.append(line)
except subprocess.TimeoutExpired:
print("\033[K", end="\r")
print("Test with " + pdpatch + " failed")
Expand Down

0 comments on commit 2fcea49

Please sign in to comment.