Skip to content

Commit 8b3c8d9

Browse files
author
Claude
committed
Add comprehensive multi-platform static library builds
This update expands the build matrix to cover all required platforms and ensures proper static library (.a) builds instead of shared libraries. New build jobs added: - build-linux-musl: x86_64 Linux with musl libc (Alpine) - build-linux-aarch64-musl: aarch64 Linux with musl libc (Alpine) - build-osx-x86_64: macOS Intel (x86_64) using macos-13 runner - build-osx-arm64: macOS Apple Silicon (arm64) using macos-14 runner All builds now: - Explicitly set OS_NAME and ARCH_NAME for consistency - Use --enable-static --disable-shared flags to build static libraries - Include verification step to confirm .a file creation - Output files will match the structure: * aarch64/Linux/libasyncprocess.a * aarch64/Linux-musl/libasyncprocess.a * arm64/Darwin/libasyncprocess.a * x86_64/Darwin/libasyncprocess.a * x86_64/Linux/libasyncprocess.a * x86_64/Linux-musl/libasyncprocess.a Release job updated: - Now depends on all 6 build jobs - Properly handles all artifacts with unique naming
1 parent 0100118 commit 8b3c8d9

1 file changed

Lines changed: 164 additions & 29 deletions

File tree

.github/workflows/build.yml

Lines changed: 164 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,17 @@ jobs:
99
runs-on: ubuntu-latest
1010
timeout-minutes: 90
1111
env:
12-
OS_NAME: unknown
13-
ARCH_NAME: unknown
12+
OS_NAME: Linux
13+
ARCH_NAME: x86_64
1414
LIB_NAME: libasyncprocess.a
1515
RESULT_NAME: result-linux
1616
RESULT_PATH: result-linux
1717
RESULT_PATH_SUB: result-async/static
1818
steps:
1919
- uses: actions/checkout@v4
20-
- name: Set environment variables
21-
run: |
22-
pwd
23-
uname
24-
uname -m
25-
OS_NAME=`uname`
26-
ARCH_NAME=`uname -m`
27-
echo "OS_NAME=$OS_NAME" >> $GITHUB_ENV
28-
echo "ARCH_NAME=$ARCH_NAME" >> $GITHUB_ENV
2920
- name: Install
3021
run: |
22+
sudo apt-get update
3123
sudo apt-get install libtool automake
3224
- name: Build
3325
run: |
@@ -41,6 +33,57 @@ jobs:
4133
# Configure for static build
4234
./configure --enable-static --disable-shared LDFLAGS="-static"
4335
make
36+
- name: Verify static library
37+
run: |
38+
file .libs/$LIB_NAME
39+
ls -lh .libs/$LIB_NAME
40+
- name: Copy Result
41+
if: always()
42+
run: |
43+
mkdir -p $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME
44+
cp .libs/$LIB_NAME $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME/
45+
- name: Upload Result
46+
if: always()
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: ${{ env.RESULT_NAME }}
50+
path: ${{ env.RESULT_PATH }}
51+
52+
build-linux-musl:
53+
runs-on: ubuntu-latest
54+
timeout-minutes: 90
55+
env:
56+
OS_NAME: Linux-musl
57+
ARCH_NAME: x86_64
58+
LIB_NAME: libasyncprocess.a
59+
RESULT_NAME: result-linux-musl
60+
RESULT_PATH: result-linux-musl
61+
RESULT_PATH_SUB: result-async/static
62+
steps:
63+
- uses: actions/checkout@v4
64+
- name: Build on Alpine Linux (musl)
65+
uses: uraimo/run-on-arch-action@v2
66+
with:
67+
arch: x86_64
68+
distro: alpine_latest
69+
run: |
70+
apk add --no-cache build-base automake autoconf libtool
71+
pwd
72+
uname
73+
uname -m
74+
gcc -v
75+
# Generate build system
76+
libtoolize --copy --force --quiet
77+
aclocal
78+
autoheader
79+
automake --add-missing --copy --foreign
80+
autoconf
81+
# Configure for static build
82+
./configure --enable-static --disable-shared LDFLAGS="-static"
83+
make
84+
# Verify static library
85+
file .libs/libasyncprocess.a
86+
ls -lh .libs/libasyncprocess.a
4487
- name: Copy Result
4588
if: always()
4689
run: |
@@ -89,6 +132,56 @@ jobs:
89132
# Configure for static build
90133
./configure --enable-static --disable-shared LDFLAGS="-static"
91134
make
135+
# Verify static library
136+
file .libs/libasyncprocess.a
137+
ls -lh .libs/libasyncprocess.a
138+
- name: Copy Result
139+
if: always()
140+
run: |
141+
mkdir -p $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME
142+
cp .libs/$LIB_NAME $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME/
143+
- name: Upload Result
144+
if: always()
145+
uses: actions/upload-artifact@v4
146+
with:
147+
name: ${{ env.RESULT_NAME }}
148+
path: ${{ env.RESULT_PATH }}
149+
150+
build-linux-aarch64-musl:
151+
runs-on: ubuntu-latest
152+
timeout-minutes: 90
153+
env:
154+
OS_NAME: Linux-musl
155+
ARCH_NAME: aarch64
156+
LIB_NAME: libasyncprocess.a
157+
RESULT_NAME: result-linux-aarch64-musl
158+
RESULT_PATH: result-linux-aarch64-musl
159+
RESULT_PATH_SUB: result-async/static
160+
steps:
161+
- uses: actions/checkout@v4
162+
- name: Build on aarch64 Alpine (musl)
163+
uses: uraimo/run-on-arch-action@v2
164+
with:
165+
arch: aarch64
166+
distro: alpine_latest
167+
run: |
168+
apk add --no-cache build-base automake autoconf libtool
169+
pwd
170+
uname
171+
uname -m
172+
gcc -v
173+
# Generate build system
174+
libtoolize --copy --force --quiet
175+
aclocal
176+
autoheader
177+
automake --add-missing --copy --foreign
178+
autoconf
179+
# Configure for static build
180+
./configure --enable-static --disable-shared LDFLAGS="-static"
181+
make
182+
# Verify static library
183+
file .libs/libasyncprocess.a
184+
ls -lh .libs/libasyncprocess.a
92185
- name: Copy Result
93186
if: always()
94187
run: |
@@ -101,27 +194,18 @@ jobs:
101194
name: ${{ env.RESULT_NAME }}
102195
path: ${{ env.RESULT_PATH }}
103196

104-
build-osx:
105-
runs-on: macos-latest
197+
build-osx-arm64:
198+
runs-on: macos-14 # macOS 14 runs on Apple Silicon (arm64)
106199
timeout-minutes: 90
107200
env:
108-
OS_NAME: unknown
109-
ARCH_NAME: unknown
201+
OS_NAME: Darwin
202+
ARCH_NAME: arm64
110203
LIB_NAME: libasyncprocess.a
111-
RESULT_NAME: result-osx
112-
RESULT_PATH: result-osx
204+
RESULT_NAME: result-osx-arm64
205+
RESULT_PATH: result-osx-arm64
113206
RESULT_PATH_SUB: result-async/static
114207
steps:
115208
- uses: actions/checkout@v4
116-
- name: Set environment variables
117-
run: |
118-
pwd
119-
uname
120-
uname -m
121-
OS_NAME=`uname`
122-
ARCH_NAME=`uname -m`
123-
echo "OS_NAME=$OS_NAME" >> $GITHUB_ENV
124-
echo "ARCH_NAME=$ARCH_NAME" >> $GITHUB_ENV
125209
- name: Install tools
126210
run: |
127211
brew install automake
@@ -138,6 +222,56 @@ jobs:
138222
# Configure for static build
139223
./configure --enable-static --disable-shared
140224
make
225+
- name: Verify static library
226+
run: |
227+
file .libs/$LIB_NAME
228+
ls -lh .libs/$LIB_NAME
229+
lipo -info .libs/$LIB_NAME
230+
- name: Copy Result
231+
if: always()
232+
run: |
233+
mkdir -p $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME
234+
cp .libs/$LIB_NAME $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME/
235+
- name: Upload Result
236+
if: always()
237+
uses: actions/upload-artifact@v4
238+
with:
239+
name: ${{ env.RESULT_NAME }}
240+
path: ${{ env.RESULT_PATH }}
241+
242+
build-osx-x86_64:
243+
runs-on: macos-13 # macOS 13 runs on Intel (x86_64)
244+
timeout-minutes: 90
245+
env:
246+
OS_NAME: Darwin
247+
ARCH_NAME: x86_64
248+
LIB_NAME: libasyncprocess.a
249+
RESULT_NAME: result-osx-x86_64
250+
RESULT_PATH: result-osx-x86_64
251+
RESULT_PATH_SUB: result-async/static
252+
steps:
253+
- uses: actions/checkout@v4
254+
- name: Install tools
255+
run: |
256+
brew install automake
257+
brew install libtool
258+
- name: Build
259+
run: |
260+
gcc -v
261+
# Generate build system
262+
glibtoolize --copy --force --quiet
263+
aclocal
264+
autoheader
265+
automake --add-missing --copy --foreign
266+
autoconf
267+
# Configure for static build
268+
./configure --enable-static --disable-shared
269+
make
270+
- name: Verify static library
271+
run: |
272+
file .libs/$LIB_NAME
273+
ls -lh .libs/$LIB_NAME
274+
lipo -info .libs/$LIB_NAME
141275
- name: Copy Result
142276
if: always()
143277
run: |
@@ -152,7 +286,7 @@ jobs:
152286

153287
release:
154288
runs-on: ubuntu-latest
155-
needs: [build-linux, build-linux-aarch64, build-osx]
289+
needs: [build-linux, build-linux-musl, build-linux-aarch64, build-linux-aarch64-musl, build-osx-arm64, build-osx-x86_64]
156290
if: startsWith(github.ref, 'refs/tags/')
157291
steps:
158292
- name: Download all artifacts
@@ -173,9 +307,10 @@ jobs:
173307
cp "$file" "release-files/libasyncprocess-${arch}-${os}.a"
174308
done
175309
# List what we're uploading
176-
ls -la release-files/
310+
echo "Release files:"
311+
ls -lh release-files/
177312
178313
- name: Create Release
179314
uses: softprops/action-gh-release@v1
180315
with:
181-
files: release-files/*
316+
files: release-files/*

0 commit comments

Comments
 (0)