From 9e73ca9ab927682d92ec65a5a9731ee25157b6ef Mon Sep 17 00:00:00 2001 From: "Martin D. Weinberg" Date: Mon, 30 Nov 2026 12:45:05 -0500 Subject: [PATCH 1/2] Modernize CI workflow to match current github-runner environments --- .github/workflows/build.yml | 120 ++++++++++++++++++++++-------------- pyEXP/CMakeLists.txt | 4 +- 2 files changed, 77 insertions(+), 47 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f530765b1..36f284ebe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,71 +1,101 @@ -name: "Build and Test" +name: Build and Test on: push: branches: - - '*' + - '**' pull_request: branches: - main - devel + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }} + cancel-in-progress: true + +defaults: + run: + shell: bash + jobs: exp: strategy: + fail-fast: false matrix: - os: [ubuntu-24.04, ubuntu-22.04] - cc: [gcc, clang] - cxx: [g++, clang++] include: - - cxx: clang++ - cxxflags: -stdlib=libstdc++ - exclude: - - cc: gcc - cxx: clang++ - - cc: clang - cxx: g++ + - os: ubuntu-24.04 + toolchain: GCC 14 + cc: gcc-14 + cxx: g++-14 + packages: gcc-14 g++-14 gfortran-14 + fc: gfortran-14 + - os: ubuntu-24.04 + toolchain: Clang 18 + cc: clang-18 + cxx: clang++-18 + packages: clang-18 libomp-18-dev gfortran-14 + fc: gfortran-14 + - os: ubuntu-26.04 + toolchain: GCC 15 + cc: gcc-15 + cxx: g++-15 + packages: gcc-15 g++-15 gfortran-15 + fc: gfortran-15 + - os: ubuntu-26.04 + toolchain: Clang 22 + cc: clang-22 + cxx: clang++-22 + packages: clang-22 libomp-22-dev gfortran-15 + fc: gfortran-15 - name: "Test pyEXP Build" + name: EXP and pyEXP (${{ matrix.os }}, ${{ matrix.toolchain }}) runs-on: ${{ matrix.os }} + timeout-minutes: 60 steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + submodules: recursive + persist-credentials: false - - name: Install core dependencies - ubuntu - if: runner.os == 'Linux' - run: | - sudo apt-get update - sudo apt-get install -y build-essential libeigen3-dev libfftw3-dev libhdf5-dev libopenmpi-dev libomp-dev python3-numpy + - name: Set up Python + uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 + with: + # The bundled pybind11 2.13 supports Python through 3.13. + python-version: '3.13' - - name: Setup submodule and build + - name: Install dependencies + env: + TOOLCHAIN_PACKAGES: ${{ matrix.packages }} run: | - git submodule update --init --recursive - mkdir -p build/install + sudo apt-get update + read -r -a toolchain_packages <<< "$TOOLCHAIN_PACKAGES" + sudo apt-get install -y make libeigen3-dev libfftw3-dev libhdf5-dev \ + libopenmpi-dev openmpi-bin "${toolchain_packages[@]}" + python -m pip install numpy - - name: Compile EXP - if: runner.os == 'Linux' + - name: Configure EXP env: CC: ${{ matrix.cc }} CXX: ${{ matrix.cxx }} - working-directory: ./build - run: >- - cmake - -DENABLE_NBODY=YES - -DENABLE_PYEXP=YES - -DCMAKE_BUILD_TYPE=Release - -DEigen3_DIR=/usr/include/eigen3/share/eigen3/cmake - -DCMAKE_INSTALL_PREFIX=./install - -DCMAKE_CXX_FLAGS=${{ matrix.cxxflags }} - -Wno-dev - .. + FC: ${{ matrix.fc }} + run: | + python_executable="$(command -v python)" + cmake -S . -B build \ + -DCMAKE_BUILD_TYPE=Release \ + -DENABLE_NBODY=ON -DENABLE_PYEXP=ON -DENABLE_TESTS=ON \ + -DPYBIND11_FINDPYTHON=ON \ + -DPython_EXECUTABLE="$python_executable" \ + -DPython3_EXECUTABLE="$python_executable" \ + -DPYTHON_EXECUTABLE="$python_executable" - - name: Make - working-directory: ./build - run: make -j 4 + - name: Build EXP + run: cmake --build build --parallel 2 - - name: CTest Quick - working-directory: ./build - run: ctest --output-on-failure -L quick - - #- name: CTest Long - #working-directory: ./build - #run: ctest --output-on-failure -L long + - name: Run quick tests + env: + OMP_NUM_THREADS: '2' + run: ctest --test-dir build --output-on-failure --no-tests=error -L '^quick$' diff --git a/pyEXP/CMakeLists.txt b/pyEXP/CMakeLists.txt index 8d8f24d1f..973611bcb 100644 --- a/pyEXP/CMakeLists.txt +++ b/pyEXP/CMakeLists.txt @@ -50,6 +50,6 @@ message("The project has set the following flags: ${cxxflags}") install(TARGETS pyEXP RUNTIME DESTINATION bin - LIBRARY DESTINATION "lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages" - ARCHIVE DESTINATION "lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages") + LIBRARY DESTINATION "lib/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages" + ARCHIVE DESTINATION "lib/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages") From 09aaaa68f7f4e82be6b7450e63b50908ba0995bd Mon Sep 17 00:00:00 2001 From: The9Cat <25960766+The9Cat@users.noreply.github.com> Date: Mon, 30 Nov 2026 18:34:09 +0000 Subject: [PATCH 2/2] Unify Python discovery before pybind11 Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --- CMakeLists.txt | 12 +++++++++--- pyEXP/CMakeLists.txt | 3 --- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0bcc50a97..32a584cd2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -267,6 +267,15 @@ execute_process( include_directories(${PROJECT_SOURCE_DIR}/extern/yaml-cpp/include) if (NOT DISABLE_PYTHON) + if(NOT Python3_EXECUTABLE) + if(Python_EXECUTABLE) + set(Python3_EXECUTABLE "${Python_EXECUTABLE}") + elseif(PYTHON_EXECUTABLE) + set(Python3_EXECUTABLE "${PYTHON_EXECUTABLE}") + endif() + endif() + find_package(Python3 COMPONENTS Interpreter Development) + set(PYTHON_EXECUTABLE "${Python3_EXECUTABLE}") include_directories(${PROJECT_SOURCE_DIR}/extern/pybind11/include) endif() include_directories(${PROJECT_SOURCE_DIR}/extern/QuickDigest5/include) @@ -311,9 +320,6 @@ if(ENABLE_TESTS) endif() # try to find pybind11 and build wrapper python module -if (NOT DISABLE_PYTHON) - find_package(Python3 COMPONENTS Interpreter Development) -endif() message(STATUS "python3 include dirs: ${Python3_INCLUDE_DIRS}") if(Python3_FOUND) set(HAVE_PYTHON3 TRUE) diff --git a/pyEXP/CMakeLists.txt b/pyEXP/CMakeLists.txt index 973611bcb..dfef54add 100644 --- a/pyEXP/CMakeLists.txt +++ b/pyEXP/CMakeLists.txt @@ -1,5 +1,3 @@ -find_package (Python3 COMPONENTS Interpreter Development) - # Default build environment # set(common_LINKLIB OpenMP::OpenMP_CXX MPI::MPI_CXX yaml-cpp @@ -52,4 +50,3 @@ install(TARGETS pyEXP RUNTIME DESTINATION bin LIBRARY DESTINATION "lib/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages" ARCHIVE DESTINATION "lib/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages") -