From bb865de677a953682ea9b8249ecb482f3654d38b Mon Sep 17 00:00:00 2001 From: xia-chu <771730766@qq.com> Date: Tue, 10 Feb 2026 11:43:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9EmacOS=5FPython=20ci?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/macos_py.yml | 80 ++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .github/workflows/macos_py.yml diff --git a/.github/workflows/macos_py.yml b/.github/workflows/macos_py.yml new file mode 100644 index 00000000..2c29a076 --- /dev/null +++ b/.github/workflows/macos_py.yml @@ -0,0 +1,80 @@ +name: macOS_Python + +on: [push, pull_request] + +jobs: + build: + + runs-on: macOS-latest + + steps: + - uses: actions/checkout@v1 + + - name: 下载submodule源码 + run: mv -f .gitmodules_github .gitmodules && git submodule sync && git submodule update --init + + - name: 配置 vcpkg + uses: lukka/run-vcpkg@v7 + with: + vcpkgDirectory: '${{github.workspace}}/vcpkg' + vcpkgTriplet: arm64-osx + # 2025.07.11 + vcpkgGitCommitId: 'efcfaaf60d7ec57a159fc3110403d939bfb69729' + vcpkgArguments: 'openssl libsrtp[openssl] usrsctp' + + - name: 安装指定 CMake + uses: jwlawson/actions-setup-cmake@v2 + with: + cmake-version: '3.30.5' + + - name: 检查并设置 Python 3 + run: | + PYTHON_ROOT=$(python3 -c "import sys; print(sys.prefix)") + echo "PYTHON_ROOT=$PYTHON_ROOT" >> $GITHUB_ENV + PYTHON_EXECUTABLE=$(which python3) + echo "PYTHON_EXECUTABLE=$PYTHON_EXECUTABLE" >> $GITHUB_ENV + + - name: 编译 + uses: lukka/run-cmake@v3 + with: + useVcpkgToolchainFile: true + cmakeBuildType: Release + cmakeListsOrSettingsJson: CMakeListsTxtAdvanced + buildDirectory: '${{github.workspace}}/build' + buildWithCMakeArgs: '--config Release' + cmakeAppendedArgs: '-DPYTHON_EXECUTABLE=${{ env.PYTHON_EXECUTABLE }} -DENABLE_PYTHON=ON -DENABLE_API=OFF -DENABLE_TESTS=OFF -DCMAKE_BUILD_TYPE=Release' + + - 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: release/* + if-no-files-found: error + retention-days: 90 + + - name: issue评论 + if: github.event_name != 'pull_request' && github.ref != 'refs/heads/feature/test' + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + github.rest.issues.createComment({ + issue_number: ${{vars.VERSION_ISSUE_NO}}, + 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' + + '- 编译记录: [${{ github.run_id }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})\n' + + '- 打包ci名: ${{ github.workflow }}\n' + + '- 开启特性: openssl/webrtc/datachannel\n' + + '- 说明: 此二进制为arm64版本; 本程序依赖python3.14, 运行前请brew install python@3.14安装\n' + }) \ No newline at end of file