Skip to content

Commit

Permalink
add mingw CI
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Jul 13, 2022
1 parent 9c67fa7 commit 1b8a27e
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -350,3 +350,46 @@ jobs:
CIBW_BUILD_VERBOSITY: 1
with:
package-dir: examples/namespace_package

test-mingw:
runs-on: windows-latest
name: ${{ matrix.python-version }} mingw-${{ matrix.arch }}
strategy:
fail-fast: false
matrix:
include: [
{ msystem: MINGW64, arch: x86_64, path: mingw64, rust_target: x86_64-pc-windows-gnu },
{ msystem: MINGW32, arch: i686, path: mingw32, rust_target: i686-pc-windows-gnu }
]
steps:
- uses: actions/checkout@v2
- name: Install MSys2 and dependencies
uses: msys2/setup-msys2@v2
with:
update: true
msystem: ${{ matrix.msystem }}
install: >-
git
mingw-w64-${{ matrix.arch }}-python
mingw-w64-${{ matrix.arch }}-python-pip
mingw-w64-${{ matrix.arch }}-openssl
mingw-w64-${{ matrix.arch }}-toolchain
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{ matrix.rust-target }}

- name: Install test dependencies
shell: msys2 {0}
run: python -m pip install --upgrade nox pip wheel

- name: Create libpython symlink
shell: msys2 {0}
run: ln -s /${{ matrix.path }}/lib/libpython3.10.dll.a /${{ matrix.path }}/lib/libpython310.dll.a

- name: Test examples
shell: msys2 {0}
run: |
PATH="$PATH:/c/Users/runneradmin/.cargo/bin" nox -s test-mingw
42 changes: 42 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import tarfile
from glob import glob
from pathlib import Path
from unittest.mock import patch

import nox

Expand Down Expand Up @@ -35,3 +36,44 @@ def mypy(session: nox.Session):
def test(session: nox.Session):
session.install("pytest", ".")
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)

def chdir(path: Path):
print(path)
os.chdir(path)

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

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

chdir(examples / "hello-world")
session.install("--no-build-isolation", ".")
session.run("hello-world")

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

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

chdir(examples / "rust_with_cffi")
session.install("pytest", "cffi")
session.install("--no-build-isolation", ".")
session.run("pytest")

0 comments on commit 1b8a27e

Please sign in to comment.