Skip to content

Commit ed4d2c6

Browse files
committed
Merge branch 'Feature_build_system'
2 parents 15d9860 + 2011660 commit ed4d2c6

File tree

20 files changed

+111
-321
lines changed

20 files changed

+111
-321
lines changed

.github/workflows/build.yml

Lines changed: 56 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -16,123 +16,96 @@ jobs:
1616
with:
1717
name: README
1818
path: README.md
19-
test:
19+
build_wheel:
20+
needs: readme
2021
strategy:
2122
matrix:
22-
runs-on: [ubuntu-latest, macos-13, macos-14, windows-latest]
23+
runs-on: [macos-13, macos-14, windows-latest, ubuntu-latest]
2324
fail-fast: false
2425
runs-on: ${{ matrix.runs-on }}
2526
steps:
2627
- uses: actions/checkout@v4
27-
- name: Install Hatch
28-
uses: pypa/hatch@install
29-
- name: Run Test
30-
run: |
31-
hatch run test:install
32-
hatch run test-38:install
33-
hatch run test:run-cov
34-
hatch run test-38:run-cov
35-
hatch run cov:combine
36-
echo '## Test Coverage on ${{ matrix.runs-on }}' >> $GITHUB_STEP_SUMMARY
37-
echo '```' >> $GITHUB_STEP_SUMMARY
38-
hatch -q run cov:report >> $GITHUB_STEP_SUMMARY
39-
echo '```' >> $GITHUB_STEP_SUMMARY
28+
- uses: actions/download-artifact@v4
29+
with:
30+
name: README
31+
path: README
32+
- run: mv README/README.md README.md
33+
- uses: astral-sh/setup-uv@v4
34+
with:
35+
enable-cache: true
36+
cache-dependency-glob: |
37+
**/pyproject.toml
38+
**/setup.py
39+
- run: uvx -p 3.12 cibuildwheel
4040
shell: bash
41-
build_winmac:
41+
- uses: actions/upload-artifact@v4
42+
with:
43+
name: dist-${{ matrix.runs-on }}-${{ strategy.job-index }}
44+
path: ./wheelhouse/*.whl
45+
build_aarch64:
4246
needs: readme
4347
strategy:
4448
matrix:
45-
runs-on: [macos-13, macos-14, windows-latest]
49+
py: ['39', '310', '311', '312', '313']
4650
fail-fast: false
47-
runs-on: ${{ matrix.runs-on }}
51+
runs-on: ubuntu-latest
4852
steps:
4953
- uses: actions/checkout@v4
50-
- uses: actions/setup-python@v5
51-
with:
52-
python-version: |
53-
3.8
54-
3.9
55-
3.10
56-
3.11
57-
3.12
58-
cache: 'pip'
5954
- uses: actions/download-artifact@v4
6055
with:
6156
name: README
6257
path: README
6358
- run: mv README/README.md README.md
64-
- run: pip3.8 wheel . -w dist --no-deps
65-
- run: pip3.9 wheel . -w dist --no-deps
66-
- run: pip3.10 wheel . -w dist --no-deps
67-
- run: pip3.11 wheel . -w dist --no-deps
68-
- run: pip3.12 wheel . -w dist --no-deps
59+
- uses: astral-sh/setup-uv@v4
60+
with:
61+
enable-cache: true
62+
cache-dependency-glob: |
63+
**/pyproject.toml
64+
**/setup.py
65+
- uses: docker/setup-qemu-action@v3
66+
with:
67+
platforms: all
68+
- run: uvx -p 3.12 cibuildwheel
69+
shell: bash
70+
env:
71+
CIBW_BUILD: ${{'cp'}}${{ matrix.py }}${{'-????linux_*64'}}
72+
CIBW_ARCHS_LINUX: aarch64
6973
- uses: actions/upload-artifact@v4
7074
with:
71-
name: dist-${{ matrix.runs-on }}
72-
path: dist
73-
- name: Upload to PyPI
74-
run: |
75-
pip install twine
76-
python -m twine upload -u __token__ -p ${{ secrets.pypi_password }} --skip-existing dist/cpprb-*
77-
if: github.event_name == 'push' && startsWith(github.event.ref,'refs/tags/v')
75+
name: dist-aarch64-${{ matrix.py }}-${{ strategy.job-index }}
76+
path: ./wheelhouse/*.whl
7877
build_targz:
7978
needs: readme
8079
runs-on: ubuntu-latest
8180
steps:
8281
- uses: actions/checkout@v4
83-
- uses: actions/setup-python@v5
84-
with:
85-
python-version: '3.8'
86-
cache: 'pip'
8782
- uses: actions/download-artifact@v4
8883
with:
8984
name: README
9085
path: README
9186
- run: mv README/README.md README.md
92-
- run: python setup.py build_ext sdist
87+
- uses: astral-sh/setup-uv@v4
88+
with:
89+
enable-cache: true
90+
cache-dependency-glob: |
91+
**/pyproject.toml
92+
**/setup.py
93+
- run: uv run --no-project --with build python -m build --sdist
9394
- uses: actions/upload-artifact@v4
9495
with:
9596
name: dist-sdist
96-
path: dist
97-
- run: pip --disable-pip-version-check install twine
98-
- name: Upload to PyPI
99-
run: python -m twine upload -u __token__ -p ${{ secrets.pypi_password }} --skip-existing dist/cpprb-*tar.gz
100-
if: github.event_name == 'push' && startsWith(github.event.ref,'refs/tags/v')
101-
build_manylinux:
97+
path: dist/*.tar.gz
98+
upload:
99+
needs: [build_wheel, build_aarch64, build_targz]
100+
environment: pypi
102101
runs-on: ubuntu-latest
103-
strategy:
104-
matrix:
105-
arch: ["x86_64", "aarch64"]
102+
permissions:
103+
id-token: write
104+
if: github.event_name == 'push' && startsWith(github.event.ref,'refs/tags/v')
106105
steps:
107-
- uses: actions/checkout@v4
108-
- uses: actions/setup-python@v5
109-
with:
110-
python-version: '3'
111-
cache: 'pip'
112-
- uses: docker/setup-qemu-action@v3
113-
if: ${{ matrix.arch }} == "aarch64"
114-
with:
115-
platforms: arm64
116-
- uses: docker/setup-buildx-action@v3
117-
- uses: docker/build-push-action@v5
118-
with:
119-
push: false
120-
build-args: |
121-
ON_CI=1
122-
arch=${{ matrix.arch }}
123-
file: Dockerfile
124-
cache-to: type=gha,mode=max,scope=${{github.ref_name}}
125-
cache-from: type=gha,scope=${{github.ref_name}}
126-
load: true
127-
tags: cpprb/wheel:latest
128-
- run: |
129-
docker create --name wheel cpprb/wheel:latest
130-
docker cp wheel:/dist/. dist/
131-
- uses: actions/upload-artifact@v4
106+
- uses: actions/download-artifact@v4
132107
with:
133-
name: dist-manylinux-${{ matrix.arch }}
108+
pattern: 'dist-*'
134109
path: dist
135-
- run: pip --disable-pip-version-check install twine
136-
- name: Upload to PyPI
137-
run: python -m twine upload -u __token__ -p ${{ secrets.pypi_password }} --skip-existing dist/cpprb-*
138-
if: github.event_name == 'push' && startsWith(github.event.ref,'refs/tags/v')
110+
merge-multiple: true
111+
- uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.coverage*
22
build
33
dist
4+
wheelhouse
45
*egg-info
56
*.so
67
*.c

.gitlab-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ hugo:
6464
script:
6565
- hugo version
6666
- cd site
67-
- hugo -c content -v
67+
- hugo -c content --logLevel info
6868
artifacts:
6969
paths:
7070
- public
@@ -78,7 +78,7 @@ sphinx:
7878
stage: page_build
7979
environment: production
8080
script:
81-
- pip install $(echo dist/*.whl)['all']
81+
- pip install $(echo dist/*.whl) "sphinx" "sphinx_rtd_theme" "sphinx-automodapi"
8282
- sphinx-build -b html sphinx public/api
8383
artifacts:
8484
paths:

.gitmodules

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
[submodule "themes/learn"]
2-
path = site/themes/learn
3-
url = https://github.com/matcornic/hugo-theme-learn.git
1+
[submodule "hugo-theme-relearn"]
2+
path = site/themes/hugo-theme-relearn
3+
url = https://github.com/McShelby/hugo-theme-relearn.git

Dockerfile

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,6 @@ RUN ON_CI=${ON_CI} /opt/python/cp38-cp38/bin/pip wheel . -w /work/wheel --no-dep
2020
auditwheel repair /work/wheel/cpprb-*.whl -w /dist
2121

2222

23-
FROM python:latest AS test
24-
WORKDIR /work
25-
RUN --mount=type=cache,target=/root/.cache/pip \
26-
pip install hatch
27-
COPY pyproject.tom setup.py LICENSE MANIFEST.in .
28-
COPY src src/
29-
RUN hatch env create test
30-
COPY test test/
31-
RUN hatch run test:run-cov && \
32-
hatch run cov:combine && \
33-
hatch run cov:report
34-
35-
3623
FROM scratch AS results
3724
COPY --from=manylinux /dist/cpprb-* /dist/
3825
CMD [""]

MANIFEST.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
include cpprb/*.hh
1+
include src/cpprb/*.hh
2+
exclude test/*

deps.nix

Lines changed: 0 additions & 36 deletions
This file was deleted.

dev-shell.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#! /usr/bin/env nix
22
#! nix --extra-experimental-features ``flakes nix-command`` shell
3-
#! nix --override-input nixpkgs ``github:NixOS/nixpkgs/release-23.11``
4-
#! nix --impure --file deps.nix hatch bash
3+
#! nix -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/branch-off-24.11.tar.gz
4+
#! nix --impure nixpkgs#actionlint nixpkgs#uv
55
#! nix --command bash
66

77
echo 'Enter Dev Shell'

pylintrc

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)