forked from crow-misia/libwebrtc-bin
-
Notifications
You must be signed in to change notification settings - Fork 2
275 lines (245 loc) · 8.77 KB
/
ci.yml
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
name: CI
on:
push:
branches: ["main"]
tags: ["*"]
pull_request:
branches: ["main"]
paths-ignore: ["**.md"]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
############
# Building #
############
build:
strategy:
fail-fast: false
matrix:
include:
- os: android
ext: .jar
- os: android
arch: arm
ext: .a
- os: android
arch: arm64
ext: .a
- os: android
arch: x64
ext: .a
- os: ios
- os: linux
arch: arm64
- os: linux
arch: x64
- os: macos
arch: arm64
- os: macos
arch: x64
- os: windows
arch: x64
# NOTE: Using `macos-14` instead of `macos-latest` is for improving backward
# compatibility with older iOS/macOS versions.
# The minimum macOS version required to build `libwebrtc` is macOS 14
# due to the use of Screen Capture Kit in the `libwebrtc` source code.
runs-on: ${{ (contains('ios macos', matrix.os) && 'macos-14')
|| (contains('windows', matrix.os) && 'windows-2019')
|| 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v4
- run: ./disk_cleanup.sh
if: ${{ contains('android linux', matrix.os) }}
- run: ./disk_cleanup.mac.sh
if: ${{ contains('ios macos', matrix.os) }}
- run: powershell .\disk_cleanup.bat
if: ${{ contains('windows', matrix.os) }}
- run: sudo scripts/apt_install.sh
if: ${{ contains('android linux', matrix.os) }}
- run: pip install setuptools
if: ${{ contains('ios macos', matrix.os) }}
- run: make -C docker ${{ matrix.os }}${{ (matrix.arch != '' && matrix.os != 'android')
&& format('-{0}', matrix.arch) || '' }}
${{ (matrix.ext == '.jar'
&& 'static=no')
|| (matrix.ext == '.a'
&& 'static=yes') || '' }}
${{ matrix.ext == '.a'
&& format('arch={0}', (matrix.arch == 'arm'
&& 'armeabi-v7a')
|| (matrix.arch == 'arm64'
&& 'arm64-v8a')
|| (matrix.arch == 'x64'
&& 'x86_64')) || '' }}
${{ matrix.ext == '.a'
&& format('target_cpu={0}', matrix.arch) || '' }}
${{ (matrix.ext == '.a' && matrix.arch == 'arm')
&& 'arm_version=7' || '' }}
if: ${{ contains('android linux', matrix.os) }}
- run: make -C build USE_CCACHE=0 ${{ matrix.os }}${{ matrix.arch != '' && format('-{0}', matrix.arch) || '' }}
if: ${{ contains('ios macos', matrix.os) }}
- run: powershell .\build.windows.bat
if: ${{ contains('windows', matrix.os) }}
- uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.os }}${{ matrix.arch != '' && format('-{0}', matrix.arch) || '' }}
path: package/libwebrtc-${{ matrix.os }}${{ matrix.arch != '' && format('-{0}', matrix.arch) || '' }}.${{ (matrix.os == 'ios' && 'zip') || 'tar.gz' }}
if-no-files-found: error
repack-android:
name: repack (android)
needs: ["build"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: build-android
path: package/
- run: tar -xzvf libwebrtc-android.tar.gz -C .
working-directory: package/
- uses: actions/download-artifact@v4
with:
name: build-android-arm
path: package/
- run: tar -xzvf libwebrtc-android-arm.tar.gz -C .
working-directory: package/
- uses: actions/download-artifact@v4
with:
name: build-android-arm64
path: package/
- run: tar -xzvf libwebrtc-android-arm64.tar.gz -C .
working-directory: package/
- uses: actions/download-artifact@v4
with:
name: build-android-x64
path: package/
- run: tar -xzvf libwebrtc-android-x64.tar.gz -C .
working-directory: package/
- run: rm -rf libwebrtc-android*tar.gz
working-directory: package/
- run: tar -czvf libwebrtc-android.tar.gz
aar jar include lib NOTICE VERSION
working-directory: package/
- uses: actions/upload-artifact@v4
with:
name: repack-android
path: package/libwebrtc-android.tar.gz
if-no-files-found: error
#############
# Releasing #
#############
publish-android:
name: publish (Android)
if: ${{ startsWith(github.ref, 'refs/tags/') }}
needs: ["build", "repack-android", "release-github"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: gh-pages
- uses: actions/setup-java@v4
with:
java-version: "17"
distribution: temurin
- name: Parse release version
id: release
run: echo "version=${GITHUB_REF#refs/tags/}"
>> $GITHUB_OUTPUT
- uses: actions/download-artifact@v4
with:
name: repack-android
path: package/
- run: tar -xzvf libwebrtc-android.tar.gz
working-directory: package/
- name: Build Maven files
run: mvn install:install-file
-DgroupId=com.github.instrumentisto
-DartifactId=libwebrtc-bin
-Dversion=${{ steps.release.outputs.version }}
-Dfile=./package/aar/libwebrtc.aar
-Dpackaging=aar
-DgeneratePom=true
-DlocalRepositoryPath=./android/
-DcreateChecksum=true
- name: Publish to GitHub Pages
run: |
set -ex
git config --local user.email 'actions+${{ github.run_number }}@github.com'
git config --local user.name 'GitHub Actions'
git add -v android/
git commit -m 'Release ${{ steps.release.outputs.version }} version of `libwebrtc-android`'
git push origin gh-pages
publish-cocoapods:
name: publish (CocoaPods)
if: ${{ startsWith(github.ref, 'refs/tags/') }}
needs: ["release-github"]
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: maxim-lobanov/setup-cocoapods@v1
with:
version: latest
- run: pod spec lint --allow-warnings --verbose
- run: pod trunk push --allow-warnings
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
release-github:
name: release (GitHub)
if: ${{ startsWith(github.ref, 'refs/tags/') }}
needs: ["build", "repack-android"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Parse release version
id: release
run: echo "version=${GITHUB_REF#refs/tags/}"
>> $GITHUB_OUTPUT
- name: Verify release version matches VERSION file
run: |
test "${{ steps.release.outputs.version }}" \
== "$(grep 'WEBRTC_VERSION=' VERSION | cut -d '=' -f2 | tr -d '\n')$(grep -e '^REVISION=.*$' VERSION | cut -d '=' -f2 | sed -e 's/^/-r/' | tr -d '\n')"
- uses: actions/download-artifact@v4
with:
name: repack-android
path: package/
- uses: actions/download-artifact@v4
with:
name: build-ios
path: package/
- uses: actions/download-artifact@v4
with:
name: build-linux-arm64
path: package/
- uses: actions/download-artifact@v4
with:
name: build-linux-x64
path: package/
- uses: actions/download-artifact@v4
with:
name: build-macos-arm64
path: package/
- uses: actions/download-artifact@v4
with:
name: build-macos-x64
path: package/
- uses: actions/download-artifact@v4
with:
name: build-windows-x64
path: package/
- name: Generate SHA256 checksums
run: ls -1 | xargs -I {} sh -c "sha256sum {} > {}.sha256sum"
working-directory: package/
- name: Show generated SHA256 checksums
run: cat *.sha256sum
working-directory: package/
- name: Create GitHub release
uses: softprops/action-gh-release@v2
with:
name: ${{ steps.release.outputs.version }}
files: |
package/libwebrtc-*.tar.gz
package/libwebrtc-*.tar.gz.sha256sum
package/libwebrtc-*.zip
package/libwebrtc-*.zip.sha256sum
fail_on_unmatched_files: true