Skip to content

Commit b18ee39

Browse files
authored
Windows: Support cygwin pipline and packager. v5.0.89 (ossrs#3257)
1. Support github actions on Windows Server 2022. 2. Use cygwin64 in windows-latest to build SRS. 3. Package SRS-xxx-setup.exe by NSIS.exe 4. Patch crypto/include/config.h for libsrtp. 5. Support run as administrator. 6. Apply utest for cygwin. 7. Enable srtp over openssl.
1 parent d741f81 commit b18ee39

16 files changed

+834
-60
lines changed

.github/workflows/release.yml

Lines changed: 187 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,165 @@ jobs:
6464
run: |
6565
docker run --rm srs:test bash -c 'make && ./objs/srs -c conf/regression-test.conf && \
6666
cd 3rdparty/srs-bench && make && ./objs/srs_test -test.v'
67+
outputs:
68+
SRS_TEST_DONE: ok
69+
70+
draft:
71+
name: draft
72+
runs-on: ubuntu-20.04
73+
needs:
74+
- envs
75+
steps:
76+
- name: Create release draft
77+
id: create_draft
78+
uses: ncipollo/release-action@v1
79+
env:
80+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81+
with:
82+
allowUpdates: true
83+
tag: ${{ github.ref }}
84+
draft: true
85+
prerelease: true
86+
outputs:
87+
SRS_RELEASE_ID: ${{ steps.create_draft.outputs.id }}
88+
89+
cygwin64:
90+
name: cygwin64
91+
runs-on: windows-latest
92+
needs:
93+
- envs
94+
- draft
95+
steps:
96+
# See https://github.com/cygwin/cygwin-install-action#parameters
97+
# Note that https://github.com/egor-tensin/setup-cygwin fails to install packages.
98+
- name: Setup Cygwin
99+
uses: cygwin/cygwin-install-action@master
100+
with:
101+
platform: x86_64
102+
packages: bash make gcc-g++ cmake automake patch pkg-config tcl
103+
install-dir: C:\cygwin64
104+
##################################################################################################################
105+
- name: Checkout repository
106+
uses: actions/checkout@v2
107+
##################################################################################################################
108+
- name: Covert output to env
109+
env:
110+
SHELLOPTS: igncr
111+
shell: C:\cygwin64\bin\bash.exe --login '{0}'
112+
run: |
113+
echo "SRS_TAG=${{ needs.envs.outputs.SRS_TAG }}" >> $GITHUB_ENV
114+
echo "SRS_VERSION=${{ needs.envs.outputs.SRS_VERSION }}" >> $GITHUB_ENV
115+
echo "SRS_MAJOR=${{ needs.envs.outputs.SRS_MAJOR }}" >> $GITHUB_ENV
116+
echo "SRS_RELEASE_ID=${{ needs.draft.outputs.SRS_RELEASE_ID }}" >> $GITHUB_ENV
117+
##################################################################################################################
118+
- name: Build SRS
119+
env:
120+
SHELLOPTS: igncr
121+
SRS_WORKSPACE: ${{ github.workspace }}
122+
shell: C:\cygwin64\bin\bash.exe --login '{0}'
123+
run: |
124+
export PATH=/usr/bin:/usr/local/bin &&
125+
which make gcc g++ patch cmake pkg-config uname grep sed &&
126+
(make --version; gcc --version; patch --version; cmake --version; pkg-config --version) &&
127+
(aclocal --version; autoconf --version; automake --version; uname -a) &&
128+
cd $(cygpath -u $SRS_WORKSPACE)/trunk && ./configure && make
129+
##################################################################################################################
130+
- name: Package SRS
131+
env:
132+
SHELLOPTS: igncr
133+
SRS_WORKSPACE: ${{ github.workspace }}
134+
shell: C:\cygwin64\bin\bash.exe --login '{0}'
135+
run: |
136+
cd $(cygpath -u $SRS_WORKSPACE) &&
137+
if [[ $(echo $SRS_TAG |grep -qE '^v' && echo YES) != YES ]]; then
138+
SRS_VERSION=$(./trunk/objs/srs -v 2>&1); echo "Change version to ${SRS_VERSION}";
139+
fi &&
140+
"/cygdrive/c/Program Files (x86)/NSIS/makensis.exe" /DSRS_VERSION=${SRS_VERSION} \
141+
/DCYGWIN_DIR="C:\cygwin64" trunk/packaging/nsis/srs.nsi &&
142+
mv trunk/packaging/nsis/SRS-Windows-x86_64-${SRS_VERSION}-setup.exe . && ls -lh *.exe &&
143+
echo "SRS_CYGWIN_TAR=SRS-Windows-x86_64-${SRS_VERSION}-setup.exe" >> $GITHUB_ENV &&
144+
echo "SRS_CYGWIN_MD5=$(md5sum SRS-Windows-x86_64-${SRS_VERSION}-setup.exe| awk '{print $1}')" >> $GITHUB_ENV
145+
##################################################################################################################
146+
- name: Upload Release Assets Cygwin
147+
id: upload-release-assets-cygwin
148+
uses: dwenegar/upload-release-assets@v1
149+
env:
150+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
151+
with:
152+
release_id: ${{ env.SRS_RELEASE_ID }}
153+
assets_path: ${{ env.SRS_CYGWIN_TAR }}
154+
outputs:
155+
SRS_CYGWIN_TAR: ${{ env.SRS_CYGWIN_TAR }}
156+
SRS_CYGWIN_MD5: ${{ env.SRS_CYGWIN_MD5 }}
157+
158+
linux:
159+
name: linux
160+
runs-on: ubuntu-20.04
161+
needs:
162+
- envs
163+
- draft
164+
steps:
165+
##################################################################################################################
166+
- name: Covert output to env
167+
run: |
168+
echo "SRS_TAG=${{ needs.envs.outputs.SRS_TAG }}" >> $GITHUB_ENV
169+
echo "SRS_VERSION=${{ needs.envs.outputs.SRS_VERSION }}" >> $GITHUB_ENV
170+
echo "SRS_MAJOR=${{ needs.envs.outputs.SRS_MAJOR }}" >> $GITHUB_ENV
171+
echo "SRS_RELEASE_ID=${{ needs.draft.outputs.SRS_RELEASE_ID }}" >> $GITHUB_ENV
172+
##################################################################################################################
173+
# Git checkout
174+
- name: Checkout repository
175+
uses: actions/checkout@v2
176+
##################################################################################################################
177+
# Create source tar for release. Note that it's for OpenWRT package srs-server, so the filename MUST be
178+
# srs-server-xxx.tar.gz, because the package is named srs-server.
179+
# Generate variables like:
180+
# SRS_SOURCE_TAR=srs-server-5.0.145.tar.gz
181+
# SRS_SOURCE_MD5=83e38700a80a26e30b2df054e69956e5
182+
- name: Create source tar.gz
183+
run: |
184+
DEST_DIR=srs-server-$SRS_VERSION && mkdir -p $DEST_DIR &&
185+
cp README.md $DEST_DIR && cp LICENSE $DEST_DIR && cp -R trunk $DEST_DIR/trunk &&
186+
(cd $DEST_DIR/trunk/3rdparty && rm -rf *.zip openssl-*.gz srs-bench) &&
187+
tar zcf ${DEST_DIR}.tar.gz ${DEST_DIR} && du -sh ${DEST_DIR}* && rm -rf ${DEST_DIR} &&
188+
echo "SRS_SOURCE_TAR=${DEST_DIR}.tar.gz" >> $GITHUB_ENV &&
189+
echo "SRS_SOURCE_MD5=$(md5sum ${DEST_DIR}.tar.gz| awk '{print $1}')" >> $GITHUB_ENV
190+
# Create package tar for release
191+
# Generate variables like:
192+
# SRS_PACKAGE_ZIP=SRS-CentOS7-x86_64-5.0.145.zip
193+
# SRS_PACKAGE_MD5=3880a26e30b283edf05700a4e69956e5
194+
- name: Create package zip
195+
env:
196+
PACKAGER: ${{ secrets.SRS_PACKAGER_BINARY }}
197+
run: |
198+
docker build --tag srs:pkg --build-arg version=$SRS_VERSION --build-arg SRS_AUTO_PACKAGER=$PACKAGER -f trunk/Dockerfile.pkg . &&
199+
SRS_PACKAGE_ZIP=SRS-CentOS7-x86_64-$SRS_VERSION.zip &&
200+
docker run --rm -v $(pwd):/output srs:pkg cp objs/$SRS_PACKAGE_ZIP /output/ &&
201+
du -sh $SRS_PACKAGE_ZIP &&
202+
echo "SRS_PACKAGE_ZIP=$SRS_PACKAGE_ZIP" >> $GITHUB_ENV &&
203+
echo "SRS_PACKAGE_MD5=$(md5sum $SRS_PACKAGE_ZIP| awk '{print $1}')" >> $GITHUB_ENV
204+
##################################################################################################################
205+
- name: Upload Release Assets Packager
206+
id: upload-release-assets-packager
207+
uses: dwenegar/upload-release-assets@v1
208+
env:
209+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
210+
with:
211+
release_id: ${{ env.SRS_RELEASE_ID }}
212+
assets_path: ${{ env.SRS_PACKAGE_ZIP }}
213+
- name: Upload Release Assets Source
214+
id: upload-release-assets-source
215+
uses: dwenegar/upload-release-assets@v1
216+
env:
217+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
218+
with:
219+
release_id: ${{ env.SRS_RELEASE_ID }}
220+
assets_path: ${{ env.SRS_SOURCE_TAR }}
221+
outputs:
222+
SRS_PACKAGE_ZIP: ${{ env.SRS_PACKAGE_ZIP }}
223+
SRS_PACKAGE_MD5: ${{ env.SRS_PACKAGE_MD5 }}
224+
SRS_SOURCE_TAR: ${{ env.SRS_SOURCE_TAR }}
225+
SRS_SOURCE_MD5: ${{ env.SRS_SOURCE_MD5 }}
67226

68227
docker-srs:
69228
name: docker-srs
@@ -113,6 +272,8 @@ jobs:
113272
ossrs/srs:${{ env.SRS_VERSION }}
114273
ossrs/srs:${{ env.SRS_MAJOR }}
115274
ossrs/srs:v${{ env.SRS_MAJOR }}
275+
outputs:
276+
SRS_DOCKER_DONE: ok
116277

117278
aliyun-srs:
118279
name: aliyun-srs
@@ -144,6 +305,8 @@ jobs:
144305
registry.cn-hangzhou.aliyuncs.com/ossrs/srs:${{ env.SRS_VERSION }}
145306
registry.cn-hangzhou.aliyuncs.com/ossrs/srs:${{ env.SRS_MAJOR }}
146307
registry.cn-hangzhou.aliyuncs.com/ossrs/srs:v${{ env.SRS_MAJOR }}
308+
outputs:
309+
SRS_ALIYUN_DONE: ok
147310

148311
update:
149312
name: update
@@ -209,68 +372,56 @@ jobs:
209372
docker rmi -f $image
210373
echo "Remove image $image, r0=$?"
211374
done
375+
outputs:
376+
SRS_UPDATE_DONE: ok
212377

213378
release:
214379
name: release
215380
runs-on: ubuntu-20.04
216381
needs:
217-
- update
382+
#- update
218383
- envs
384+
- draft
385+
- cygwin64
386+
- linux
219387
steps:
220388
##################################################################################################################
221389
- name: Covert output to env
222390
run: |
223391
echo "SRS_TAG=${{ needs.envs.outputs.SRS_TAG }}" >> $GITHUB_ENV
224392
echo "SRS_VERSION=${{ needs.envs.outputs.SRS_VERSION }}" >> $GITHUB_ENV
225393
echo "SRS_MAJOR=${{ needs.envs.outputs.SRS_MAJOR }}" >> $GITHUB_ENV
394+
echo "SRS_RELEASE_ID=${{ needs.draft.outputs.SRS_RELEASE_ID }}" >> $GITHUB_ENV
395+
echo "SRS_PACKAGE_ZIP=${{ needs.linux.outputs.SRS_PACKAGE_ZIP }}" >> $GITHUB_ENV
396+
echo "SRS_PACKAGE_MD5=${{ needs.linux.outputs.SRS_PACKAGE_MD5 }}" >> $GITHUB_ENV
397+
echo "SRS_SOURCE_TAR=${{ needs.linux.outputs.SRS_SOURCE_TAR }}" >> $GITHUB_ENV
398+
echo "SRS_SOURCE_MD5=${{ needs.linux.outputs.SRS_SOURCE_MD5 }}" >> $GITHUB_ENV
399+
echo "SRS_CYGWIN_TAR=${{ needs.cygwin64.outputs.SRS_CYGWIN_TAR }}" >> $GITHUB_ENV
400+
echo "SRS_CYGWIN_MD5=${{ needs.cygwin64.outputs.SRS_CYGWIN_MD5 }}" >> $GITHUB_ENV
226401
##################################################################################################################
227402
# Git checkout
228403
- name: Checkout repository
229404
uses: actions/checkout@v2
230-
##################################################################################################################
231-
# Create source tar for release. Note that it's for OpenWRT package srs-server, so the filename MUST be
232-
# srs-server-xxx.tar.gz, because the package is named srs-server.
233-
# Generate variables like:
234-
# SRS_SOURCE_TAR=srs-server-5.0.145.tar.gz
235-
# SRS_SOURCE_MD5=83e38700a80a26e30b2df054e69956e5
236-
- name: Create source tar.gz
237-
run: |
238-
DEST_DIR=srs-server-$SRS_VERSION && mkdir -p $DEST_DIR &&
239-
cp README.md $DEST_DIR && cp LICENSE $DEST_DIR && cp -R trunk $DEST_DIR/trunk &&
240-
(cd $DEST_DIR/trunk/3rdparty && rm -rf *.zip openssl-*.gz srs-bench) &&
241-
tar zcf ${DEST_DIR}.tar.gz ${DEST_DIR} && du -sh ${DEST_DIR}* && rm -rf ${DEST_DIR} &&
242-
echo "SRS_SOURCE_TAR=${DEST_DIR}.tar.gz" >> $GITHUB_ENV &&
243-
echo "SRS_SOURCE_MD5=$(md5sum ${DEST_DIR}.tar.gz| awk '{print $1}')" >> $GITHUB_ENV
244-
# Create package tar for release
245-
# Generate variables like:
246-
# SRS_PACKAGE_ZIP=SRS-CentOS7-x86_64-5.0.145.zip
247-
# SRS_PACKAGE_MD5=3880a26e30b283edf05700a4e69956e5
248-
- name: Create package zip
249-
env:
250-
PACKAGER: ${{ secrets.SRS_PACKAGER_BINARY }}
251-
run: |
252-
docker build --tag srs:pkg --build-arg version=$SRS_VERSION --build-arg SRS_AUTO_PACKAGER=$PACKAGER -f trunk/Dockerfile.pkg . &&
253-
SRS_PACKAGE_ZIP=SRS-CentOS7-x86_64-$SRS_VERSION.zip &&
254-
docker run --rm -v $(pwd):/output srs:pkg cp objs/$SRS_PACKAGE_ZIP /output/ &&
255-
du -sh $SRS_PACKAGE_ZIP &&
256-
echo "SRS_PACKAGE_ZIP=$SRS_PACKAGE_ZIP" >> $GITHUB_ENV &&
257-
echo "SRS_PACKAGE_MD5=$(md5sum $SRS_PACKAGE_ZIP| awk '{print $1}')" >> $GITHUB_ENV
258405
# Create release.
259406
# TODO: FIXME: Refine the release when 5.0 released
260407
# TODO: FIXME: Change prerelease to false when 5.0 released
261-
- name: Create release
262-
id: create_release
263-
uses: actions/create-release@v1
408+
- name: Update release
409+
id: update_release
410+
uses: ncipollo/release-action@v1
264411
env:
265412
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
266413
with:
267-
tag_name: ${{ github.ref }}
268-
release_name: Release ${{ github.ref }}
414+
allowUpdates: true
415+
tag: ${{ github.ref }}
416+
name: Release ${{ env.SRS_TAG }}
269417
body: |
270-
[${{ github.event.head_commit.message }}](https://github.com/ossrs/srs/commit/${{ github.sha }})
418+
[${{ github.sha }}](https://github.com/ossrs/srs/commit/${{ github.sha }})
419+
${{ github.event.head_commit.message }}
420+
271421
## Resource
272422
* Source: ${{ env.SRS_SOURCE_MD5 }} [${{ env.SRS_SOURCE_TAR }}](https://github.com/ossrs/srs/releases/download/${{ env.SRS_TAG }}/${{ env.SRS_SOURCE_TAR }})
273423
* Binary: ${{ env.SRS_PACKAGE_MD5 }} [${{ env.SRS_PACKAGE_ZIP }}](https://github.com/ossrs/srs/releases/download/${{ env.SRS_TAG }}/${{ env.SRS_PACKAGE_ZIP }})
424+
* Binary: ${{ env.SRS_CYGWIN_MD5 }} [${{ env.SRS_CYGWIN_TAR }}](https://github.com/ossrs/srs/releases/download/${{ env.SRS_TAG }}/${{ env.SRS_CYGWIN_TAR }})
274425
## Docker
275426
* China: [docker pull registry.cn-hangzhou.aliyuncs.com/ossrs/srs:${{ env.SRS_MAJOR }}](https://ossrs.net/lts/zh-cn/docs/v5/doc/getting-started)
276427
* China: [docker pull registry.cn-hangzhou.aliyuncs.com/ossrs/srs:${{ env.SRS_TAG }}](https://ossrs.net/lts/zh-cn/docs/v5/doc/getting-started)
@@ -282,29 +433,12 @@ jobs:
282433
* [中文FAQ](https://ossrs.net/lts/zh-cn/faq) or [FAQ](https://ossrs.io/lts/en-us/faq), [Features](https://github.com/ossrs/srs/blob/${{ github.sha }}/trunk/doc/Features.md#features) or [ChangeLogs](https://github.com/ossrs/srs/blob/${{ github.sha }}/trunk/doc/CHANGELOG.md#changelog)
283434
draft: false
284435
prerelease: true
285-
# Upload release source files
286-
- name: Upload Release Assets Source
287-
id: upload-release-assets-source
288-
uses: dwenegar/upload-release-assets@v1
289-
env:
290-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
291-
with:
292-
release_id: ${{ steps.create_release.outputs.id }}
293-
assets_path: ${{ env.SRS_SOURCE_TAR }}
294-
# Upload release package files
295-
- name: Upload Release Assets Package
296-
id: upload-release-assets-package
297-
uses: dwenegar/upload-release-assets@v1
298-
env:
299-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
300-
with:
301-
release_id: ${{ steps.create_release.outputs.id }}
302-
assets_path: ${{ env.SRS_PACKAGE_ZIP }}
303436

304437
done:
305438
name: done
306439
runs-on: ubuntu-20.04
307440
needs:
441+
- update
308442
- release
309443
steps:
310444
- run: echo 'All done'

0 commit comments

Comments
 (0)