diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 69cd5ac2ef..7188c13ddc 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,25 @@ 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: + # Ensures unicode outputs properly on all versions + 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: + # Ensures unicode outputs properly on all versions + PYTHONUTF8: 1 + PYTHONIOENCODING: utf-8 + run: py -3.${{ matrix.python-minor }} Core/ClientSMLSWIG/Python/TestPythonSML.py python_push_dev: name: Publish to test.pypi.org 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