From d632c3094694f7942e37e13b1ddf928102a8a2e7 Mon Sep 17 00:00:00 2001 From: Marcelo Duarte Date: Mon, 6 Jan 2025 22:23:50 -0300 Subject: [PATCH] ci: fix some build and test issues (#2767) --- .github/workflows/build-wheel.yml | 1 + .github/workflows/ci.yml | 2 +- MANIFEST.in | 2 +- Makefile | 8 ++++---- ci/build-wheel.sh | 22 +++++++++++++++++++--- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-wheel.yml b/.github/workflows/build-wheel.yml index 8342a739c..902683c05 100644 --- a/.github/workflows/build-wheel.yml +++ b/.github/workflows/build-wheel.yml @@ -35,6 +35,7 @@ jobs: {"os": "ubuntu-latest", "arch": "arm64", "tag": "cp3{8,9,10,11,12}-manylinux_aarch64"}, {"os": "ubuntu-latest", "arch": "arm64", "tag": "cp3{8,9,10,11,12}-musllinux_aarch64"}, {"os": "ubuntu-latest", "arch": "ppc64le", "tag": "cp3{8,9,10,11,12}-manylinux_ppc64le"}, + {"os": "windows-latest", "arch": "x86_64", "tag": "cp3{8,9,10,11,12}-win32"}, ] with open(os.environ["GITHUB_OUTPUT"], "a+") as f: print("data="+json.dumps({"include": include}), file=f) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1e54f78b7..0ece6399d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -106,7 +106,7 @@ jobs: if: runner.os == 'Linux' run: | sudo apt-get install -qy alien fakeroot rpm - sudo apt-get install -qy --allow-downgrades cpio=2.13+dfsg-7 + sudo apt-get install -qy --allow-downgrades cpio=2.13+dfsg-7 || true - name: Install dependencies to test run: | diff --git a/MANIFEST.in b/MANIFEST.in index 9650b603f..f0a6fbee1 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -9,5 +9,5 @@ recursive-include cx_Freeze/importshed *.pyi recursive-include cx_Freeze/initscripts *.txt recursive-include doc Makefile *.py *.rst *.txt recursive-include samples *.* -recursive-include source *.c *.rc python.manifest +recursive-include source *.c *.h *.rc python.manifest recursive-include tests *.md *.py *.txt diff --git a/Makefile b/Makefile index 924565cb2..2a4a8f844 100644 --- a/Makefile +++ b/Makefile @@ -38,10 +38,11 @@ ifeq ($(PY_PLATFORM),win-amd64) python -m pip install --upgrade uv --disable-pip-version-check;\ fi else - curl -LsSf https://astral.sh/uv/install.sh | env UV_UNMANAGED_INSTALL="$(HOME)/bin" sh + curl -LsSf https://astral.sh/uv/install.sh | \ + env UV_INSTALL_DIR=="$(HOME)/bin" INSTALLER_NO_MODIFY_PATH=1 sh endif if ! which pre-commit || ! [ -f .git/hooks/pre-commit ]; then\ - UV_RESOLUTION=highest uv pip install --upgrade \ + uv pip install --upgrade \ -r requirements.txt -r requirements-dev.txt -r doc/requirements.txt &&\ uv pip install -e. --no-build-isolation --no-deps --reinstall &&\ pre-commit install --install-hooks --overwrite -t pre-commit;\ @@ -66,7 +67,6 @@ html: pre-commit run blacken-docs $(PRE_COMMIT_OPTIONS);\ pre-commit run build-docs $(PRE_COMMIT_OPTIONS);\ else\ - UV_RESOLUTION=highest \ uv pip install --upgrade -r doc/requirements.txt &&\ $(MAKE) -C doc html;\ fi @@ -83,7 +83,7 @@ doc: html .PHONY: install_pytest install_pytest: ./ci/build-wheel.sh - UV_RESOLUTION=highest uv pip install --upgrade -r tests/requirements.txt + uv pip install --upgrade -r tests/requirements.txt .PHONY: tests tests: install_pytest diff --git a/ci/build-wheel.sh b/ci/build-wheel.sh index 9b2bf337d..355c74c23 100755 --- a/ci/build-wheel.sh +++ b/ci/build-wheel.sh @@ -1,7 +1,23 @@ #!/bin/bash +# install/update uv +if ! [ "$CI" == "true" ]; then + if which uv &>/dev/null; then + uv self -q update + else + curl -LsSf https://astral.sh/uv/install.sh | \ + env UV_INSTALL_DIR="$HOME/bin" INSTALLER_NO_MODIFY_PATH=1 sh + fi +fi + # Python information (platform and version) -PYTHON=python +if ! [ -z "$UV_PYTHON" ]; then + PYTHON=$(uv python find $UV_PYTHON) +elif which python &>/dev/null; then + PYTHON=python +else + exit 1 +fi PY_PLATFORM=$($PYTHON -c "import sysconfig; print(sysconfig.get_platform(), end='')") PY_VERSION=$($PYTHON -c "import sysconfig; print(sysconfig.get_python_version(), end='')") PY_VERSION_FULL=$($PYTHON -c "import sysconfig; print(sysconfig.get_config_var('py_version'), end='')") @@ -73,7 +89,7 @@ _cibuildwheel () { } echo "::group::Install dependencies and build tools" -UV_RESOLUTION=highest uv pip install -r requirements.txt +uv pip install -r requirements.txt VERSION=$(_bump_my_version show current_version) if [[ $VERSION == *-* ]]; then VERSION_OK=$($PYTHON -c "print(''.join('$VERSION'.replace('-','.').rsplit('.',1)), end='')") @@ -109,7 +125,7 @@ echo "::endgroup::" if ! [ "$CI" == "true" ]; then echo "::group::Install cx_Freeze $VERSION_OK" - UV_PYTHON=$UV_PYTHON UV_PRERELEASE=allow \ + UV_PRERELEASE=allow \ uv pip install "cx_Freeze==$VERSION_OK" --no-index --no-deps -f wheelhouse --reinstall echo "::endgroup::" fi