Skip to content

Commit 7c534a1

Browse files
authored
Merge pull request #35 from python-project-templates/tkp/cpp
Reenable cpp template with hatch-cpp
2 parents 81e8acd + 15ee989 commit 7c534a1

31 files changed

+580
-1490
lines changed

cpp/.github/workflows/build.yml

-482
This file was deleted.

cpp/.github/workflows/build.yml.jinja

+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
name: Build Status
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
tags:
8+
- v*
9+
paths-ignore:
10+
- LICENSE
11+
- README.md
12+
pull_request:
13+
branches:
14+
- main
15+
workflow_dispatch:
16+
17+
concurrency:
18+
group: {% raw %}${{ github.workflow }}-${{ github.head_ref || github.run_id }}{% endraw %}
19+
cancel-in-progress: true
20+
21+
permissions:
22+
contents: read
23+
checks: write
24+
pull-requests: write
25+
26+
jobs:
27+
build:
28+
runs-on: {% raw %}${{ matrix.os }}{% endraw %}
29+
30+
strategy:
31+
matrix:
32+
os: [ubuntu-latest, macos-latest, windows-latest]
33+
python-version: ["3.9", "3.10", "3.11", "3.12"]
34+
cibuildwheel: ["cp39", "cp310", "cp311", "cp312"]
35+
exclude:
36+
- python-version: "3.9"
37+
cibuildwheel: "cp310"
38+
- python-version: "3.9"
39+
cibuildwheel: "cp311"
40+
- python-version: "3.9"
41+
cibuildwheel: "cp312"
42+
- python-version: "3.10"
43+
cibuildwheel: "cp39"
44+
- python-version: "3.10"
45+
cibuildwheel: "cp311"
46+
- python-version: "3.10"
47+
cibuildwheel: "cp312"
48+
- python-version: "3.11"
49+
cibuildwheel: "cp39"
50+
- python-version: "3.11"
51+
cibuildwheel: "cp310"
52+
- python-version: "3.11"
53+
cibuildwheel: "cp312"
54+
- python-version: "3.12"
55+
cibuildwheel: "cp39"
56+
- python-version: "3.12"
57+
cibuildwheel: "cp310"
58+
- python-version: "3.12"
59+
cibuildwheel: "cp311"
60+
61+
steps:
62+
- uses: actions/checkout@v4
63+
64+
- name: Set up Python {% raw %}${{ matrix.python-version }}{% endraw %}
65+
uses: actions/setup-python@v5
66+
with:
67+
python-version: {% raw %}${{ matrix.python-version }}{% endraw %}
68+
cache: 'pip'
69+
cache-dependency-path: 'pyproject.toml'
70+
71+
- name: Install dependencies
72+
run: make develop
73+
if: matrix.os != 'windows-latest'
74+
75+
- name: Install dependencies
76+
run: |
77+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
78+
make develop
79+
shell: cmd
80+
if: matrix.os == 'windows-latest'
81+
82+
- name: Lint
83+
run: make lint
84+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9'
85+
86+
- name: Checks
87+
run: make checks
88+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9'
89+
90+
- name: Install build dependencies
91+
run: pip install cibuildwheel
92+
93+
- name: Build (Linux)
94+
run: make build-cibw
95+
env:
96+
CIBW_BUILD: {% raw %}"${{ matrix.cibuildwheel }}-manylinux*"{% endraw %}
97+
CIBW_BUILD_VERBOSITY: 3
98+
if: matrix.os == 'ubuntu-latest'
99+
100+
- name: Build (Macos)
101+
run: make build-cibw
102+
env:
103+
CIBW_BUILD: {% raw %}"${{ matrix.cibuildwheel }}-macos*"{% endraw %}
104+
CIBW_BUILD_VERBOSITY: 3
105+
if: matrix.os == 'macos-latest'
106+
107+
- name: Build (Windows)
108+
run: make build-cibw
109+
env:
110+
CIBW_BUILD: {% raw %}"${{ matrix.cibuildwheel }}-win_amd64"{% endraw %}
111+
CIBW_BEFORE_ALL: call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
112+
if: matrix.os == 'windows-latest'
113+
114+
- name: Test
115+
run: make coverage
116+
117+
- name: Upload test results (Python)
118+
uses: actions/upload-artifact@v4
119+
with:
120+
name: {% raw %}test-results-${{ matrix.os }}-${{ matrix.python-version }}{% endraw %}
121+
path: junit.xml
122+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9'
123+
124+
- name: Publish Unit Test Results
125+
uses: EnricoMi/publish-unit-test-result-action@v2
126+
with:
127+
files: '**/junit.xml'
128+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9'
129+
130+
- name: Upload coverage
131+
uses: codecov/codecov-action@v5
132+
with:
133+
token: {% raw %}${{ secrets.CODECOV_TOKEN }}{% endraw %}
134+
135+
- uses: actions/upload-artifact@v4
136+
with:
137+
name: {% raw %}dist-${{matrix.os}}-${{matrix.python-version}}{% endraw %}
138+
path: dist

cpp/.gitignore.jinja

+151
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.a
8+
*.so
9+
*.obj
10+
*.dll
11+
*.exp
12+
*.lib
13+
14+
# Distribution / packaging
15+
.Python
16+
build/
17+
develop-eggs/
18+
dist/
19+
downloads/
20+
eggs/
21+
.eggs/
22+
lib/
23+
lib64/
24+
parts/
25+
sdist/
26+
var/
27+
wheels/
28+
pip-wheel-metadata/
29+
share/python-wheels/
30+
*.egg-info/
31+
.installed.cfg
32+
*.egg
33+
MANIFEST
34+
35+
# PyInstaller
36+
# Usually these files are written by a python script from a template
37+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
38+
*.manifest
39+
*.spec
40+
41+
# Installer logs
42+
pip-log.txt
43+
pip-delete-this-directory.txt
44+
45+
# Unit test / coverage reports
46+
htmlcov/
47+
.tox/
48+
.nox/
49+
.coverage
50+
.coverage.*
51+
.cache
52+
nosetests.xml
53+
coverage.xml
54+
junit.xml
55+
*.cover
56+
*.py,cover
57+
.hypothesis/
58+
.pytest_cache/
59+
60+
# Translations
61+
*.mo
62+
*.pot
63+
64+
# Django stuff:
65+
*.log
66+
local_settings.py
67+
db.sqlite3
68+
db.sqlite3-journal
69+
70+
# Flask stuff:
71+
instance/
72+
.webassets-cache
73+
74+
# Scrapy stuff:
75+
.scrapy
76+
77+
# PyBuilder
78+
target/
79+
80+
# IPython
81+
profile_default/
82+
ipython_config.py
83+
84+
# pyenv
85+
.python-version
86+
87+
# pipenv
88+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91+
# install all needed dependencies.
92+
#Pipfile.lock
93+
94+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95+
__pypackages__/
96+
97+
# Celery stuff
98+
celerybeat-schedule
99+
celerybeat.pid
100+
101+
# SageMath parsed files
102+
*.sage.py
103+
104+
# Environments
105+
.env
106+
.venv
107+
env/
108+
venv/
109+
ENV/
110+
env.bak/
111+
venv.bak/
112+
113+
# Spyder project settings
114+
.spyderproject
115+
.spyproject
116+
117+
# Rope project settings
118+
.ropeproject
119+
120+
# mkdocs documentation
121+
/site
122+
123+
# mypy
124+
.mypy_cache/
125+
.dmypy.json
126+
dmypy.json
127+
128+
# Pyre type checker
129+
.pyre/
130+
131+
# Documentation
132+
docs/_build/
133+
/site
134+
docs/api
135+
docs/index.md
136+
_template/labextension
137+
138+
# JS
139+
js/node_modules
140+
js/dist
141+
{{module}}/extension
142+
143+
# Jupyter
144+
.ipynb_checkpoints
145+
.autoversion
146+
147+
# Mac
148+
.DS_Store
149+
150+
# Rust
151+
target

0 commit comments

Comments
 (0)