Skip to content

Commit

Permalink
tentative GH CI fixes
Browse files Browse the repository at this point in the history
remove python env var post tych0#172 merge
ensure pytest runs even when installed as pytest
  • Loading branch information
georgeharker committed Dec 10, 2024
1 parent b9a4d98 commit 4efff12
Showing 1 changed file with 37 additions and 6 deletions.
43 changes: 37 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ GEN=$(CABAL) new-run --minimize-conflict-set -j$(NCPUS) exe:xcffibgen --
VENV=xcffib_venv
PYTHON=$(VENV)/bin/python3
FLAKE=$(VENV)/bin/flake8
PYTEST=pytest-3
ifeq (, $(shell which $(PYTEST)))
PYTEST=pytest
endif


# you should have xcb-proto installed to run this
xcffib: module/*.py xcffib.cabal $(shell find . -path ./test -prune -false -o -name \*.hs)
Expand Down Expand Up @@ -46,7 +51,7 @@ clean:
-rm -rf .pc cabal.project.local*

valgrind: xcffib
valgrind --leak-check=full --show-leak-kinds=definite pytest-3 -v
valgrind --leak-check=full --show-leak-kinds=definite $(PYTEST) -v

newtests:
$(GEN) --input ./test/generator/ --output ./test/generator/
Expand All @@ -62,12 +67,38 @@ htests:
$(CABAL) new-test -j$(NCPUS) --enable-tests

$(VENV): requirements.txt
# the python in $PATH in CI is the python from the matrix, so it is the
# "right" python to start with
python3 -m venv $(VENV)
$(PYTHON) -m pip install -r requirements.txt
# the python in $PATH in CI is the python from the matrix, so it is the
# "right" python to start with
python -m venv $(VENV)
$(PYTHON) -m pip install -r requirements.txt

check-abi:
# check abi precompiled mode
# make a temporary env to test install and ensure we cd somewhere
# we won't pick up the local source xcffib module
$(eval TMPLOC=$(shell mktemp -d))
python -m venv $(TMPLOC)
CC=/bin/false ${TMPLOC}/bin/python -m pip install -v .
${TMPLOC}/bin/python -m pip install pytest pytest-xdist
pushd ${TMPLOC} && \
${TMPLOC}/bin/python -c "import xcffib; assert xcffib.cffi_mode == 'abi_precompiled'" && \
popd
${TMPLOC}/bin/python -m pytest -v --durations=3 -n auto

check-api:
# check abi precompiled mode
# make a temporary env to test install and ensure we cd somewhere
# we won't pick up the local source xcffib module
$(eval TMPLOC=$(shell mktemp -d))
python -m venv ${TMPLOC}
${TMPLOC}/bin/python -m pip install -v .
${TMPLOC}/bin/python -m pip install pytest pytest-xdist
pushd ${TMPLOC} && \
${TMPLOC}/bin/python -c "import xcffib; assert xcffib.cffi_mode == 'abi_precompiled'" && \
popd
${TMPLOC}/bin/python -m pytest -v --durations=3 -n auto \

check: xcffib htests $(VENV) lint
check: xcffib htests $(VENV) lint check-api check-abi
cabal check
$(PYTHON) -m compileall xcffib
$(PYTHON) -m pytest -v --durations=3 -n $(NCPUS)
Expand Down

0 comments on commit 4efff12

Please sign in to comment.