Skip to content

Commit 6b122ef

Browse files
committed
Expand CI, enable windows testing
1 parent 712f29e commit 6b122ef

File tree

5 files changed

+22
-14
lines changed

5 files changed

+22
-14
lines changed

.copier-answers.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changes here will be overwritten by Copier
22
_commit: 81e8acd
3-
_src_path: git@github.com:python-project-templates/base.git
3+
_src_path: https://github.com/python-project-templates/base.git
44
add_extension: python
55
66
github: python-project-templates

.github/workflows/build.yml

+13-5
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ jobs:
2929

3030
strategy:
3131
matrix:
32-
os: [ubuntu-latest, macos-latest]
33-
python-version: ["3.9"]
32+
os: [ubuntu-latest, macos-latest, windows-latest]
33+
python-version: ["3.9", "3.10", "3.11", "3.12"]
3434

3535
steps:
3636
- uses: actions/checkout@v4
@@ -56,7 +56,15 @@ jobs:
5656

5757
- name: Test
5858
run: make coverage
59-
59+
if: matrix.os != 'windows-latest'
60+
61+
- name: Test
62+
run: |
63+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
64+
make coverage
65+
shell: cmd
66+
if: matrix.os == 'windows-latest'
67+
6068
- name: Upload test results (Python)
6169
uses: actions/upload-artifact@v4
6270
with:
@@ -68,7 +76,7 @@ jobs:
6876
uses: EnricoMi/publish-unit-test-result-action@v2
6977
with:
7078
files: '**/junit.xml'
71-
if: matrix.os == 'ubuntu-latest'
79+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9'
7280

7381
- name: Upload coverage
7482
uses: codecov/codecov-action@v5
@@ -82,4 +90,4 @@ jobs:
8290
with:
8391
name: dist-${{matrix.os}}
8492
path: dist
85-
if: matrix.os == 'ubuntu-latest'
93+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9'

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ deep-clean: ## clean everything from the repository
9999
git clean -fdx
100100

101101
clean: ## clean the repository
102-
rm -rf .coverage coverage cover htmlcov logs build dist *.egg-info
102+
rm -rf .coverage coverage cover htmlcov logs build dist *.egg-info hatch_cpp/tests/*/dist hatch_cpp/tests/*/build hatch_cpp/tests/*/*/*.so hatch_cpp/tests/*/*/*.pyd
103103

104104
############################################################################################
105105

hatch_cpp/plugin.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,13 @@ def initialize(self, version: str, _: dict[str, t.Any]) -> None:
4343
libraries = [HatchCppLibrary(**library_kwargs) for library_kwargs in library_kwargs]
4444
platform = HatchCppPlatform.default()
4545
if config.toolchain == "raw":
46-
# g++ basic-project/basic.cpp -I. -I/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.11/include/python3.11/ -undefined dynamic_lookup -fPIC -shared -o extension.so
4746
build_plan = HatchCppBuildPlan(libraries=libraries, platform=platform)
4847
build_plan.generate()
49-
build_plan.execute(verbose=config.verbose)
48+
if config.verbose:
49+
for command in build_plan.commands:
50+
self._logger.info(command)
51+
build_plan.execute()
52+
5053
# build_kwargs = config.build_kwargs
5154
# if version == "editable":
5255
# build_kwargs = config.editable_build_kwargs or build_kwargs

hatch_cpp/structs.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ def get_flags(self, library: HatchCppLibrary) -> str:
117117
flags += " " + " ".join(f"/LIBPATH:{lib}" for lib in library.library_dirs)
118118
flags += " " + " ".join(f"/D{macro}" for macro in library.define_macros)
119119
flags += " " + " ".join(f"/U{macro}" for macro in library.undef_macros)
120-
flags += f" /Fo{library.name}.obj"
121-
flags += f" /Fe{library.name}.pyd"
120+
flags += f" /Fo{library.name}.pyd"
122121
# clean
123122
while flags.count(" "):
124123
flags = flags.replace(" ", " ")
@@ -138,9 +137,7 @@ def generate(self):
138137
self.commands.append(f"{self.platform.cc} {' '.join(library.sources)} {flags}")
139138
return self.commands
140139

141-
def execute(self, verbose: bool = True):
140+
def execute(self):
142141
for command in self.commands:
143-
if verbose:
144-
print(f"Running command: {command}")
145142
system(command)
146143
return self.commands

0 commit comments

Comments
 (0)