Skip to content

Commit e8d4149

Browse files
davidhewittmessense
andcommitted
add mingw CI
co-authored-by: messense <[email protected]>
1 parent 4c88c6a commit e8d4149

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed

.github/workflows/ci.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,3 +357,46 @@ jobs:
357357
CIBW_BUILD_VERBOSITY: 1
358358
with:
359359
package-dir: examples/namespace_package
360+
361+
test-mingw:
362+
runs-on: windows-latest
363+
name: ${{ matrix.python-version }} mingw-${{ matrix.arch }}
364+
strategy:
365+
fail-fast: false
366+
matrix:
367+
include: [
368+
{ msystem: MINGW64, arch: x86_64, path: mingw64, rust_target: x86_64-pc-windows-gnu },
369+
{ msystem: MINGW32, arch: i686, path: mingw32, rust_target: i686-pc-windows-gnu }
370+
]
371+
steps:
372+
- uses: actions/checkout@v2
373+
- name: Install MSys2 and dependencies
374+
uses: msys2/setup-msys2@v2
375+
with:
376+
update: true
377+
msystem: ${{ matrix.msystem }}
378+
install: >-
379+
git
380+
mingw-w64-${{ matrix.arch }}-python
381+
mingw-w64-${{ matrix.arch }}-python-pip
382+
mingw-w64-${{ matrix.arch }}-openssl
383+
mingw-w64-${{ matrix.arch }}-toolchain
384+
385+
- uses: actions-rs/toolchain@v1
386+
with:
387+
profile: minimal
388+
toolchain: stable-${{ matrix.rust_target }}
389+
default: true
390+
391+
- name: Install test dependencies
392+
shell: msys2 {0}
393+
run: python -m pip install --upgrade nox pip wheel
394+
395+
- name: Create libpython symlink
396+
shell: msys2 {0}
397+
run: ln -s /${{ matrix.path }}/lib/libpython3.10.dll.a /${{ matrix.path }}/lib/libpython310.dll.a
398+
399+
- name: Test examples
400+
shell: msys2 {0}
401+
run: |
402+
PATH="$PATH:/c/Users/runneradmin/.cargo/bin" nox -s test-mingw

noxfile.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import tarfile
33
from glob import glob
44
from pathlib import Path
5+
from unittest.mock import patch
56

67
import nox
78

@@ -35,3 +36,40 @@ def mypy(session: nox.Session):
3536
def test(session: nox.Session):
3637
session.install("pytest", ".")
3738
session.run("pytest", "setuptools_rust", "tests", *session.posargs)
39+
40+
41+
@nox.session(name="test-mingw")
42+
def test_mingw(session: nox.Session):
43+
# manually re-implemented test-examples to workaround
44+
# https://github.com/wntrblm/nox/issues/630
45+
46+
oldrun = nox.command.run
47+
48+
def newrun(*args, **kwargs):
49+
# suppress "external" error on install
50+
kwargs["external"] = True
51+
oldrun(*args, **kwargs)
52+
53+
def chdir(path: Path):
54+
print(path)
55+
os.chdir(path)
56+
57+
examples = Path(os.path.dirname(__file__)).absolute() / "examples"
58+
59+
with patch.object(nox.command, "run", newrun):
60+
session.install(".")
61+
62+
session.install("--no-build-isolation", str(examples / "hello-world"))
63+
session.run("hello-world")
64+
65+
session.install("pytest", "pytest-benchmark", "beautifulsoup4")
66+
session.install("--no-build-isolation", str(examples / "html-py-ever"))
67+
session.run("pytest", str(examples / "html-py-ever"))
68+
69+
session.install("pytest")
70+
session.install("--no-build-isolation", str(examples / "html-py-ever"))
71+
session.run("pytest", str(examples / "html-py-ever"))
72+
73+
session.install("pytest", "cffi")
74+
session.install("--no-build-isolation", str(examples / "html-py-ever"))
75+
session.run("pytest", str(examples / "html-py-ever"))

0 commit comments

Comments
 (0)