Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: make mingw builds robust to version bumps #501

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -399,16 +399,17 @@ jobs:

- name: Install test dependencies
shell: msys2 {0}
run: python -m pip install --upgrade nox pip
run: python -m pip install --upgrade pip 'nox @ git+https://github.com/davidhewitt/nox.git@mingw-fix'

- name: Create libpython symlink
shell: msys2 {0}
run: ln -s /${{ matrix.path }}/lib/libpython3.11.dll.a /${{ matrix.path }}/lib/libpython311.dll.a
run: |
PYTHON_MINOR_VER=$(python -c "import sys; print(sys.version_info.minor)")
ln -s /${{ matrix.path }}/lib/libpython3.${PYTHON_MINOR_VER}.dll.a /${{ matrix.path }}/lib/libpython3${PYTHON_MINOR_VER}.dll.a

- name: Test examples
shell: msys2 {0}
run: |
PATH="$PATH:/c/Users/runneradmin/.cargo/bin" nox -s test-mingw
run: PATH="$PATH:/c/Users/runneradmin/.cargo/bin" nox -s test-examples

test-emscripten:
name: Test Emscripten
Expand Down
40 changes: 0 additions & 40 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from inspect import cleandoc as heredoc
from glob import glob
from pathlib import Path
from unittest.mock import patch

import nox
import nox.command
Expand Down Expand Up @@ -156,45 +155,6 @@ def test(session: nox.Session):
session.run("pytest", "setuptools_rust", "tests", *session.posargs)


@nox.session(name="test-mingw")
def test_mingw(session: nox.Session):
# manually re-implemented test-examples to workaround
# https://github.com/wntrblm/nox/issues/630

oldrun = nox.command.run

def newrun(*args, **kwargs):
# suppress "external" error on install
kwargs["external"] = True
oldrun(*args, **kwargs)

examples = Path(os.path.dirname(__file__)).absolute() / "examples"

with patch.object(nox.command, "run", newrun):
session.install(".")

session.install("--no-build-isolation", str(examples / "hello-world"))
session.run("print-hello")
session.run("sum-cli", "5", "7")
session.run("rust-demo", "5", "7")

session.install("pytest", "pytest-benchmark", "beautifulsoup4")
session.install("--no-build-isolation", str(examples / "html-py-ever"))
session.run("pytest", str(examples / "html-py-ever"))

session.install("--no-build-isolation", str(examples / "namespace_package"))
session.run("pytest", str(examples / "namespace_package"))

try:
session.install("cffi", "--only-binary=cffi")
except nox.command.CommandFailed:
# no compatible cffi currently available on mingw
pass
else:
session.install("--no-build-isolation", str(examples / "rust_with_cffi"))
session.run("pytest", str(examples / "rust_with_cffi"))


@nox.session(name="test-examples-emscripten")
def test_examples_emscripten(session: nox.Session):
session.install(".", "build")
Expand Down
Loading