From 600e2b4270809711af4fc0e96f96644c45065617 Mon Sep 17 00:00:00 2001 From: Jonathan de Jong Date: Thu, 30 May 2024 13:43:30 +0200 Subject: [PATCH 1/4] add windows testing to CI --- .github/workflows/build.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 69cd5ac2ef..3811c5fcf6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -367,6 +367,7 @@ jobs: - macos-12 # latest is ARM - macos-latest + - windows-latest python-minor: - 5 - 6 @@ -420,10 +421,22 @@ jobs: key: ${{ runner.os }}-${{ github.sha }} fail-on-cache-miss: true - - name: Run python test command + - name: Install soar-sml run: | pip3.${{ matrix.python-minor }} install soar-sml -f wheelhouse --no-index - python3.${{ matrix.python-minor }} Core/ClientSMLSWIG/Python/TestPythonSML.py + + - name: Run test command (Non-Windows) + if: matrix.os != 'windows-latest' + env: + PYTHONUTF8: 1 + PYTHONIOENCODING: utf-8 + run: python3.${{ matrix.python-minor }} Core/ClientSMLSWIG/Python/TestPythonSML.py + + - name: Run test command (Windows) + if: matrix.os == 'windows-latest' + env: + PYTHONUTF8: 1 + run: py -3.${{ matrix.python-minor }} Core/ClientSMLSWIG/Python/TestPythonSML.py python_push_dev: name: Publish to test.pypi.org From 23810a831449e471727ab3d2bf9dbe42ed0a9779 Mon Sep 17 00:00:00 2001 From: Jonathan de Jong Date: Thu, 30 May 2024 13:44:04 +0200 Subject: [PATCH 2/4] fix building windows wheels properly --- Core/ClientSMLSWIG/Python/SConscript | 6 +++++- Core/ClientSMLSWIG/Python/pyproject.toml | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Core/ClientSMLSWIG/Python/SConscript b/Core/ClientSMLSWIG/Python/SConscript index ff64812cfb..8e2cf452fe 100644 --- a/Core/ClientSMLSWIG/Python/SConscript +++ b/Core/ClientSMLSWIG/Python/SConscript @@ -36,8 +36,12 @@ clone.Append(CPPPATH = inc_path) # GHA Runners. (python installations are handled by cibuildwheel) # # Omitting python's libraries is safe, as python itself injects its symbols when importing the library. -if (not env['ENSCONS_ACTIVE']) or os.name == 'nt': +if (not env['ENSCONS_ACTIVE']): clone.Append(LIBPATH = lib_path, LIBS = pylib) +elif os.name == 'nt': + # For windows specifically, we need to give it a path to find 'python3.lib', + # without linking it against 'python3X' (with X being the minor version). + clone.Append(LIBPATH = lib_path) if os.name == 'posix': clone.Append(CPPFLAGS = Split('-Wno-unused -fno-strict-aliasing')) diff --git a/Core/ClientSMLSWIG/Python/pyproject.toml b/Core/ClientSMLSWIG/Python/pyproject.toml index aed8cd2cc7..ac65515223 100644 --- a/Core/ClientSMLSWIG/Python/pyproject.toml +++ b/Core/ClientSMLSWIG/Python/pyproject.toml @@ -139,7 +139,10 @@ test-command = "SOAR_UNIT_TEST_BASE_DIR={project}/out/ python {project}/Core/Cli test-skip = "cp38-macosx_*:arm64" [tool.cibuildwheel.windows] -# For windows we need a slightly different command +# For windows, we need to include msvcp140.dll and vcruntime140_1.dll in the wheel. +before-build = "pip install delvewheel" +repair-wheel-command = "delvewheel repair --ignore-in-wheel -w {dest_dir} {wheel}" +# For windows we need a slightly different test command test-command = """\ set SOAR_UNIT_TEST_BASE_DIR={project}/out/ python {project}/Core/ClientSMLSWIG/Python/TestPythonSML.py From f76d738e557cc5cacc525a00828e7d714886321d Mon Sep 17 00:00:00 2001 From: Jonathan de Jong Date: Thu, 30 May 2024 14:18:27 +0200 Subject: [PATCH 3/4] applied PYTHONIOENCODING to the wrong run --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3811c5fcf6..81a202263b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -436,6 +436,7 @@ jobs: if: matrix.os == 'windows-latest' env: PYTHONUTF8: 1 + PYTHONIOENCODING: utf-8 run: py -3.${{ matrix.python-minor }} Core/ClientSMLSWIG/Python/TestPythonSML.py python_push_dev: From cfdaa4b58d1bcd7acd2b8e658d161201ee3c06de Mon Sep 17 00:00:00 2001 From: Jonathan de Jong Date: Fri, 31 May 2024 14:23:21 +0200 Subject: [PATCH 4/4] add explanation comment to unicode environment variables --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 81a202263b..7188c13ddc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -428,6 +428,7 @@ jobs: - name: Run test command (Non-Windows) if: matrix.os != 'windows-latest' env: + # Ensures unicode outputs properly on all versions PYTHONUTF8: 1 PYTHONIOENCODING: utf-8 run: python3.${{ matrix.python-minor }} Core/ClientSMLSWIG/Python/TestPythonSML.py @@ -435,6 +436,7 @@ jobs: - name: Run test command (Windows) if: matrix.os == 'windows-latest' env: + # Ensures unicode outputs properly on all versions PYTHONUTF8: 1 PYTHONIOENCODING: utf-8 run: py -3.${{ matrix.python-minor }} Core/ClientSMLSWIG/Python/TestPythonSML.py