Skip to content

Commit dce290a

Browse files
authored
Mono CI (#5)
* Add explicit paths for Mono on Darwin and Windows * Install Mono in Windows runners * Full paths for Windows and macOS mono libs * Pass configuration for Mono through * Cache chocolatey downloads
1 parent 299dfc0 commit dce290a

File tree

3 files changed

+34
-3
lines changed

3 files changed

+34
-3
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,35 @@ jobs:
1515

1616
steps:
1717
- uses: actions/checkout@v2
18+
1819
- name: Set up Python ${{ matrix.python }}
1920
uses: actions/setup-python@v2
2021
with:
2122
python-version: ${{ matrix.python }}
23+
2224
- name: Install dependencies
2325
run: |
2426
python -m pip install --upgrade pip
2527
pip install pytest cffi
28+
2629
- name: Build
2730
run: |
2831
pip install -e .
32+
33+
- name: Cache Mono
34+
if: runner.os == 'Windows'
35+
uses: actions/cache@v2
36+
with:
37+
path: ${{ env.TEMP }}\chocolatey
38+
key: ${{ runner.os }}-chocolatey
39+
restore-keys: |
40+
${{ runner.os }}-chocolatey
41+
42+
- name: Install Mono
43+
if: runner.os == 'Windows'
44+
run: |
45+
choco install -y mono
46+
2947
- name: Test with pytest
3048
run: |
3149
pytest

clr_loader/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def __getitem__(self, path):
5353
def get_mono(domain=None, config_file=None, path=None, gc=None):
5454
from .mono import Mono
5555

56-
impl = Mono(domain=domain)
56+
impl = Mono(domain=domain, config_file=config_file, path=path, gc=gc)
5757
return Runtime(impl)
5858

5959

tests/test_common.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,24 @@ def build_example(tmpdir_factory, framework):
2121
return out
2222

2323

24-
@pytest.mark.xfail
2524
def test_mono(example_netstandard):
2625
from clr_loader import get_mono
2726

28-
mono = get_mono()
27+
if sys.platform == 'win32':
28+
if sys.maxsize > 2**32:
29+
prog_files = os.environ.get("ProgramFiles")
30+
else:
31+
prog_files = os.environ.get("ProgramFiles(x86)")
32+
33+
path = fr"{prog_files}\Mono\bin\mono-2.0-sgen.dll"
34+
35+
elif sys.platform == "darwin":
36+
path = "/Library/Frameworks/Mono.framework/Versions/Current/lib/libmono-2.0.dylib"
37+
38+
else:
39+
path = None
40+
41+
mono = get_mono(path=path)
2942
asm = mono.get_assembly(os.path.join(example_netstandard, "example.dll"))
3043

3144
run_tests(asm)

0 commit comments

Comments
 (0)