1- name : Build Binaries
1+ name : Build Binaries and Wheels
22
33on :
4- push :
5- tags :
6- - v[0-9]+.[0-9]+.[0-9]+
74 workflow_dispatch :
85
96jobs :
@@ -15,23 +12,24 @@ jobs:
1512 matrix :
1613 build :
1714 # Linux glibc
18- - { NAME: linux-x64-glibc, OS: ubuntu-22.04, TARGET: x86_64-unknown-linux-gnu }
19- - { NAME: linux-x86-glibc, OS: ubuntu-22.04, TARGET: i686-unknown-linux-gnu }
20- - { NAME: linux-arm64-glibc, OS: ubuntu-22.04, TARGET: aarch64-unknown-linux-gnu }
15+ - { NAME: linux-x64-glibc, OS: ubuntu-22.04, TARGET: x86_64-unknown-linux-gnu, BUILD_WHEEL: true }
16+ - { NAME: linux-x86-glibc, OS: ubuntu-22.04, TARGET: i686-unknown-linux-gnu, BUILD_WHEEL: true }
17+ - { NAME: linux-arm64-glibc, OS: ubuntu-22.04, TARGET: aarch64-unknown-linux-gnu, BUILD_WHEEL: true }
2118
22- # Linux musl (fully static)
23- - { NAME: linux-x64-musl, OS: ubuntu-22.04, TARGET: x86_64-unknown-linux-musl }
24- - { NAME: linux-x86-musl, OS: ubuntu-22.04, TARGET: i686-unknown-linux-musl }
25- - { NAME: linux-arm64-musl, OS: ubuntu-22.04, TARGET: aarch64-unknown-linux-musl }
19+ # Linux musl (static)
20+ - { NAME: linux-x64-musl, OS: ubuntu-22.04, TARGET: x86_64-unknown-linux-musl, BUILD_WHEEL: true }
21+ - { NAME: linux-x86-musl, OS: ubuntu-22.04, TARGET: i686-unknown-linux-musl, BUILD_WHEEL: true }
22+ - { NAME: linux-arm64-musl, OS: ubuntu-22.04, TARGET: aarch64-unknown-linux-musl, BUILD_WHEEL: true }
2623
27- # Windows
28- - { NAME: windows-x64-msvc, OS: windows-latest, TARGET: x86_64-pc-windows-msvc }
29- - { NAME: windows-x86-msvc, OS: windows-latest, TARGET: i686-pc-windows-msvc }
30- - { NAME: windows-arm64-msvc, OS: windows-latest, TARGET: aarch64-pc-windows-msvc }
24+ # Windows (MSVC)
25+ - { NAME: windows-x64-msvc, OS: windows-latest, TARGET: x86_64-pc-windows-msvc, BUILD_WHEEL: true }
26+ - { NAME: windows-x86-msvc, OS: windows-latest, TARGET: i686-pc-windows-msvc, BUILD_WHEEL: true }
27+ # ⚠️ Skip Windows ARM64 for wheels (maturin doesn't support it yet)
28+ - { NAME: windows-arm64-msvc, OS: windows-latest, TARGET: aarch64-pc-windows-msvc, BUILD_WHEEL: false }
3129
3230 # macOS
33- - { NAME: darwin-x64, OS: macos-15, TARGET: x86_64-apple-darwin }
34- - { NAME: darwin-arm64, OS: macos-15, TARGET: aarch64-apple-darwin }
31+ - { NAME: darwin-x64, OS: macos-15, TARGET: x86_64-apple-darwin, BUILD_WHEEL: true }
32+ - { NAME: darwin-arm64, OS: macos-15, TARGET: aarch64-apple-darwin, BUILD_WHEEL: true }
3533
3634 steps :
3735 - uses : actions/checkout@v4
4543 if : runner.os == 'Linux'
4644 run : cargo install cross --git https://github.com/cross-rs/cross
4745
46+ # === BUILD RUST BINARY ===
4847 - name : Build binary
4948 shell : bash
5049 run : |
@@ -54,23 +53,55 @@ jobs:
5453 cargo build --release --target ${{ matrix.build.TARGET }}
5554 fi
5655
57- - name : Prepare artifact
56+ # === PREPARE RAW BINARY ARTIFACT ===
57+ - name : Prepare raw binary artifact
5858 shell : bash
5959 run : |
6060 BINARY_NAME="gitcraft"
6161 if [[ "${{ matrix.build.TARGET }}" == *"windows"* ]]; then
6262 BINARY_NAME="${BINARY_NAME}.exe"
6363 cp "target/${{ matrix.build.TARGET }}/release/gitcraft.exe" "./gitcraft-${{ matrix.build.NAME }}.exe"
64- echo "ARTIFACT_FILE =gitcraft-${{ matrix.build.NAME }}.exe" >> $GITHUB_ENV
64+ echo "BINARY_ARTIFACT =gitcraft-${{ matrix.build.NAME }}.exe" >> $GITHUB_ENV
6565 else
6666 cp "target/${{ matrix.build.TARGET }}/release/gitcraft" "./gitcraft-${{ matrix.build.NAME }}"
6767 chmod +x "./gitcraft-${{ matrix.build.NAME }}"
68- echo "ARTIFACT_FILE =gitcraft-${{ matrix.build.NAME }}" >> $GITHUB_ENV
68+ echo "BINARY_ARTIFACT =gitcraft-${{ matrix.build.NAME }}" >> $GITHUB_ENV
6969 fi
7070
71- - name : Upload binary as artifact
71+ - name : Upload raw binary artifact
7272 uses : actions/upload-artifact@v4
7373 with :
7474 name : binary-${{ matrix.build.NAME }}
75- path : ${{ env.ARTIFACT_FILE }}
75+ path : ${{ env.BINARY_ARTIFACT }}
76+ if-no-files-found : error
77+
78+ # === BUILD PYTHON WHEEL (if enabled) ===
79+ - name : Setup Python for maturin
80+ if : matrix.build.BUILD_WHEEL == true
81+ uses : actions/setup-python@v5
82+ with :
83+ python-version : ' 3.11'
84+
85+ - name : Install maturin
86+ if : matrix.build.BUILD_WHEEL == true
87+ run : pip install maturin
88+
89+ - name : Build Python wheel with maturin
90+ if : matrix.build.BUILD_WHEEL == true
91+ shell : bash
92+ run : |
93+ # Ensure pyproject.toml exists and has bindings = "bin"
94+ maturin build --release --target ${{ matrix.build.TARGET }}
95+ # Verify wheel exists
96+ if [ ! -d "target/wheels" ] || [ -z "$(ls target/wheels/*.whl 2>/dev/null)" ]; then
97+ echo "❌ No wheel found after maturin build!"
98+ exit 1
99+ fi
100+
101+ - name : Upload Python wheel artifact
102+ if : matrix.build.BUILD_WHEEL == true
103+ uses : actions/upload-artifact@v4
104+ with :
105+ name : wheels-${{ matrix.build.NAME }}
106+ path : target/wheels/*.whl
76107 if-no-files-found : error
0 commit comments