Skip to content

Commit dab5240

Browse files
committed
fix (CD): updated workflows to be modular. (For now only build the artifacts) && added pyproject toml file and gitcraft/ to prepare for maturin for CD
Signed-off-by: rafaeljohn9 <[email protected]>
1 parent 68c01c3 commit dab5240

File tree

6 files changed

+71
-507
lines changed

6 files changed

+71
-507
lines changed
Lines changed: 48 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,76 @@
11
name: Build Binaries
22

33
on:
4+
push:
5+
tags:
6+
- v[0-9]+.[0-9]+.[0-9]+
47
workflow_dispatch:
58

6-
permissions:
7-
contents: write
8-
99
jobs:
10-
build:
11-
name: Build ${{ matrix.target.NAME }}
12-
runs-on: ${{ matrix.target.OS }}
13-
10+
build-binaries:
11+
name: Build ${{ matrix.build.NAME }}
12+
runs-on: ${{ matrix.build.OS }}
1413
strategy:
1514
fail-fast: false
1615
matrix:
17-
target: # same matrix you already use
16+
build:
17+
# 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 }
21+
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 }
26+
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 }
31+
32+
# macOS
33+
- { NAME: darwin-x64, OS: macos-15, TARGET: x86_64-apple-darwin }
34+
- { NAME: darwin-arm64, OS: macos-15, TARGET: aarch64-apple-darwin }
1835

1936
steps:
2037
- uses: actions/checkout@v4
2138

22-
- uses: dtolnay/rust-toolchain@stable
39+
- name: Setup Rust
40+
uses: dtolnay/rust-toolchain@stable
2341
with:
24-
targets: ${{ matrix.target.TARGET }}
42+
targets: ${{ matrix.build.TARGET }}
2543

26-
- name: Install cross (linux)
44+
- name: Install cross (Linux only)
2745
if: runner.os == 'Linux'
2846
run: cargo install cross --git https://github.com/cross-rs/cross
2947

3048
- name: Build binary
49+
shell: bash
3150
run: |
3251
if [[ "${{ runner.os }}" == "Linux" ]]; then
33-
cross build --release --target ${{ matrix.target.TARGET }}
52+
cross build --release --target ${{ matrix.build.TARGET }}
3453
else
35-
cargo build --release --target ${{ matrix.target.TARGET }}
54+
cargo build --release --target ${{ matrix.build.TARGET }}
3655
fi
3756
38-
- name: Upload Binary
39-
uses: actions/upload-artifact@v4
40-
with:
41-
name: binary-${{ matrix.target.NAME }}
42-
path: target/${{ matrix.target.TARGET }}/release/gitcraft*
43-
44-
- name: Build wheel (if enabled)
45-
if: matrix.target.PYPI_PUBLISH == true
57+
- name: Prepare artifact
58+
shell: bash
4659
run: |
47-
pip install maturin
48-
maturin build --release --target ${{ matrix.target.TARGET }}
60+
BINARY_NAME="gitcraft"
61+
if [[ "${{ matrix.build.TARGET }}" == *"windows"* ]]; then
62+
BINARY_NAME="${BINARY_NAME}.exe"
63+
cp "target/${{ matrix.build.TARGET }}/release/gitcraft.exe" "./gitcraft-${{ matrix.build.NAME }}.exe"
64+
echo "ARTIFACT_FILE=gitcraft-${{ matrix.build.NAME }}.exe" >> $GITHUB_ENV
65+
else
66+
cp "target/${{ matrix.build.TARGET }}/release/gitcraft" "./gitcraft-${{ matrix.build.NAME }}"
67+
chmod +x "./gitcraft-${{ matrix.build.NAME }}"
68+
echo "ARTIFACT_FILE=gitcraft-${{ matrix.build.NAME }}" >> $GITHUB_ENV
69+
fi
4970
50-
- name: Upload Wheels
51-
if: matrix.target.PYPI_PUBLISH == true
71+
- name: Upload binary as artifact
5272
uses: actions/upload-artifact@v4
5373
with:
54-
name: wheels-${{ matrix.target.NAME }}
55-
path: target/wheels/*.whl
74+
name: binary-${{ matrix.build.NAME }}
75+
path: ${{ env.ARTIFACT_FILE }}
76+
if-no-files-found: error

0 commit comments

Comments
 (0)