Skip to content

Commit f76ff75

Browse files
committed
Stabilize CI and workflow build paths
1 parent 2a34f3d commit f76ff75

File tree

6 files changed

+128
-173
lines changed

6 files changed

+128
-173
lines changed

.github/workflows/c-cpp.yml

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,10 @@
1-
name: C/C++ CI
1+
name: Legacy C/C++ workflow (manual only)
22

33
on:
4-
push:
5-
branches: [ "claude/write-implementation-MglRZ" ]
6-
pull_request:
7-
branches: [ "claude/write-implementation-MglRZ" ]
4+
workflow_dispatch:
85

96
jobs:
10-
build:
11-
7+
deprecated:
128
runs-on: ubuntu-latest
13-
149
steps:
15-
- uses: actions/checkout@v4
16-
- name: configure
17-
run: ./configure
18-
- name: make
19-
run: make
20-
- name: make check
21-
run: make check
22-
- name: make distcheck
23-
run: make distcheck
10+
- run: echo 'Deprecated workflow. Use .github/workflows/ci.yml instead.'

.github/workflows/ci.yml

Lines changed: 82 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,102 @@
1-
name: FlexAIDdS CI (C++20)
1+
name: FlexAID CI
22

33
on:
44
push:
5-
branches: ["claude/implement-todo-item-AJIMS", "main", "master"]
65
pull_request:
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: ci-${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
711

812
jobs:
9-
build:
13+
pure_python_results:
14+
name: Pure Python results tests
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- uses: actions/setup-python@v5
19+
with:
20+
python-version: '3.11'
21+
- name: Install test dependencies
22+
run: |
23+
python -m pip install --upgrade pip
24+
python -m pip install pytest
25+
- name: Run read-only loader tests
26+
run: |
27+
PYTHONPATH=python pytest -q \
28+
python/tests/test_results_io.py \
29+
python/tests/test_results_loader_models.py
30+
31+
cxx_core_build:
32+
name: C++ core build (${{ matrix.name }})
33+
runs-on: ${{ matrix.os }}
1034
strategy:
1135
fail-fast: false
1236
matrix:
1337
include:
14-
- os: ubuntu-latest
15-
compiler: g++
38+
- name: linux-gcc
39+
os: ubuntu-latest
1640
cc: gcc
17-
- os: ubuntu-latest
18-
compiler: clang++
41+
cxx: g++
42+
- name: linux-clang
43+
os: ubuntu-latest
1944
cc: clang
20-
- os: macos-latest
21-
compiler: clang++
45+
cxx: clang++
46+
- name: macos-clang
47+
os: macos-latest
2248
cc: clang
23-
24-
runs-on: ${{ matrix.os }}
25-
49+
cxx: clang++
2650
steps:
2751
- uses: actions/checkout@v4
28-
29-
- name: Install dependencies (Linux)
52+
- name: Install Linux dependencies
3053
if: runner.os == 'Linux'
3154
run: |
32-
sudo apt-get update -qq
33-
sudo apt-get install -y cmake build-essential libomp-dev
34-
35-
- name: Install dependencies (macOS)
55+
sudo apt-get update
56+
sudo apt-get install -y cmake ninja-build libeigen3-dev libomp-dev
57+
- name: Install macOS dependencies
3658
if: runner.os == 'macOS'
37-
run: brew install cmake libomp
38-
39-
- name: Verify C++20 compiler support
40-
run: |
41-
${{ matrix.compiler }} --version
42-
echo '#include <span>
43-
#include <concepts>
44-
template<std::integral T> T id(T x){return x;}
45-
int main(){std::span<int> s; return id(0);}' > /tmp/cxx20_check.cpp
46-
${{ matrix.compiler }} -std=c++20 /tmp/cxx20_check.cpp -o /tmp/cxx20_check
47-
echo "C++20 support confirmed."
48-
59+
run: |
60+
brew install cmake ninja libomp eigen
4961
- name: Configure
50-
env:
51-
CXX: ${{ matrix.compiler }}
52-
CC: ${{ matrix.cc }}
53-
run: |
54-
cmake -B build \
55-
-DCMAKE_BUILD_TYPE=Release \
56-
-DCMAKE_CXX_STANDARD=20 \
57-
-DCMAKE_CXX_STANDARD_REQUIRED=ON \
58-
-DCMAKE_CXX_EXTENSIONS=OFF \
59-
-DFLEXAIDS_USE_OPENMP=ON
60-
62+
shell: bash
63+
run: |
64+
export CC=${{ matrix.cc }}
65+
export CXX=${{ matrix.cxx }}
66+
cmake -S . -B build -G Ninja \
67+
-DCMAKE_BUILD_TYPE=Release \
68+
-DFLEXAIDS_USE_CUDA=OFF \
69+
-DFLEXAIDS_USE_METAL=OFF \
70+
-DBUILD_PYTHON_BINDINGS=OFF
6171
- name: Build
62-
run: cmake --build build --verbose --parallel $(nproc 2>/dev/null || sysctl -n hw.ncpu)
72+
run: cmake --build build --parallel
73+
74+
python_bindings_smoke:
75+
name: Python bindings smoke test
76+
runs-on: ubuntu-latest
77+
steps:
78+
- uses: actions/checkout@v4
79+
- uses: actions/setup-python@v5
80+
with:
81+
python-version: '3.11'
82+
- name: Install build dependencies
83+
run: |
84+
sudo apt-get update
85+
sudo apt-get install -y cmake ninja-build
86+
python -m pip install --upgrade pip
87+
python -m pip install 'pybind11[global]' pytest
88+
- name: Configure Python bindings
89+
run: |
90+
cmake -S . -B build-python -G Ninja \
91+
-DCMAKE_BUILD_TYPE=Release \
92+
-DBUILD_PYTHON_BINDINGS=ON \
93+
-DFLEXAIDS_USE_OPENMP=OFF \
94+
-DFLEXAIDS_USE_EIGEN=OFF \
95+
-DFLEXAIDS_USE_CUDA=OFF \
96+
-DFLEXAIDS_USE_METAL=OFF \
97+
-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${{ github.workspace }}/python/flexaidds
98+
- name: Build Python extension
99+
run: cmake --build build-python --parallel --target _core
100+
- name: Run statmech smoke test
101+
run: |
102+
PYTHONPATH=python pytest -q python/tests/test_statmech_smoke.py
Lines changed: 5 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,10 @@
1-
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
2-
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
3-
name: CMake on multiple platforms
1+
name: Legacy multi-platform workflow (manual only)
42

53
on:
6-
push:
7-
branches: [ "claude/write-implementation-MglRZ" ]
8-
pull_request:
9-
branches: [ "claude/write-implementation-MglRZ" ]
4+
workflow_dispatch:
105

116
jobs:
12-
build:
13-
runs-on: ${{ matrix.os }}
14-
15-
strategy:
16-
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
17-
fail-fast: false
18-
19-
# Set up a matrix to run the following 3 configurations:
20-
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
21-
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
22-
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
23-
#
24-
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
25-
matrix:
26-
os: [ubuntu-latest, windows-latest]
27-
build_type: [Release]
28-
c_compiler: [gcc, clang, cl]
29-
include:
30-
- os: windows-latest
31-
c_compiler: cl
32-
cpp_compiler: cl
33-
- os: ubuntu-latest
34-
c_compiler: gcc
35-
cpp_compiler: g++
36-
- os: ubuntu-latest
37-
c_compiler: clang
38-
cpp_compiler: clang++
39-
exclude:
40-
- os: windows-latest
41-
c_compiler: gcc
42-
- os: windows-latest
43-
c_compiler: clang
44-
- os: ubuntu-latest
45-
c_compiler: cl
46-
7+
deprecated:
8+
runs-on: ubuntu-latest
479
steps:
48-
- uses: actions/checkout@v4
49-
50-
- name: Set reusable strings
51-
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
52-
id: strings
53-
shell: bash
54-
run: |
55-
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
56-
57-
- name: Configure CMake
58-
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
59-
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
60-
run: >
61-
cmake -B ${{ steps.strings.outputs.build-output-dir }}
62-
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
63-
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
64-
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
65-
-S ${{ github.workspace }}
66-
67-
- name: Build
68-
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
69-
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
70-
71-
- name: Test
72-
working-directory: ${{ steps.strings.outputs.build-output-dir }}
73-
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
74-
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
75-
run: ctest --build-config ${{ matrix.build_type }}
10+
- run: echo 'Deprecated workflow. Use .github/workflows/ci.yml instead.'
Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,10 @@
1-
# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage.
2-
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml
3-
name: CMake on a single platform
1+
name: Legacy single-platform workflow (manual only)
42

53
on:
6-
push:
7-
branches: [ "claude/write-implementation-MglRZ" ]
8-
pull_request:
9-
branches: [ "claude/write-implementation-MglRZ" ]
10-
11-
env:
12-
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
13-
BUILD_TYPE: Release
4+
workflow_dispatch:
145

156
jobs:
16-
build:
17-
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
18-
# You can convert this to a matrix build if you need cross-platform coverage.
19-
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
7+
deprecated:
208
runs-on: ubuntu-latest
21-
229
steps:
23-
- uses: actions/checkout@v4
24-
25-
- name: Configure CMake
26-
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
27-
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
28-
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
29-
30-
- name: Build
31-
# Build your program with the given configuration
32-
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
33-
34-
- name: Test
35-
working-directory: ${{github.workspace}}/build
36-
# Execute tests defined by the CMake configuration.
37-
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
38-
run: ctest -C ${{env.BUILD_TYPE}}
39-
10+
- run: echo 'Deprecated workflow. Use .github/workflows/ci.yml instead.'

python/flexaidds/__init__.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
"""flexaidds: Python bindings and read-only analysis helpers for FlexAID∆S."""
22

3-
from ._core import StatMechEngine, Thermodynamics
43
from .models import BindingModeResult, DockingResult, PoseResult
54
from .results import load_results
65

6+
try:
7+
from ._core import StatMechEngine, Thermodynamics
8+
HAS_CORE_BINDINGS = True
9+
except ImportError:
10+
StatMechEngine = None
11+
Thermodynamics = None
12+
HAS_CORE_BINDINGS = False
13+
714
__all__ = [
8-
"StatMechEngine",
9-
"Thermodynamics",
15+
"HAS_CORE_BINDINGS",
1016
"PoseResult",
1117
"BindingModeResult",
1218
"DockingResult",
1319
"load_results",
1420
]
21+
22+
if HAS_CORE_BINDINGS:
23+
__all__.extend(["StatMechEngine", "Thermodynamics"])
24+
1525
__version__ = "0.1.0"
Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
1+
import math
2+
3+
import pytest
4+
15
import flexaidds as fd
26

7+
pytestmark = pytest.mark.skipif(
8+
not fd.HAS_CORE_BINDINGS or fd.StatMechEngine is None,
9+
reason="pybind11 core extension not built",
10+
)
311

4-
def test_statmech_smoke():
5-
engine = fd.StatMechEngine(300.0)
6-
engine.add_sample(-7.0)
12+
13+
def test_statmech_engine_smoke() -> None:
14+
engine = fd.StatMechEngine(temperature=300.0)
15+
engine.add_sample(-7.5)
716
engine.add_sample(-6.0)
17+
engine.add_sample(-5.5, multiplicity=2.0)
18+
819
thermo = engine.compute()
920

10-
assert hasattr(thermo, "free_energy")
11-
assert hasattr(thermo, "mean_energy")
12-
assert hasattr(thermo, "entropy")
13-
assert hasattr(thermo, "heat_capacity")
14-
assert hasattr(thermo, "std_energy")
21+
assert math.isfinite(thermo.free_energy)
22+
assert math.isfinite(thermo.mean_energy)
23+
assert math.isfinite(thermo.entropy)
24+
assert math.isfinite(thermo.heat_capacity)
25+
assert math.isfinite(thermo.std_energy)
26+
assert thermo.free_energy <= thermo.mean_energy

0 commit comments

Comments
 (0)