-
Notifications
You must be signed in to change notification settings - Fork 12
228 lines (220 loc) · 6.65 KB
/
build.yml
File metadata and controls
228 lines (220 loc) · 6.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
name: Build
on:
push:
pull_request:
jobs:
build-linux-x86_64:
runs-on: ubuntu-latest
timeout-minutes: 90
env:
OS_NAME: Linux
ARCH_NAME: x86_64
LIB_NAME: libasyncprocess.a
RESULT_NAME: result-linux-x86_64
RESULT_PATH: result-linux-x86_64
RESULT_PATH_SUB: result-async/static
steps:
- uses: actions/checkout@v4
- name: Install
run: |
sudo apt-get update
sudo apt-get install libtool automake
- name: Build
run: |
gcc -v
# Generate build system
libtoolize --copy --force --quiet
aclocal
autoheader
automake --add-missing --copy --foreign
autoconf
# Configure for static library build
./configure --enable-static --disable-shared
make
- name: Verify static library
run: |
file .libs/$LIB_NAME
ls -lh .libs/$LIB_NAME
- name: Copy Result
if: always()
run: |
mkdir -p $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME
cp .libs/$LIB_NAME $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME/
- name: Upload Result
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ env.RESULT_NAME }}
path: ${{ env.RESULT_PATH }}
build-linux-aarch64:
runs-on: ubuntu-latest
timeout-minutes: 90
env:
OS_NAME: Linux
ARCH_NAME: aarch64
LIB_NAME: libasyncprocess.a
RESULT_NAME: result-linux-aarch64
RESULT_PATH: result-linux-aarch64
RESULT_PATH_SUB: result-async/static
steps:
- uses: actions/checkout@v4
- name: Build on aarch64 (arm64)
uses: uraimo/run-on-arch-action@v2
with:
arch: aarch64
distro: ubuntu22.04
githubToken: ${{ github.token }}
install: |
apt-get update -q -y
apt-get install -q -y build-essential automake libtool file
run: |
pwd
uname -a
gcc --version
# Generate build system
libtoolize --copy --force --quiet
aclocal
autoheader
automake --add-missing --copy --foreign
autoconf
# Configure for static library build
./configure --enable-static --disable-shared
make
# Verify static library
file .libs/libasyncprocess.a
ls -lh .libs/libasyncprocess.a
- name: Copy Result
if: always()
run: |
mkdir -p $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME
cp .libs/$LIB_NAME $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME/
- name: Upload Result
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ env.RESULT_NAME }}
path: ${{ env.RESULT_PATH }}
build-osx-aarch64:
runs-on: macos-14 # macOS 14 runs on Apple Silicon (aarch64/arm64)
timeout-minutes: 90
env:
OS_NAME: Darwin
ARCH_NAME: aarch64
LIB_NAME: libasyncprocess.a
RESULT_NAME: result-osx-aarch64
RESULT_PATH: result-osx-aarch64
RESULT_PATH_SUB: result-async/static
steps:
- uses: actions/checkout@v4
- name: Install tools
run: |
brew install automake
brew install libtool
- name: Build
run: |
gcc -v
# Generate build system
glibtoolize --copy --force --quiet
aclocal
autoheader
automake --add-missing --copy --foreign
autoconf
# Configure for static library build
./configure --enable-static --disable-shared
make
- name: Verify static library
run: |
file .libs/$LIB_NAME
ls -lh .libs/$LIB_NAME
lipo -info .libs/$LIB_NAME
- name: Copy Result
if: always()
run: |
mkdir -p $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME
cp .libs/$LIB_NAME $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME/
- name: Upload Result
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ env.RESULT_NAME }}
path: ${{ env.RESULT_PATH }}
build-osx-x86_64:
runs-on: macos-13 # macOS 13 runs on Intel (x86_64)
timeout-minutes: 90
env:
OS_NAME: Darwin
ARCH_NAME: x86_64
LIB_NAME: libasyncprocess.a
RESULT_NAME: result-osx-x86_64
RESULT_PATH: result-osx-x86_64
RESULT_PATH_SUB: result-async/static
steps:
- uses: actions/checkout@v4
- name: Install tools
run: |
brew install automake
brew install libtool
- name: Build
run: |
gcc -v
# Generate build system
glibtoolize --copy --force --quiet
aclocal
autoheader
automake --add-missing --copy --foreign
autoconf
# Configure for static library build
./configure --enable-static --disable-shared
make
- name: Verify static library
run: |
file .libs/$LIB_NAME
ls -lh .libs/$LIB_NAME
lipo -info .libs/$LIB_NAME
- name: Copy Result
if: always()
run: |
mkdir -p $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME
cp .libs/$LIB_NAME $RESULT_PATH/$RESULT_PATH_SUB/$ARCH_NAME/$OS_NAME/
- name: Upload Result
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ env.RESULT_NAME }}
path: ${{ env.RESULT_PATH }}
release:
runs-on: ubuntu-latest
needs: [build-linux-x86_64, build-linux-aarch64, build-osx-aarch64, build-osx-x86_64]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release files
run: |
mkdir -p release-files
echo "Finding all .a files in artifacts..."
find artifacts -name "*.a" -type f
echo ""
echo "Creating uniquely named release files..."
# Find and rename all library files with their arch and os
find artifacts -name "*.a" -type f | while read file; do
# Extract the directory structure to get arch and os
dir=$(dirname "$file")
arch=$(basename "$(dirname "$dir")")
os=$(basename "$dir")
# Normalize OS name to lowercase for consistency
os_lower=$(echo "$os" | tr '[:upper:]' '[:lower:]')
# Create a unique filename: libasyncprocess.{os}.{arch}.a
output_name="libasyncprocess.${os_lower}.${arch}.a"
echo " $file -> release-files/$output_name"
cp "$file" "release-files/$output_name"
done
echo ""
echo "Release files ready for upload:"
ls -lh release-files/
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: release-files/*