@@ -3,47 +3,48 @@ name: Build
33on :
44 push :
55 pull_request :
6- # schedule:
7- # - cron: '0 */2 * * *'
86
97jobs :
10- build-linux :
8+ build-linux-x86_64 :
119 runs-on : ubuntu-latest
1210 timeout-minutes : 90
1311 env :
14- OS_NAME : unknown
15- ARCH_NAME : unknown
16- DLL_NAME : libasyncprocess.so
17- RESULT_NAME : result-linux
18- RESULT_PATH : result-linux
12+ OS_NAME : Linux
13+ ARCH_NAME : x86_64
14+ LIB_NAME : libasyncprocess.a
15+ RESULT_NAME : result-linux-x86_64
16+ RESULT_PATH : result-linux-x86_64
1917 RESULT_PATH_SUB : result-async/static
2018 steps :
21- - uses : actions/checkout@v2
22- - name : Set environment variables
23- run : |
24- pwd
25- uname
26- uname -m
27- OS_NAME=`uname`
28- ARCH_NAME=`uname -m`
29- echo "OS_NAME=$OS_NAME" >> $GITHUB_ENV
30- echo "ARCH_NAME=$ARCH_NAME" >> $GITHUB_ENV
19+ - uses : actions/checkout@v4
3120 - name : Install
3221 run : |
22+ sudo apt-get update
3323 sudo apt-get install libtool automake
3424 - name : Build
3525 run : |
3626 gcc -v
37- rm static/$ARCH_NAME/$OS_NAME/$DLL_NAME
38- ./bootstrap
27+ # Generate build system
28+ libtoolize --copy --force --quiet
29+ aclocal
30+ autoheader
31+ automake --add-missing --copy --foreign
32+ autoconf
33+ # Configure for static library build
34+ ./configure --enable-static --disable-shared
35+ make
36+ - name : Verify static library
37+ run : |
38+ file .libs/$LIB_NAME
39+ ls -lh .libs/$LIB_NAME
3940 - name : Copy Result
4041 if : always()
4142 run : |
4243 mkdir -p $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME
43- cp static/$ARCH_NAME/$OS_NAME/$DLL_NAME $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME
44+ cp .libs/$LIB_NAME $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME/
4445 - name : Upload Result
4546 if : always()
46- uses : actions/upload-artifact@v1
47+ uses : actions/upload-artifact@v4
4748 with :
4849 name : ${{ env.RESULT_NAME }}
4950 path : ${{ env.RESULT_PATH }}
@@ -54,82 +55,174 @@ jobs:
5455 env :
5556 OS_NAME : Linux
5657 ARCH_NAME : aarch64
57- DLL_NAME : libasyncprocess.so
58+ LIB_NAME : libasyncprocess.a
5859 RESULT_NAME : result-linux-aarch64
5960 RESULT_PATH : result-linux-aarch64
6061 RESULT_PATH_SUB : result-async/static
6162 steps :
62- - uses : actions/checkout@v2
63+ - uses : actions/checkout@v4
6364 - name : Build on aarch64 (arm64)
64- id : runcmd
65- uses : uraimo/run-on-arch-action@v1.0.5
65+ uses : uraimo/run-on-arch-action@v2
6666 with :
67- architecture : aarch64
68- distribution : ubuntu18.04
67+ arch : aarch64
68+ distro : ubuntu22.04
69+ githubToken : ${{ github.token }}
70+ install : |
71+ apt-get update -q -y
72+ apt-get install -q -y build-essential automake libtool file
6973 run : |
70- apt-get update
71- apt-get -y install build-essential
72- apt-get -y install automake
73- apt-get -y install libtool
7474 pwd
75- uname
76- uname -m
77- gcc -v
78- rm static/${{ env.ARCH_NAME }}/${{ env.OS_NAME }}/${{ env.DLL_NAME }}
79- ./bootstrap
75+ uname -a
76+ gcc --version
77+ # Generate build system
78+ libtoolize --copy --force --quiet
79+ aclocal
80+ autoheader
81+ automake --add-missing --copy --foreign
82+ autoconf
83+ # Configure for static library build
84+ ./configure --enable-static --disable-shared
85+ make
86+ # Verify static library
87+ file .libs/libasyncprocess.a
88+ ls -lh .libs/libasyncprocess.a
8089 - name : Copy Result
8190 if : always()
8291 run : |
8392 mkdir -p $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME
84- cp static/$ARCH_NAME/$OS_NAME/$DLL_NAME $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME
93+ cp .libs/$LIB_NAME $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME/
8594 - name : Upload Result
8695 if : always()
87- uses : actions/upload-artifact@v1
96+ uses : actions/upload-artifact@v4
8897 with :
8998 name : ${{ env.RESULT_NAME }}
9099 path : ${{ env.RESULT_PATH }}
91100
92- build-osx :
93- runs-on : macos-latest
101+ build-osx-aarch64 :
102+ runs-on : macos-14 # macOS 14 runs on Apple Silicon (aarch64/arm64)
94103 timeout-minutes : 90
95104 env :
96- OS_NAME : unknown
97- ARCH_NAME : unknown
98- DLL_NAME : libasyncprocess.so
99- RESULT_NAME : result-osx
100- RESULT_PATH : result-osx
105+ OS_NAME : Darwin
106+ ARCH_NAME : aarch64
107+ LIB_NAME : libasyncprocess.a
108+ RESULT_NAME : result-osx-aarch64
109+ RESULT_PATH : result-osx-aarch64
101110 RESULT_PATH_SUB : result-async/static
102111 steps :
103- - uses : actions/checkout@v2
104- - name : Set environment variables
112+ - uses : actions/checkout@v4
113+ - name : Install tools
105114 run : |
106- pwd
107- uname
108- uname -m
109- OS_NAME=`uname`
110- ARCH_NAME=`uname -m`
111- echo "OS_NAME=$OS_NAME" >> $GITHUB_ENV
112- echo "ARCH_NAME=$ARCH_NAME" >> $GITHUB_ENV
115+ brew install automake
116+ brew install libtool
117+ - name : Build
118+ run : |
119+ gcc -v
120+ # Generate build system
121+ glibtoolize --copy --force --quiet
122+ aclocal
123+ autoheader
124+ automake --add-missing --copy --foreign
125+ autoconf
126+ # Configure for static library build
127+ ./configure --enable-static --disable-shared
128+ make
129+ - name : Verify static library
130+ run : |
131+ file .libs/$LIB_NAME
132+ ls -lh .libs/$LIB_NAME
133+ lipo -info .libs/$LIB_NAME
134+ - name : Copy Result
135+ if : always()
136+ run : |
137+ mkdir -p $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME
138+ cp .libs/$LIB_NAME $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME/
139+ - name : Upload Result
140+ if : always()
141+ uses : actions/upload-artifact@v4
142+ with :
143+ name : ${{ env.RESULT_NAME }}
144+ path : ${{ env.RESULT_PATH }}
145+
146+ build-osx-x86_64 :
147+ runs-on : macos-13 # macOS 13 runs on Intel (x86_64)
148+ timeout-minutes : 90
149+ env :
150+ OS_NAME : Darwin
151+ ARCH_NAME : x86_64
152+ LIB_NAME : libasyncprocess.a
153+ RESULT_NAME : result-osx-x86_64
154+ RESULT_PATH : result-osx-x86_64
155+ RESULT_PATH_SUB : result-async/static
156+ steps :
157+ - uses : actions/checkout@v4
113158 - name : Install tools
114159 run : |
115160 brew install automake
116- #brew install libtool
117- which glibtoolize
118- ln -s /usr/local/bin/glibtoolize /usr/local/bin/libtoolize
119- which libtoolize
161+ brew install libtool
120162 - name : Build
121163 run : |
122164 gcc -v
123- rm static/$ARCH_NAME/$OS_NAME/$DLL_NAME
124- ./bootstrap
165+ # Generate build system
166+ glibtoolize --copy --force --quiet
167+ aclocal
168+ autoheader
169+ automake --add-missing --copy --foreign
170+ autoconf
171+ # Configure for static library build
172+ ./configure --enable-static --disable-shared
173+ make
174+ - name : Verify static library
175+ run : |
176+ file .libs/$LIB_NAME
177+ ls -lh .libs/$LIB_NAME
178+ lipo -info .libs/$LIB_NAME
125179 - name : Copy Result
126180 if : always()
127181 run : |
128182 mkdir -p $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME
129- cp static/$ARCH_NAME/$OS_NAME/$DLL_NAME $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME
183+ cp .libs/$LIB_NAME $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME/
130184 - name : Upload Result
131185 if : always()
132- uses : actions/upload-artifact@v1
186+ uses : actions/upload-artifact@v4
133187 with :
134188 name : ${{ env.RESULT_NAME }}
135189 path : ${{ env.RESULT_PATH }}
190+
191+ release :
192+ runs-on : ubuntu-latest
193+ needs : [build-linux-x86_64, build-linux-aarch64, build-osx-aarch64, build-osx-x86_64]
194+ if : startsWith(github.ref, 'refs/tags/')
195+ steps :
196+ - name : Download all artifacts
197+ uses : actions/download-artifact@v4
198+ with :
199+ path : artifacts
200+
201+ - name : Prepare release files
202+ run : |
203+ mkdir -p release-files
204+ echo "Finding all .a files in artifacts..."
205+ find artifacts -name "*.a" -type f
206+ echo ""
207+ echo "Creating uniquely named release files..."
208+ # Find and rename all library files with their arch and os
209+ find artifacts -name "*.a" -type f | while read file; do
210+ # Extract the directory structure to get arch and os
211+ dir=$(dirname "$file")
212+ arch=$(basename "$(dirname "$dir")")
213+ os=$(basename "$dir")
214+ # Normalize OS name to lowercase for consistency
215+ os_lower=$(echo "$os" | tr '[:upper:]' '[:lower:]')
216+ # Create a unique filename: libasyncprocess.{os}.{arch}.a
217+ output_name="libasyncprocess.${os_lower}.${arch}.a"
218+ echo " $file -> release-files/$output_name"
219+ cp "$file" "release-files/$output_name"
220+ done
221+ echo ""
222+ echo "Release files ready for upload:"
223+ ls -lh release-files/
224+
225+ - name : Create Release
226+ uses : softprops/action-gh-release@v1
227+ with :
228+ files : release-files/*
0 commit comments