1+ name : Build macOS
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ - master
8+ - develop
9+ pull_request :
10+ branches :
11+ - main
12+ - master
13+ - develop
14+ workflow_dispatch :
15+
16+ permissions :
17+ contents : read
18+ pull-requests : read
19+
20+ jobs :
21+ build-macos :
22+ name : Build on macOS
23+ runs-on : macos-latest
24+
25+ steps :
26+ - uses : actions/checkout@v4
27+ with :
28+ fetch-depth : 0
29+
30+ - name : Install dependencies via Homebrew
31+ run : |
32+ brew update
33+ brew install libwebsockets libcjson openssl cmake
34+
35+ - name : Configure build
36+ run : |
37+ mkdir -p build
38+ cd build
39+
40+ # Get OpenSSL path from Homebrew
41+ OPENSSL_PATH=$(brew --prefix openssl)
42+
43+ cmake -DCMAKE_BUILD_TYPE=Release \
44+ -DCMAKE_INSTALL_PREFIX=/usr/local \
45+ -DBUILD_TESTS=ON \
46+ -DOPENSSL_DIR="${OPENSSL_PATH}" \
47+ -DOPENSSL_ROOT_DIR="${OPENSSL_PATH}" \
48+ ..
49+
50+ - name : Build library
51+ run : |
52+ cd build
53+ make -j$(sysctl -n hw.ncpu)
54+
55+ - name : Verify build artifacts
56+ run : |
57+ cd build
58+
59+ echo "=== macOS Build Successful ==="
60+ echo "Architecture: $(uname -m)"
61+ echo "macOS Version: $(sw_vers -productVersion)"
62+ echo ""
63+
64+ echo "=== Compiled Libraries ==="
65+ if [ -f CMakeFiles/libwsv5_static.dir/libwsv5.c.o ]; then
66+ echo "✓ Object file compiled"
67+ fi
68+
69+ if [ -f libwsv5.a ]; then
70+ echo "✓ Static library built: libwsv5.a"
71+ ls -lh libwsv5.a
72+ fi
73+
74+ if [ -f libwsv5.so ] || [ -f libwsv5.dylib ]; then
75+ echo "✓ Shared library built"
76+ ls -lh libwsv5.so libwsv5.dylib 2>/dev/null || echo " (macOS may not generate .so)"
77+ fi
78+
79+ echo ""
80+ echo "=== Test Executable ==="
81+ if [ -f test ]; then
82+ echo "✓ Test executable built successfully"
83+ file test
84+ lipo -info test 2>/dev/null || echo " (Architecture info not available)"
85+ fi
86+
87+ - name : Build Summary
88+ if : always()
89+ run : |
90+ echo "=== Build Status ==="
91+ if [ "${{ job.status }}" == "success" ]; then
92+ echo "✓ macOS build completed successfully"
93+ echo "BUILD_STATUS=Build-Passing-green" >> $GITHUB_ENV
94+ else
95+ echo "✗ macOS build failed"
96+ echo "BUILD_STATUS=Build-Failing-red" >> $GITHUB_ENV
97+ fi
98+ echo ""
99+ echo "=== Build Information ==="
100+ echo "Status: ${{ job.status }}"
101+ echo "Branch: ${{ github.ref }}"
102+ echo "Commit: ${{ github.sha }}"
103+ echo "Repository: ${{ github.repository }}"
104+ echo ""
105+ echo "View workflow: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
106+
107+ - name : Report Build Status
108+ if : always()
109+ run : |
110+ echo "## macOS Build Status" >> $GITHUB_STEP_SUMMARY
111+ if [ "${{ job.status }}" == "success" ]; then
112+ echo "✅ **Build-Passing-green**" >> $GITHUB_STEP_SUMMARY
113+ echo "" >> $GITHUB_STEP_SUMMARY
114+ echo "The macOS build completed successfully!" >> $GITHUB_STEP_SUMMARY
115+ else
116+ echo "❌ **Build-Failing-red**" >> $GITHUB_STEP_SUMMARY
117+ echo "" >> $GITHUB_STEP_SUMMARY
118+ echo "The macOS build encountered errors. Check the logs above for details." >> $GITHUB_STEP_SUMMARY
119+ fi
120+ echo "" >> $GITHUB_STEP_SUMMARY
121+ echo "**Build Information:**" >> $GITHUB_STEP_SUMMARY
122+ echo "- Branch: ${{ github.ref }}" >> $GITHUB_STEP_SUMMARY
123+ echo "- Commit: ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY
124+ echo "- Runner: macOS-latest" >> $GITHUB_STEP_SUMMARY
0 commit comments