From ca0f3b20fd9edde21e772ebc96b8d1145c0d9f6e Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Thu, 3 Dec 2026 14:04:53 -0700 Subject: [PATCH 1/3] Move Windows CI from AppVeyor to GitHub Actions --- .github/workflows/ci.yml | 107 ++++++++++++++++++++++++++++++++++++ README.md | 1 - appveyor.yml | 114 --------------------------------------- 3 files changed, 107 insertions(+), 115 deletions(-) delete mode 100644 appveyor.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8347b1f8..edf67c55 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -252,3 +252,110 @@ jobs: mkdir -p empty && cd empty python -m pytest -v --pyargs symengine python ../bin/test_python.py + + build-windows: + runs-on: windows-2022 + strategy: + fail-fast: false + matrix: + include: + - PYTHON_VERSION: '3.14' + PLATFORM: x64 + WITH_MPFR: yes + WITH_MPC: yes + WITH_LLVM: yes + - PYTHON_VERSION: '3.11' + PLATFORM: Win32 + WITH_MPFR: yes + WITH_MPC: yes + - PYTHON_VERSION: '3.13' + PLATFORM: x64 + WITH_MPFR: yes + WITH_MPC: yes + - PYTHON_VERSION: '3.12' + PLATFORM: x64 + - PYTHON_VERSION: '3.14' + PLATFORM: x64 + WITH_SYMPY: no + - PYTHON_VERSION: '3.11' + PLATFORM: x64 + WITH_NUMPY: no + + env: + BUILD_TYPE: Release + PLATFORM: ${{ matrix.PLATFORM }} + WITH_MPFR: ${{ matrix.WITH_MPFR }} + WITH_MPC: ${{ matrix.WITH_MPC }} + WITH_LLVM: ${{ matrix.WITH_LLVM }} + WITH_NUMPY: ${{ matrix.WITH_NUMPY }} + WITH_SYMPY: ${{ matrix.WITH_SYMPY }} + DEPS_PREFIX: C:\deps + SYMENGINE_PREFIX: C:\symengine + + defaults: + run: + shell: bash -el {0} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.PYTHON_VERSION }} + architecture: ${{ matrix.PLATFORM == 'Win32' && 'x86' || 'x64' }} + + - uses: conda-incubator/setup-miniconda@v3 + with: + auto-activate-base: false + activate-environment: "" + channels: conda-forge + conda-remove-defaults: "true" + + - name: Install C++ dependencies + run: | + if [[ "$PLATFORM" == "Win32" ]]; then export CONDA_SUBDIR=win-32; fi + deps="mpir=3.0.0 vc=14" + if [[ "$WITH_MPFR" == "yes" ]]; then deps="$deps mpfr=3.1.5"; fi + if [[ "$WITH_MPC" == "yes" ]]; then deps="$deps mpc=1.0.3"; fi + if [[ "$WITH_LLVM" == "yes" ]]; then deps="$deps llvmdev=9.0 zlib"; fi + conda create -p "$DEPS_PREFIX" --yes -c conda-forge $deps + + - name: Install Python dependencies + run: | + python -m pip install pytest cython scikit-build-core cython-cmake setuptools_scm + if [[ "$WITH_NUMPY" != "no" ]]; then python -m pip install numpy; fi + if [[ "$WITH_SYMPY" != "no" ]]; then python -m pip install sympy; fi + + - name: Build and install SymEngine + run: | + git clone https://github.com/symengine/symengine symengine-cpp + cd symengine-cpp + git checkout "$(cat ../symengine_version.txt)" + cmake_args="-DCMAKE_PREFIX_PATH=$DEPS_PREFIX\\Library" + if [[ "$WITH_MPFR" == "yes" ]]; then cmake_args="$cmake_args -DWITH_MPFR=yes"; fi + if [[ "$WITH_MPC" == "yes" ]]; then cmake_args="$cmake_args -DWITH_MPC=yes"; fi + if [[ "$WITH_LLVM" == "yes" ]]; then + cmake_args="$cmake_args -DWITH_LLVM=yes -DMSVC_USE_MT=no" + # LLVMExports.cmake links against a bare "z" (z.lib from conda-forge zlib); + # give its directory to link.exe via LINK. + export LINK="/LIBPATH:$DEPS_PREFIX\\Library\\lib" + fi + cmake -S . -B build -G "Visual Studio 17 2022" -A "$PLATFORM" $cmake_args \ + -DBUILD_SHARED_LIBS=yes -DBUILD_TESTS=no -DBUILD_BENCHMARKS=no \ + -DCMAKE_INSTALL_PREFIX="$SYMENGINE_PREFIX" + cmake --build build --config "$BUILD_TYPE" --target install + + - name: Build symengine.py + run: | + export PATH="$(cygpath -u "$SYMENGINE_PREFIX")/bin:$(cygpath -u "$DEPS_PREFIX")/Library/bin:$PATH" + export SYMENGINE_PY_ADD_PATH_TO_SEARCH_DIRS=1 + export CMAKE_PREFIX_PATH="$SYMENGINE_PREFIX" + python -m pip install -e . --no-build-isolation -Ccmake.build-type=$BUILD_TYPE -vv + + - name: Test + run: | + export PATH="$(cygpath -u "$SYMENGINE_PREFIX")/bin:$(cygpath -u "$DEPS_PREFIX")/Library/bin:$PATH" + export SYMENGINE_PY_ADD_PATH_TO_SEARCH_DIRS=1 + mkdir -p empty && cd empty + python ../bin/test_python.py diff --git a/README.md b/README.md index 95756f45..28099dc1 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@ Python wrappers to the C++ library [SymEngine](https://github.com/symengine/syme a fast C++ symbolic manipulation library. [![Build Status](https://travis-ci.org/symengine/symengine.py.svg)](https://travis-ci.org/symengine/symengine.py) -[![Build status](https://ci.appveyor.com/api/projects/status/sl189l9ck3gd8qvk/branch/master?svg=true)](https://ci.appveyor.com/project/symengine/symengine-py/branch/master) ## Installation diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index e2adebfb..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,114 +0,0 @@ -version: '{build}' - -image: "Visual Studio 2019" - -environment: - global: - PLATFORMTOOLSET: "v142" - - matrix: - - BUILD_TYPE: "Release" - COMPILER: MSVC15 - PLATFORM: "x64" - PYTHON_VERSION: 314-x64 - CONDA_INSTALL_LOCN: C:\\Miniconda38-x64 - WITH_MPFR: yes - WITH_MPC: yes - WITH_LLVM: yes - - BUILD_TYPE: "Release" - COMPILER: MSVC15 - PLATFORM: "Win32" - PYTHON_VERSION: 311 - CONDA_INSTALL_LOCN: C:\\Miniconda38-x64 - WITH_MPFR: yes - WITH_MPC: yes - - BUILD_TYPE: "Release" - COMPILER: MSVC15 - PLATFORM: "x64" - PYTHON_VERSION: 313-x64 - CONDA_INSTALL_LOCN: C:\\Miniconda38-x64 - WITH_MPFR: yes - WITH_MPC: yes - - BUILD_TYPE: "Release" - COMPILER: MSVC15 - PLATFORM: "x64" - PYTHON_VERSION: 312-x64 - CONDA_INSTALL_LOCN: C:\\Miniconda38-x64 - - BUILD_TYPE: "Release" - COMPILER: MSVC15 - PLATFORM: "x64" - PYTHON_VERSION: 314-x64 - WITH_SYMPY: no - CONDA_INSTALL_LOCN: C:\\Miniconda38-x64 - - BUILD_TYPE: "Release" - COMPILER: MSVC15 - PLATFORM: "x64" - PYTHON_VERSION: 311-x64 - WITH_NUMPY: no - CONDA_INSTALL_LOCN: C:\\Miniconda38-x64 - -install: -- set PYTHON_SOURCE_DIR=%CD% -- git clone https://github.com/sympy/symengine symengine-cpp -- if [%PLATFORM%]==[Win32] set "CONDA_SUBDIR=win-32" - -- call %CONDA_INSTALL_LOCN%\Scripts\activate.bat -- set "CONDA_DEPS=mpir=3.0.0 vc=14" -- if [%WITH_MPFR%]==[yes] set "CONDA_DEPS=%CONDA_DEPS% mpfr=3.1.5" -- if [%WITH_MPC%]==[yes] set "CONDA_DEPS=%CONDA_DEPS% mpc=1.0.3" -- if [%WITH_LLVM%]==[yes] set "CONDA_DEPS=%CONDA_DEPS% llvmdev=9.0 zlib" -- set "CONDA_DEPS=%CONDA_DEPS% -c conda-forge" -- if [%BUILD_TYPE%]==[Debug] set "CONDA_DEPS=%CONDA_DEPS% -c symengine/label/debug" -- conda create -n deps --yes %CONDA_DEPS% -- call conda activate deps -- echo %CONDA_PREFIX% -- echo %PATH% -- set "PATH=%PATH%;%CONDA_PREFIX%\\Library\\bin;%CONDA_PREFIX%" -- echo %PATH% - -- set "PATH=C:\Python%PYTHON_VERSION%;C:\Python%PYTHON_VERSION%\Scripts;%PATH%" -- echo %PATH% -- pip install pytest cython scikit-build-core cython-cmake setuptools_scm -- if NOT [%WITH_NUMPY%]==[no] pip install numpy -- if NOT [%WITH_SYMPY%]==[no] pip install sympy - -- set /p commit= Date: Thu, 3 Dec 2026 14:24:07 -0700 Subject: [PATCH 3/3] windows CI: use the setup-python interpreter, not Miniconda's --- .github/workflows/ci.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0bb2a632..d494398d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -324,9 +324,14 @@ jobs: - name: Install Python dependencies run: | - python -m pip install pytest cython scikit-build-core cython-cmake setuptools_scm - if [[ "$WITH_NUMPY" != "no" ]]; then python -m pip install numpy; fi - if [[ "$WITH_SYMPY" != "no" ]]; then python -m pip install sympy; fi + # setup-miniconda puts Miniconda's python first on PATH in login + # shells, so record the setup-python interpreter and use it explicitly. + echo "PY=$(cygpath -u "$pythonLocation")/python.exe" >> "$GITHUB_ENV" + PY="$(cygpath -u "$pythonLocation")/python.exe" + "$PY" -c "import sys, struct; print(sys.version, struct.calcsize('P') * 8, 'bit')" + "$PY" -m pip install pytest cython scikit-build-core cython-cmake setuptools_scm + if [[ "$WITH_NUMPY" != "no" ]]; then "$PY" -m pip install numpy; fi + if [[ "$WITH_SYMPY" != "no" ]]; then "$PY" -m pip install sympy; fi - name: Build and install SymEngine run: | @@ -352,11 +357,11 @@ jobs: export PATH="$(cygpath -u "$SYMENGINE_PREFIX")/bin:$(cygpath -u "$DEPS_PREFIX")/Library/bin:$PATH" export SYMENGINE_PY_ADD_PATH_TO_SEARCH_DIRS=1 export CMAKE_PREFIX_PATH="$SYMENGINE_PREFIX" - python -m pip install -e . --no-build-isolation -Ccmake.build-type=$BUILD_TYPE -vv + "$PY" -m pip install -e . --no-build-isolation -Ccmake.build-type=$BUILD_TYPE -vv - name: Test run: | export PATH="$(cygpath -u "$SYMENGINE_PREFIX")/bin:$(cygpath -u "$DEPS_PREFIX")/Library/bin:$PATH" export SYMENGINE_PY_ADD_PATH_TO_SEARCH_DIRS=1 mkdir -p empty && cd empty - python ../bin/test_python.py + "$PY" ../bin/test_python.py