Skip to content

Commit 4b4f2a8

Browse files
committed
Migrate macOS build process from Docker to native script and update workflows accordingly.
1 parent 1ecb634 commit 4b4f2a8

3 files changed

Lines changed: 59 additions & 50 deletions

File tree

.github/docker/macos.Dockerfile

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/scripts/build-macos.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
set -e
3+
4+
PLATFORM=$1
5+
ARCH=$2
6+
7+
# Install dependencies
8+
brew install cmake openssl@3
9+
10+
# Build libssh2
11+
cd Native/libssh2
12+
mkdir -p build
13+
cd build
14+
15+
cmake .. \
16+
-DCMAKE_BUILD_TYPE=Release \
17+
-DBUILD_SHARED_LIBS=ON \
18+
-DENABLE_ZLIB_COMPRESSION=ON \
19+
-DCRYPTO_BACKEND=OpenSSL \
20+
-DOPENSSL_ROOT_DIR=$(brew --prefix openssl@3) \
21+
-DCMAKE_OSX_ARCHITECTURES=$ARCH \
22+
-DBUILD_EXAMPLES=OFF \
23+
-DBUILD_TESTING=OFF
24+
25+
cmake --build . --config Release -j$(sysctl -n hw.ncpu)
26+
27+
# Create output directory
28+
mkdir -p "../../../NullOpsDevs.LibSsh/runtimes/$PLATFORM/native"
29+
30+
# Copy the dylib
31+
cp src/libssh2*.dylib "../../../NullOpsDevs.LibSsh/runtimes/$PLATFORM/native/libssh2.dylib"

.github/workflows/build-native.yml

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111
- '.github/scripts/**'
1212

1313
jobs:
14-
build-all:
14+
build-linux-windows:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
fail-fast: false
@@ -26,12 +26,6 @@ jobs:
2626
- platform: linux-arm64
2727
dockerfile_platform: linux/arm64
2828
target_triple: aarch64-linux-gnu
29-
- platform: osx-x64
30-
dockerfile_platform: linux/amd64
31-
target_triple: x86_64-apple-darwin
32-
- platform: osx-arm64
33-
dockerfile_platform: linux/amd64
34-
target_triple: aarch64-apple-darwin
3529
steps:
3630
- uses: actions/checkout@v4
3731
with:
@@ -54,8 +48,34 @@ jobs:
5448
name: libssh2-${{ matrix.platform }}
5549
path: NullOpsDevs.LibSsh/runtimes/${{ matrix.platform }}/native/
5650

51+
build-macos:
52+
runs-on: macos-latest
53+
strategy:
54+
fail-fast: false
55+
matrix:
56+
include:
57+
- platform: osx-x64
58+
arch: x86_64
59+
- platform: osx-arm64
60+
arch: arm64
61+
steps:
62+
- uses: actions/checkout@v4
63+
with:
64+
submodules: recursive
65+
66+
- name: Build libssh2 for macOS
67+
run: |
68+
chmod +x .github/scripts/build-macos.sh
69+
.github/scripts/build-macos.sh "${{ matrix.platform }}" "${{ matrix.arch }}"
70+
71+
- name: Upload artifacts
72+
uses: actions/upload-artifact@v4
73+
with:
74+
name: libssh2-${{ matrix.platform }}
75+
path: NullOpsDevs.LibSsh/runtimes/${{ matrix.platform }}/native/
76+
5777
package:
58-
needs: [build-all]
78+
needs: [build-linux-windows, build-macos]
5979
runs-on: ubuntu-latest
6080
steps:
6181
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)