11on :
22 push :
3- # Sequence of patterns matched against refs/tags
43 tags :
5- - " v*" # Push events to matching v*, i.e. v1.0, v20.15.10
4+ - " v*"
65
76name : Create Release
87
@@ -13,27 +12,30 @@ jobs:
1312 permissions :
1413 contents : write
1514 strategy :
16- fail-fast : false # Continue with other builds if one fails
15+ fail-fast : false
1716 matrix :
1817 include :
1918 # Linux builds
2019 - os : ubuntu-latest
2120 target : x86_64-unknown-linux-musl
2221 binary_name : zinit-linux-x86_64
22+ - os : ubuntu-latest
23+ target : aarch64-unknown-linux-musl
24+ binary_name : zinit-linux-aarch64
2325 # macOS builds
2426 - os : macos-latest
2527 target : x86_64-apple-darwin
2628 binary_name : zinit-macos-x86_64
2729 - os : macos-latest
2830 target : aarch64-apple-darwin
2931 binary_name : zinit-macos-aarch64
32+
3033 steps :
3134 - name : Checkout code
3235 uses : actions/checkout@v4
3336 with :
34- fetch-depth : 0 # Fetch all history for proper versioning
37+ fetch-depth : 0
3538
36- # Cache Rust dependencies
3739 - name : Cache Rust dependencies
3840 uses : actions/cache@v3
3941 with :
@@ -44,55 +46,57 @@ jobs:
4446 key : ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
4547 restore-keys : |
4648 ${{ runner.os }}-${{ matrix.target }}-cargo-
47-
49+
4850 - name : Setup build environment (macOS)
4951 if : matrix.os == 'macos-latest'
5052 run : |
51- # Install required build tools for macOS
5253 brew install llvm
53-
54- # For cross-compilation to Apple Silicon when on Intel
5554 if [[ "${{ matrix.target }}" == "aarch64-apple-darwin" ]]; then
5655 rustup target add aarch64-apple-darwin
5756 fi
58-
57+
5958 - name : Install Rust toolchain
6059 uses : actions-rs/toolchain@v1
6160 with :
6261 toolchain : stable
6362 target : ${{ matrix.target }}
6463 override : true
65- profile : minimal # Minimal components for faster installation
66-
64+ profile : minimal
65+
6766 - name : Install MUSL tools (Linux)
68- if : matrix.os == 'ubuntu-latest' && contains(matrix.target, 'musl')
67+ if : matrix.os == 'ubuntu-latest'
6968 run : |
7069 sudo apt-get update
71- sudo apt-get install -y musl-tools musl-dev
72-
70+ sudo apt-get install -y musl-tools musl-dev gcc-aarch64-linux-gnu
71+
72+ # Install required Rust targets
73+ if [[ "${{ matrix.target }}" == "aarch64-unknown-linux-musl" ]]; then
74+ rustup target add aarch64-unknown-linux-musl
75+ fi
76+ if [[ "${{ matrix.target }}" == "x86_64-unknown-linux-musl" ]]; then
77+ rustup target add x86_64-unknown-linux-musl
78+ fi
79+
7380 - name : Build release
7481 env :
75- CC : ${{ matrix.os == 'macos-latest' && 'clang' || '' }}
76- CXX : ${{ matrix.os == 'macos-latest' && 'clang++' || '' }}
82+ CC : ${{ ( matrix.target == 'aarch64-unknown-linux-musl' && 'aarch64-linux-gnu-gcc') || (matrix. os == 'macos-latest' && 'clang') || '' }}
83+ CXX : ${{ ( matrix.target == 'aarch64-unknown-linux-musl' && 'aarch64-linux-gnu-g++') || (matrix. os == 'macos-latest' && 'clang++') || '' }}
7784 MACOSX_DEPLOYMENT_TARGET : ' 10.12'
7885 run : |
79- # Add special flags for Apple Silicon builds
8086 if [[ "${{ matrix.target }}" == "aarch64-apple-darwin" ]]; then
8187 export RUSTFLAGS="-C target-feature=+crt-static"
8288 fi
8389
8490 cargo build --release --target=${{ matrix.target }} --verbose
85-
86- # Verify binary exists
8791 if [ ! -f "target/${{ matrix.target }}/release/zinit" ]; then
8892 echo "::error::Binary not found at target/${{ matrix.target }}/release/zinit"
8993 exit 1
9094 fi
91-
95+
9296 - name : Strip binary (Linux)
9397 if : matrix.os == 'ubuntu-latest'
9498 run : |
95- strip target/${{ matrix.target }}/release/zinit
99+ llvm-strip target/${{ matrix.target }}/release/zinit || strip target/${{ matrix.target }}/release/zinit
96100
97101 - name : Strip binary (macOS)
98102 if : matrix.os == 'macos-latest'
@@ -102,19 +106,13 @@ jobs:
102106 - name : Rename binary
103107 run : |
104108 cp target/${{ matrix.target }}/release/zinit ${{ matrix.binary_name }}
105-
106- # Verify binary was copied successfully
107109 if [ ! -f "${{ matrix.binary_name }}" ]; then
108110 echo "::error::Binary not copied successfully to ${{ matrix.binary_name }}"
109111 exit 1
110112 fi
111-
112- # Show binary info for debugging
113- echo "Binary details for ${{ matrix.binary_name }}:"
114113 ls -la ${{ matrix.binary_name }}
115114 file ${{ matrix.binary_name }} || true
116115
117- # Upload artifacts even if the release step fails
118116 - name : Upload artifacts
119117 uses : actions/upload-artifact@v4
120118 with :
0 commit comments