Skip to content

Commit 044842e

Browse files
committed
test: add test for cmake build
1 parent 94b5f0b commit 044842e

3 files changed

Lines changed: 33 additions & 8 deletions

File tree

.github/workflows/tests-with-pydebug.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ env:
3434
PYTHON: "python" # to be updated
3535
PYTHON_TAG: "py3" # to be updated
3636
PYTHON_VERSION: "3" # to be updated
37+
pybind11_VERSION: "stable" # to be updated
3738
PYENV_ROOT: "~/.pyenv" # to be updated
3839
COLUMNS: "128"
3940

@@ -290,10 +291,16 @@ jobs:
290291
github.event_name == 'pull_request' &&
291292
contains(github.event.pull_request.labels.*.name, 'test-with-nightly-pybind11')
292293
run: |
293-
python .github/workflows/set_setup_requires.py
294+
${{ env.PYTHON }} .github/workflows/set_setup_requires.py
294295
echo "::group::pyproject.toml"
295296
cat pyproject.toml
296297
echo "::endgroup::"
298+
echo "pybind11_VERSION=HEAD" | tee -a "${GITHUB_ENV}"
299+
300+
- name: Test buildable without Python frontend
301+
shell: bash
302+
run: |
303+
make cmake-build PYTHON="${{ env.PYTHON }}" && make clean
297304
298305
- name: Install OpTree
299306
run: |

.github/workflows/tests.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ env:
3434
PYTHONUNBUFFERED: "1"
3535
PYTHON: "python" # to be updated
3636
PYTHON_TAG: "py3" # to be updated
37+
pybind11_VERSION: "stable" # to be updated
3738
COLUMNS: "128"
3839

3940
jobs:
@@ -148,10 +149,11 @@ jobs:
148149
github.event_name == 'pull_request' &&
149150
contains(github.event.pull_request.labels.*.name, 'test-with-nightly-pybind11')
150151
run: |
151-
python .github/workflows/set_setup_requires.py
152+
${{ env.PYTHON }} .github/workflows/set_setup_requires.py
152153
echo "::group::pyproject.toml"
153154
cat pyproject.toml
154155
echo "::endgroup::"
156+
echo "pybind11_VERSION=HEAD" | tee -a "${GITHUB_ENV}"
155157
156158
- name: Test installable with C++17
157159
shell: bash
@@ -169,6 +171,21 @@ jobs:
169171
rm -rf venv
170172
)
171173
174+
- name: Test buildable without Python frontend
175+
shell: bash
176+
run: |
177+
ACTIVATION_SCRIPT="venv/bin/activate"
178+
if [[ "${{ runner.os }}" == 'Windows' ]]; then
179+
ACTIVATION_SCRIPT="venv/Scripts/activate"
180+
fi
181+
(
182+
set -x
183+
${{ env.PYTHON }} -m venv venv &&
184+
source "${ACTIVATION_SCRIPT}" &&
185+
make cmake-build && make clean &&
186+
rm -rf venv
187+
)
188+
172189
- name: Install test dependencies
173190
shell: bash
174191
run: |

Makefile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ PATH := $(PATH):$(GOBIN)
2929
PYTHON ?= $(shell command -v python3 || command -v python)
3030
PYTEST ?= $(PYTHON) -X dev -m pytest -Walways
3131
PYTESTOPTS ?=
32+
CMAKE_BUILD_TYPE ?= Debug
3233
CMAKE_CXX_STANDARD ?= 20
3334
OPTREE_CXX_WERROR ?= ON
3435
_GLIBCXX_USE_CXX11_ABI ?= 1
@@ -198,7 +199,7 @@ cmake-configure: cmake-install
198199
cmake --version
199200
cmake -S . -B cmake-build-debug \
200201
--fresh \
201-
-DCMAKE_BUILD_TYPE=Debug \
202+
-DCMAKE_BUILD_TYPE="$(CMAKE_BUILD_TYPE)" \
202203
-DCMAKE_CXX_STANDARD="$(CMAKE_CXX_STANDARD)" \
203204
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
204205
-DPython_EXECUTABLE="$(PYTHON)" \
@@ -233,21 +234,21 @@ addlicense: addlicense-install
233234

234235
.PHONY: docstyle
235236
docstyle: docs-install
236-
make -C docs clean || true
237-
$(PYTHON) -m doc8 docs && make -C docs html SPHINXOPTS="-W"
237+
$(MAKE) -C docs clean || true
238+
$(PYTHON) -m doc8 docs && $(MAKE) -C docs html SPHINXOPTS="-W"
238239

239240
.PHONY: docs
240241
docs: docs-install
241242
$(PYTHON) -m sphinx_autobuild --watch $(PROJECT_PATH) --open-browser docs/source docs/build
242243

243244
.PHONY: spelling
244245
spelling: docs-install
245-
make -C docs clean || true
246-
make -C docs spelling SPHINXOPTS="-W"
246+
$(MAKE) -C docs clean || true
247+
$(MAKE) -C docs spelling SPHINXOPTS="-W"
247248

248249
.PHONY: clean-docs
249250
clean-docs:
250-
make -C docs clean || true
251+
$(MAKE) -C docs clean || true
251252

252253
# Utility Functions
253254

0 commit comments

Comments
 (0)