Skip to content

Commit 93e19a4

Browse files
authored
Update release.yml
1 parent 6712e83 commit 93e19a4

1 file changed

Lines changed: 57 additions & 9 deletions

File tree

.github/workflows/release.yml

Lines changed: 57 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,27 @@ jobs:
4141
target: x86_64-linux-gnu
4242
name: netmgr-linux-x86_64
4343
cmake_args: ""
44+
strip_cmd: "strip"
4445
- os: ubuntu-22.04
4546
target: aarch64-linux-gnu
4647
name: netmgr-linux-aarch64
4748
cmake_args: "-DCMAKE_TOOLCHAIN_FILE=cmake/aarch64-toolchain.cmake"
49+
strip_cmd: "aarch64-linux-gnu-strip"
4850
- os: macos-latest
4951
target: x86_64-apple-darwin
5052
name: netmgr-macos-x86_64
5153
cmake_args: "-DCMAKE_OSX_ARCHITECTURES=x86_64"
54+
strip_cmd: "strip"
5255
- os: macos-latest
5356
target: aarch64-apple-darwin
5457
name: netmgr-macos-aarch64
5558
cmake_args: "-DCMAKE_OSX_ARCHITECTURES=arm64"
59+
strip_cmd: "strip"
5660
- os: windows-latest
5761
target: x86_64-pc-windows-msvc
5862
name: netmgr-windows-x86_64.exe
5963
cmake_args: ""
64+
strip_cmd: ""
6065

6166
steps:
6267
- name: Checkout code
@@ -71,7 +76,10 @@ jobs:
7176
# Install cross-compilation tools for ARM64
7277
if [[ "${{ matrix.target }}" == "aarch64-linux-gnu" ]]; then
7378
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
79+
# Install ARM64 jsoncpp (cross-compiled)
80+
sudo apt-get install -y libjsoncpp-dev:arm64 || echo "ARM64 jsoncpp not available via apt"
7481
fi
82+
7583
- name: Install dependencies (macOS)
7684
if: runner.os == 'macOS'
7785
run: |
@@ -105,28 +113,68 @@ jobs:
105113
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
106114
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
107115
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
116+
# Skip jsoncpp for cross-compilation to avoid issues
117+
set(CMAKE_DISABLE_FIND_PACKAGE_jsoncpp TRUE)
108118
EOF
109119
110-
- name: Configure CMake
120+
- name: Configure CMake (Linux/Windows)
111121
if: runner.os != 'macOS'
112122
run: |
113-
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
123+
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release ${{ matrix.cmake_args }}
114124
115125
- name: Configure CMake (macOS)
116126
if: runner.os == 'macOS'
117127
run: |
118-
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake
128+
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake ${{ matrix.cmake_args }}
119129
120130
- name: Build release binary
121131
run: cmake --build build --config Release
122132

133+
- name: Verify binary exists and check architecture
134+
run: |
135+
if [[ "${{ runner.os }}" == "Windows" ]]; then
136+
if [[ ! -f "build/Release/netmgr.exe" ]]; then
137+
echo "Error: Windows binary not found at build/Release/netmgr.exe"
138+
ls -la build/
139+
ls -la build/Release/ || echo "Release directory not found"
140+
exit 1
141+
fi
142+
echo "Windows binary found"
143+
file build/Release/netmgr.exe || echo "file command not available on Windows"
144+
else
145+
if [[ ! -f "build/netmgr" ]]; then
146+
echo "Error: Binary not found at build/netmgr"
147+
ls -la build/
148+
exit 1
149+
fi
150+
echo "Binary found, checking architecture:"
151+
file build/netmgr
152+
153+
# Verify it's the correct architecture for cross-compilation
154+
if [[ "${{ matrix.target }}" == "aarch64-linux-gnu" ]]; then
155+
if file build/netmgr | grep -q "aarch64\|ARM aarch64"; then
156+
echo "✓ ARM64 binary confirmed"
157+
else
158+
echo "⚠ Warning: Binary may not be ARM64 architecture"
159+
file build/netmgr
160+
fi
161+
fi
162+
fi
163+
123164
- name: Strip binary (Unix)
124-
if: runner.os != 'Windows'
165+
if: runner.os != 'Windows' && matrix.strip_cmd != ''
125166
run: |
126-
if [[ "${{ matrix.target }}" == "aarch64-linux-gnu" ]]; then
127-
aarch64-linux-gnu-strip build/netmgr
167+
# Only strip if the binary exists and strip command is available
168+
if [[ -f "build/netmgr" ]]; then
169+
if command -v ${{ matrix.strip_cmd }} &> /dev/null; then
170+
echo "Stripping binary with ${{ matrix.strip_cmd }}"
171+
${{ matrix.strip_cmd }} build/netmgr
172+
else
173+
echo "Warning: ${{ matrix.strip_cmd }} not found, skipping strip"
174+
fi
128175
else
129-
strip build/netmgr
176+
echo "Error: Binary not found for stripping"
177+
exit 1
130178
fi
131179
132180
- name: Prepare binary (Unix)
@@ -152,8 +200,8 @@ jobs:
152200
153201
# Copy files
154202
cp build/netmgr package/usr/bin/
155-
cp README.md package/usr/share/doc/netmgr/
156-
cp LICENSE package/usr/share/doc/netmgr/
203+
cp README.md package/usr/share/doc/netmgr/ || echo "README.md not found"
204+
cp LICENSE package/usr/share/doc/netmgr/ || echo "LICENSE not found"
157205
158206
# Clean version string for package
159207
VERSION=$(echo "${{ github.ref_name }}" | sed 's/^v//')

0 commit comments

Comments
 (0)