feat: Automatically build package and upload binary files to the issue list

This commit is contained in:
xiongziliang 2024-06-01 18:24:02 +08:00
parent d6f166c1f4
commit 68c0424808
7 changed files with 160 additions and 32 deletions

View File

@ -23,3 +23,35 @@ jobs:
- name: 编译 - name: 编译
run: cd Android && ./gradlew build run: cd Android && ./gradlew build
- name: 设置环境变量
run: |
echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr -s "/\?%*:|\"<>" "_")" >> $GITHUB_ENV
echo "BRANCH2=$(echo ${GITHUB_REF#refs/heads/} )" >> $GITHUB_ENV
echo "DATE=$(date +%Y-%m-%d)" >> $GITHUB_ENV
- name: 打包二进制
id: upload
uses: actions/upload-artifact@v4
with:
name: ${{ github.workflow }}_${{ env.BRANCH }}_${{ env.DATE }}
path: Android/app/build/outputs/apk/debug/*
if-no-files-found: error
retention-days: 1
- name: issue评论
if: github.event_name != 'pull_request'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: 483,
owner: context.repo.owner,
repo: context.repo.repo,
body: '- 下载地址: [${{ github.workflow }}_${{ env.BRANCH }}_${{ env.DATE }}](${{ steps.upload.outputs.artifact-url }})\n'
+ '- 分支: ${{ env.BRANCH2 }}\n'
+ '- git hash: ${{ github.sha }} \n'
+ '- 编译日期: ${{ env.DATE }}\n'
+ '- 打包ci名: ${{ github.workflow }}\n'
})

View File

@ -25,12 +25,40 @@ jobs:
path: 3rdpart/libsrtp path: 3rdpart/libsrtp
- name: 编译 SRTP - name: 编译 SRTP
run: cd 3rdpart/libsrtp && ./configure --enable-openssl && make -j4 && sudo make install run: cd 3rdpart/libsrtp && ./configure --enable-openssl && make -j $(nproc) && sudo make install
- name: 编译 - name: 编译
run: mkdir -p linux_build && cd linux_build && cmake .. -DENABLE_WEBRTC=true -DENABLE_FFMPEG=true && make -j $(nproc) run: mkdir -p linux_build && cd linux_build && cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_FFMPEG=true && make -j $(nproc)
- name: 运行MediaServer - name: 设置环境变量
run: pwd && cd release/linux/Debug && sudo ./MediaServer -d & run: |
echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr -s "/\?%*:|\"<>" "_")" >> $GITHUB_ENV
echo "BRANCH2=$(echo ${GITHUB_REF#refs/heads/} )" >> $GITHUB_ENV
echo "DATE=$(date +%Y-%m-%d)" >> $GITHUB_ENV
- name: 打包二进制
id: upload
uses: actions/upload-artifact@v4
with:
name: ${{ github.workflow }}_${{ env.BRANCH }}_${{ env.DATE }}
path: release/*
if-no-files-found: error
retention-days: 1
- name: issue评论
if: github.event_name != 'pull_request'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: 483,
owner: context.repo.owner,
repo: context.repo.repo,
body: '- 下载地址: [${{ github.workflow }}_${{ env.BRANCH }}_${{ env.DATE }}](${{ steps.upload.outputs.artifact-url }})\n'
+ '- 分支: ${{ env.BRANCH2 }}\n'
+ '- git hash: ${{ github.sha }} \n'
+ '- 编译日期: ${{ env.DATE }}\n'
+ '- 打包ci名: ${{ github.workflow }}\n'
+ '- 说明: 本二进制在ubuntu-20.04(x64)上编译,请确保您的机器系统不低于此版本,并提前`sudo apt-get install -y libssl-dev libsdl-dev libavcodec-dev libavutil-dev libswscale-dev libresample-dev libusrsctp-dev`安装依赖项\n'
})

View File

@ -13,27 +13,52 @@ jobs:
- name: 下载submodule源码 - name: 下载submodule源码
run: mv -f .gitmodules_github .gitmodules && git submodule sync && git submodule update --init run: mv -f .gitmodules_github .gitmodules && git submodule sync && git submodule update --init
# - name: 安装brew - name: 配置 vcpkg
# run: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" uses: lukka/run-vcpkg@v7
# with:
# - name: brew安装依赖库(非必选) vcpkgDirectory: '${{github.workspace}}/vcpkg'
# run: brew update && brew install cmake openssl sdl2 ffmpeg vcpkgTriplet: arm64-osx
# 2024.06.01
# - name: 下载 SRTP vcpkgGitCommitId: '47364fbc300756f64f7876b549d9422d5f3ec0d3'
# uses: actions/checkout@v2 vcpkgArguments: 'openssl libsrtp[openssl]'
# with:
# repository: cisco/libsrtp
# fetch-depth: 1
# ref: v2.3.0
# path: 3rdpart/libsrtp
#
# - name: 编译 SRTP
# run: cd 3rdpart/libsrtp && ./configure --enable-openssl && make -j4 && sudo make install
- name: 编译 - name: 编译
run: mkdir -p build && cd build && cmake .. && make -j $(nproc) uses: lukka/run-cmake@v3
with:
useVcpkgToolchainFile: true
buildDirectory: '${{github.workspace}}/build'
cmakeAppendedArgs: ''
cmakeBuildType: 'Release'
- name: 运行MediaServer - name: 设置环境变量
run: pwd && cd release/darwin/Debug && sudo ./MediaServer -d & run: |
echo "BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr -s "/\?%*:|\"<>" "_")" >> $GITHUB_ENV
echo "BRANCH2=$(echo ${GITHUB_REF#refs/heads/} )" >> $GITHUB_ENV
echo "DATE=$(date +%Y-%m-%d)" >> $GITHUB_ENV
- name: 打包二进制
id: upload
uses: actions/upload-artifact@v4
with:
name: ${{ github.workflow }}_${{ env.BRANCH }}_${{ env.DATE }}
path: release/*
if-no-files-found: error
retention-days: 1
- name: issue评论
if: github.event_name != 'pull_request'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: 483,
owner: context.repo.owner,
repo: context.repo.repo,
body: '- 下载地址: [${{ github.workflow }}_${{ env.BRANCH }}_${{ env.DATE }}](${{ steps.upload.outputs.artifact-url }})\n'
+ '- 分支: ${{ env.BRANCH2 }}\n'
+ '- git hash: ${{ github.sha }} \n'
+ '- 编译日期: ${{ env.DATE }}\n'
+ '- 打包ci名: ${{ github.workflow }}\n'
+ '- 说明: 此二进制为arm64版本\n'
})

View File

@ -17,14 +17,50 @@ jobs:
with: with:
vcpkgDirectory: '${{github.workspace}}/vcpkg' vcpkgDirectory: '${{github.workspace}}/vcpkg'
vcpkgTriplet: x64-windows-static vcpkgTriplet: x64-windows-static
# 2021.05.12 # 2024.06.01
vcpkgGitCommitId: '5568f110b509a9fd90711978a7cb76bae75bb092' vcpkgGitCommitId: '47364fbc300756f64f7876b549d9422d5f3ec0d3'
vcpkgArguments: 'openssl libsrtp' vcpkgArguments: 'openssl libsrtp[openssl]'
- name: 编译 - name: 编译
uses: lukka/run-cmake@v3 uses: lukka/run-cmake@v3
with: with:
useVcpkgToolchainFile: true useVcpkgToolchainFile: true
buildDirectory: '${{github.workspace}}/build' buildDirectory: '${{github.workspace}}/build'
cmakeAppendedArgs: '-DCMAKE_ENABLE_WEBRTC:BOOL=ON' cmakeAppendedArgs: ''
cmakeBuildType: 'RelWithDebInfo' cmakeBuildType: 'Release'
- name: 设置环境变量
run: |
$dateString = Get-Date -Format "yyyy-MM-dd"
$branch = $env:GITHUB_REF -replace "refs/heads/", "" -replace "[\\/\\\?\%\*:\|\x22<>]", "_"
$branch2 = $env:GITHUB_REF -replace "refs/heads/", ""
echo "BRANCH=$branch" >> $env:GITHUB_ENV
echo "BRANCH2=$branch2" >> $env:GITHUB_ENV
echo "DATE=$dateString" >> $env:GITHUB_ENV
- name: 打包二进制
id: upload
uses: actions/upload-artifact@v4
with:
name: ${{ github.workflow }}_${{ env.BRANCH }}_${{ env.DATE }}
path: release/*
if-no-files-found: error
retention-days: 1
- name: issue评论
if: github.event_name != 'pull_request'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: 483,
owner: context.repo.owner,
repo: context.repo.repo,
body: '- 下载地址: [${{ github.workflow }}_${{ env.BRANCH }}_${{ env.DATE }}](${{ steps.upload.outputs.artifact-url }})\n'
+ '- 分支: ${{ env.BRANCH2 }}\n'
+ '- git hash: ${{ github.sha }} \n'
+ '- 编译日期: ${{ env.DATE }}\n'
+ '- 打包ci名: ${{ github.workflow }}\n'
+ '- 说明: 此二进制为x64版本\n'
})

View File

@ -159,12 +159,15 @@
- 2、作为独立的流媒体服务器使用不想做c/c++开发的,可以参考 [restful api](https://github.com/ZLMediaKit/ZLMediaKit/wiki/MediaServer支持的HTTP-API) 和 [web hook](https://github.com/ZLMediaKit/ZLMediaKit/wiki/MediaServer支持的HTTP-HOOK-API ). - 2、作为独立的流媒体服务器使用不想做c/c++开发的,可以参考 [restful api](https://github.com/ZLMediaKit/ZLMediaKit/wiki/MediaServer支持的HTTP-API) 和 [web hook](https://github.com/ZLMediaKit/ZLMediaKit/wiki/MediaServer支持的HTTP-HOOK-API ).
- 3、如果想做c/c++开发,添加业务逻辑增加功能,可以参考这里的[测试程序](https://github.com/ZLMediaKit/ZLMediaKit/tree/master/tests). - 3、如果想做c/c++开发,添加业务逻辑增加功能,可以参考这里的[测试程序](https://github.com/ZLMediaKit/ZLMediaKit/tree/master/tests).
## 二进制文件下载
zlmediakit采用 github action 持续集成自动编译打包上传编译产出包,请在[issue列表](https://github.com/ZLMediaKit/ZLMediaKit/issues/483)下载最新sdk库文件以及可执行文件。
## Docker 镜像 ## Docker 镜像
你可以从Docker Hub下载已经编译好的镜像并启动它 你可以从Docker Hub下载已经编译好的镜像并启动它
```bash ```bash
#此镜像为github持续集成自动编译推送,跟代码(master分支)保持最新状态 #此镜像为github action 持续集成自动编译推送,跟代码(master分支)保持最新状态
docker run -id -p 1935:1935 -p 8080:80 -p 8443:443 -p 8554:554 -p 10000:10000 -p 10000:10000/udp -p 8000:8000/udp -p 9000:9000/udp zlmediakit/zlmediakit:master docker run -id -p 1935:1935 -p 8080:80 -p 8443:443 -p 8554:554 -p 10000:10000 -p 10000:10000/udp -p 8000:8000/udp -p 9000:9000/udp zlmediakit/zlmediakit:master
``` ```

View File

@ -324,6 +324,10 @@ git submodule update --init
}); });
``` ```
## Binary file download
zlmediakit uses github action to continuously integrate automatic compilation package and upload the compilation output package. Please download the latest sdk library file and executable file at [issue list] (https://github.com/ZLMediaKit/ZLMediaKit/issues/483).
## Docker Image ## Docker Image
You can download the pre-compiled image from Docker Hub and start it: You can download the pre-compiled image from Docker Hub and start it:

View File

@ -43,7 +43,7 @@ WORKDIR /opt/media/ZLMediaKit
# 3rdpart init # 3rdpart init
WORKDIR /opt/media/ZLMediaKit/3rdpart WORKDIR /opt/media/ZLMediaKit/3rdpart
RUN wget https://mirror.ghproxy.com/https://github.com/cisco/libsrtp/archive/v2.3.0.tar.gz -O libsrtp-2.3.0.tar.gz && \ RUN wget https://github.com/cisco/libsrtp/archive/v2.3.0.tar.gz -O libsrtp-2.3.0.tar.gz && \
tar xfv libsrtp-2.3.0.tar.gz && \ tar xfv libsrtp-2.3.0.tar.gz && \
mv libsrtp-2.3.0 libsrtp && \ mv libsrtp-2.3.0 libsrtp && \
cd libsrtp && ./configure --enable-openssl && make -j $(nproc) && make install cd libsrtp && ./configure --enable-openssl && make -j $(nproc) && make install