Skip to content

Commit 2b1d44b

Browse files
authored
Merge pull request #11 from ThePituLegend/python
Improve Python bindings and Windows&Apple Silicon support
2 parents a144e6d + 0d70f31 commit 2b1d44b

File tree

240 files changed

+7730
-1783
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

240 files changed

+7730
-1783
lines changed

.github/workflows/build_and_test.yaml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
2-
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
31
name: Build and Test
42

53
on:
64
push:
5+
branches: [ main ]
76
paths-ignore: # Skip the workflow if only documentation files are changed
87
- '**/*.md'
98
- '**/LICENSE'
@@ -16,16 +15,21 @@ on:
1615

1716
jobs:
1817
Build-and-Test:
18+
name: Build and Test on ${{ matrix.os }} with ${{ matrix.compiler.cpp }}
1919
runs-on: ${{ matrix.os }}
2020

2121
strategy:
22-
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
23-
# fail-fast: false
24-
2522
matrix:
26-
os: [ubuntu-22.04, macos-13]
23+
os: [ubuntu-24.04, macos-13, macos-14, windows-2022]
2724
build_type: [Debug]
28-
compiler: [ {cpp: g++, c: gcc}, {cpp: clang++, c: clang} ]
25+
compiler: [ {cpp: g++, c: gcc}, {cpp: clang++, c: clang}, {cpp: cl, c: cl} ]
26+
exclude:
27+
- os: ubuntu-24.04
28+
compiler: {cpp: cl, c: cl}
29+
- os: macos-13
30+
compiler: {cpp: cl, c: cl}
31+
- os: macos-14
32+
compiler: {cpp: cl, c: cl}
2933

3034
steps:
3135
- uses: actions/checkout@v4
@@ -50,12 +54,12 @@ jobs:
5054
-S ${{ github.workspace }}
5155
5256
- name: Build
53-
run: cmake --build ${{ steps.strings.outputs.build-dir }} --config ${{ matrix.build_type }} --parallel 2
57+
run: cmake --build ${{ steps.strings.outputs.build-dir }} --config ${{ matrix.build_type }} --parallel 4
5458

5559
- name: Install
56-
run: sudo cmake --install ${{ steps.strings.outputs.build-dir }} --config ${{ matrix.build_type }} # Test if install works
60+
run: cmake --install ${{ steps.strings.outputs.build-dir }} --config ${{ matrix.build_type }} --prefix ./test-install
5761

5862
- name: Run Tests
59-
run: |
60-
cd ${{ steps.strings.outputs.build-dir }}
61-
ctest --build-config ${{ matrix.build_type }} --output-on-failure -E edlib_tests
63+
shell: bash
64+
working-directory: ${{ steps.strings.outputs.build-dir }}
65+
run: ctest --build-config ${{ matrix.build_type }} --parallel 4 --output-on-failure -E edlib_tests
Lines changed: 74 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,32 @@
1+
name: Handle Release
2+
13
on:
24
release:
35
types: [created]
4-
name: Handle Release
6+
workflow_dispatch:
7+
58
jobs:
6-
Publish-Release-Binaries:
7-
runs-on: ubuntu-latest
9+
Build-Release-Binaries:
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
matrix:
13+
include:
14+
- os: ubuntu-24.04
15+
label: linux.x86_64
16+
simd: true
17+
ext: ""
18+
- os: macos-13
19+
label: darwin.x86_64
20+
simd: true
21+
ext: ""
22+
- os: macos-14
23+
label: darwin.aarch64
24+
simd: false
25+
ext: ""
26+
- os: windows-2022
27+
label: windows.x86_64
28+
simd: true
29+
ext: ".exe"
830

931
steps:
1032
- name: Checkout the repository
@@ -13,50 +35,82 @@ jobs:
1335
fetch-depth: 1
1436
submodules: recursive
1537

16-
- name: Set reusable strings
38+
- name: Set reusable paths
1739
id: strings
1840
shell: bash
1941
run: |
2042
echo "build-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
2143
echo "bin-dir=${{ github.workspace }}/bin" >> "$GITHUB_OUTPUT"
44+
echo "release-dir=${{ github.workspace }}/bin/release" >> "$GITHUB_OUTPUT"
45+
46+
- name: Create release directory
47+
run: mkdir -p ${{ steps.strings.outputs.release-dir }}
2248

23-
- name: Configure CMake (w/ vector support)
49+
- name: Configure CMake (SIMD)
50+
if: matrix.simd == true
2451
run: >
2552
cmake -B ${{ steps.strings.outputs.build-dir }}
2653
-DQUICKED_NONATIVE=ON
54+
${{ matrix.os == 'macos-14' && '-DCMAKE_APPLE_SILICON_PROCESSOR=arm64' || '' }}
2755
-S ${{ github.workspace }}
2856
29-
- name: Build (w/ vector support)
30-
run: cmake --build ${{ steps.strings.outputs.build-dir }} --config Release --parallel 2
57+
- name: Build (SIMD)
58+
if: matrix.simd == true
59+
run: cmake --build ${{ steps.strings.outputs.build-dir }} --config Release --parallel 4
3160

32-
- name: Move the target artifacts (w/ vector support)
61+
- name: Move artifacts (SIMD)
62+
if: matrix.simd == true
63+
shell: bash
3364
run: |
34-
mkdir -p ${{ steps.strings.outputs.bin-dir }}/release
35-
mv ${{ steps.strings.outputs.bin-dir }}/align_benchmark ${{ steps.strings.outputs.bin-dir }}/release/align_benchmark-x86_64-SIMD
36-
mv ${{ steps.strings.outputs.bin-dir }}/generate_dataset ${{ steps.strings.outputs.bin-dir }}/release/generate_dataset-x86_64-SIMD
65+
mv "${{ steps.strings.outputs.bin-dir }}/align_benchmark${{ matrix.ext }}" \
66+
"${{ steps.strings.outputs.release-dir }}/align_benchmark-${{ matrix.label }}-SIMD${{ matrix.ext }}"
67+
mv "${{ steps.strings.outputs.bin-dir }}/generate_dataset${{ matrix.ext }}" \
68+
"${{ steps.strings.outputs.release-dir }}/generate_dataset-${{ matrix.label }}-SIMD${{ matrix.ext }}"
3769
3870
- name: Clean
71+
if: matrix.simd == true
3972
run: cmake --build ${{ steps.strings.outputs.build-dir }} --target clean
4073

41-
- name: Configure CMake (w/o vector support)
74+
- name: Configure CMake (Scalar)
4275
run: >
4376
cmake -B ${{ steps.strings.outputs.build-dir }}
4477
-DQUICKED_NONATIVE=ON
4578
-DQUICKED_FORCESCALAR=ON
79+
${{ matrix.os == 'macos-14' && '-DCMAKE_APPLE_SILICON_PROCESSOR=arm64' || '' }}
4680
-S ${{ github.workspace }}
4781
48-
- name: Build (w/o vector support)
49-
run: cmake --build ${{ steps.strings.outputs.build-dir }} --config Release --parallel 2
82+
- name: Build (Scalar)
83+
run: cmake --build ${{ steps.strings.outputs.build-dir }} --config Release --parallel 4
5084

51-
- name: Move the target artifacts (w/o vector support)
85+
- name: Move artifacts (Scalar)
86+
shell: bash
5287
run: |
53-
mkdir -p ${{ steps.strings.outputs.bin-dir }}/release
54-
mv ${{ steps.strings.outputs.bin-dir }}/align_benchmark ${{ steps.strings.outputs.bin-dir }}/release/align_benchmark-x86_64
55-
mv ${{ steps.strings.outputs.bin-dir }}/generate_dataset ${{ steps.strings.outputs.bin-dir }}/release/generate_dataset-x86_64
88+
mv "${{ steps.strings.outputs.bin-dir }}/align_benchmark${{ matrix.ext }}" \
89+
"${{ steps.strings.outputs.release-dir }}/align_benchmark-${{ matrix.label }}${{ matrix.ext }}"
90+
mv "${{ steps.strings.outputs.bin-dir }}/generate_dataset${{ matrix.ext }}" \
91+
"${{ steps.strings.outputs.release-dir }}/generate_dataset-${{ matrix.label }}${{ matrix.ext }}"
92+
93+
- name: Upload per-platform artifacts
94+
uses: actions/upload-artifact@v4
95+
with:
96+
name: release-${{ matrix.label }}
97+
path: ${{ steps.strings.outputs.release-dir }}/*
98+
99+
Upload-Release-Binaries:
100+
runs-on: ubuntu-latest
101+
needs: Build-Release-Binaries
102+
103+
steps:
104+
- name: Download all release artifacts
105+
uses: actions/download-artifact@v4
106+
with:
107+
pattern: release-*
108+
merge-multiple: true
109+
path: ./all_binaries
56110

57-
- name: Upload the artifacts
111+
- name: Upload the artifacts to the release
58112
uses: skx/github-action-publish-binaries@master
59113
env:
60114
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61115
with:
62-
args: '${{ steps.strings.outputs.bin-dir }}/release/*'
116+
args: './all_binaries/*'
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Build Python Wheels
2+
3+
on:
4+
release:
5+
types: [created]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build_wheels:
10+
name: Build wheels on ${{ matrix.os }}
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ubuntu-24.04, macos-13, macos-14, windows-2022] # Macos 13 (Intel) / Macos 14 (Apple Silicon)
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Build wheels
20+
uses: pypa/[email protected]
21+
env:
22+
# Pass Apple Silicon architecture to CMake when on macos-14
23+
CIBW_ENVIRONMENT: CMAKE_ARGS="-DQUICKED_NONATIVE=ON ${{ matrix.os == 'macos-14' && '-DCMAKE_APPLE_SILICON_PROCESSOR=arm64' || '' }}"
24+
25+
- uses: actions/upload-artifact@v4
26+
with:
27+
name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }}
28+
path: ./wheelhouse/*.whl
29+
30+
make_sdist:
31+
name: Make SDist
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 0
37+
38+
- name: Build SDist
39+
run: pipx run build --sdist
40+
41+
- uses: actions/upload-artifact@v4
42+
with:
43+
name: cibw-sdist
44+
path: dist/*.tar.gz
45+
46+
upload_all:
47+
needs: [build_wheels, make_sdist]
48+
environment: PyPI
49+
permissions:
50+
id-token: write
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/download-artifact@v4
54+
with:
55+
pattern: cibw-*
56+
path: dist
57+
merge-multiple: true
58+
59+
- uses: pypa/gh-action-pypi-publish@release/v1

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@ build
22
.built
33
lib
44
bin
5+
dist
6+
wheelhouse
7+
.vscode
8+
Testing

0 commit comments

Comments
 (0)