|
| 1 | +name: build-debug |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + buildType: |
| 7 | + required: true |
| 8 | + type: choice |
| 9 | + options: |
| 10 | + - Debug |
| 11 | + - RelWithDebInfo |
| 12 | + default: Debug |
| 13 | + loopCount: |
| 14 | + required: true |
| 15 | + type: number |
| 16 | + defualt: 10 |
| 17 | + |
| 18 | +env: |
| 19 | + TEST_SIGNALING_URLS: ${{ secrets.TEST_SIGNALING_URLS }} |
| 20 | + TEST_CHANNEL_ID_PREFIX: ${{ secrets.TEST_CHANNEL_ID_PREFIX }} |
| 21 | + TEST_SECRET_KEY: ${{ secrets.TEST_SECRET_KEY }} |
| 22 | + TEST_API_URL: ${{ secrets.TEST_API_URL }} |
| 23 | + OPENH264_VERSION: 2.6.0 |
| 24 | + |
| 25 | +jobs: |
| 26 | + build-linux: |
| 27 | + strategy: |
| 28 | + fail-fast: false |
| 29 | + matrix: |
| 30 | + platform: |
| 31 | + - name: ubuntu-24.04_x86_64 |
| 32 | + runs-on: ubuntu-24.04 |
| 33 | + python: |
| 34 | + - version: "3.10" |
| 35 | + soname: sora_sdk_ext.cpython-310-x86_64-linux-gnu.so |
| 36 | + - version: "3.11" |
| 37 | + soname: sora_sdk_ext.cpython-311-x86_64-linux-gnu.so |
| 38 | + - version: "3.12" |
| 39 | + soname: sora_sdk_ext.cpython-312-x86_64-linux-gnu.so |
| 40 | + - version: "3.13" |
| 41 | + soname: sora_sdk_ext.cpython-313-x86_64-linux-gnu.so |
| 42 | + runs-on: ${{ matrix.platform.runs-on }} |
| 43 | + steps: |
| 44 | + - name: buildType=${{ inputs.buildTYpe }} loopCount=${{ inputs.loopCount }} |
| 45 | + # 1 <= loopCount <= 100 |
| 46 | + run: test 1 -le ${{ inputs.loopCount }} -a ${{ inputs.loopCount }} -le 100 |
| 47 | + - name: Disk Cleanup |
| 48 | + run: | |
| 49 | + set -x |
| 50 | + df -h |
| 51 | + # sudo du -h -d1 /usr/local |
| 52 | + # sudo du -h -d1 /usr/local/share |
| 53 | + # sudo du -h -d1 /usr/local/lib |
| 54 | + # sudo du -h -d1 /usr/share |
| 55 | + RMI=`docker images -q -a` |
| 56 | + if [ -n "$RMI" ]; then |
| 57 | + docker rmi $RMI |
| 58 | + fi |
| 59 | + # 4.6G |
| 60 | + sudo rm -rf /usr/local/.ghcup |
| 61 | + # 1.7G |
| 62 | + sudo rm -rf /usr/share/swift |
| 63 | + # 1.4G |
| 64 | + sudo rm -rf /usr/share/dotnet |
| 65 | + # 13G |
| 66 | + sudo rm -rf /usr/local/lib/android |
| 67 | + df -h |
| 68 | + - name: Get stats |
| 69 | + run: | |
| 70 | + set -x |
| 71 | + cat /etc/lsb-release |
| 72 | + uname -a |
| 73 | + cat /proc/cpuinfo |
| 74 | + cat /proc/meminfo |
| 75 | + - name: Setup Git User |
| 76 | + run: | |
| 77 | + git config --global user.name "${{ github.actor }}" |
| 78 | + git config --global user.email "${{ github.actor }}@users.noreply.github.com" |
| 79 | +
|
| 80 | + - name: Setup common |
| 81 | + run: | |
| 82 | + # clang-18 |
| 83 | + wget https://apt.llvm.org/llvm.sh |
| 84 | + chmod a+x llvm.sh |
| 85 | + sudo ./llvm.sh 18 |
| 86 | +
|
| 87 | + - uses: actions/checkout@v4 |
| 88 | + with: |
| 89 | + path: sora-python-sdk |
| 90 | + - name: Get versions |
| 91 | + id: version |
| 92 | + run: | |
| 93 | + source sora-python-sdk/VERSION |
| 94 | + echo "webrtc_build_version=${WEBRTC_BUILD_VERSION}" >> $GITHUB_OUTPUT |
| 95 | + echo "sora_cpp_sdk_version=${SORA_CPP_SDK_VERSION}" >> $GITHUB_OUTPUT |
| 96 | + echo "boost_version=${BOOST_VERSION}" >> $GITHUB_OUTPUT |
| 97 | +
|
| 98 | + # libwebrtc |
| 99 | + - uses: actions/cache@v4 |
| 100 | + id: webrtc-build-cache |
| 101 | + with: |
| 102 | + path: webrtc-build/_package/${{ matrix.platform.name }}/webrtc |
| 103 | + key: webrtc-build-${{ inputs.buildType }}-${{ matrix.platform.name }}-${{ steps.version.outputs.webrtc_build_version }} |
| 104 | + - uses: actions/checkout@v4 |
| 105 | + if: steps.webrtc-build-cache.outputs.cache-hit != 'true' && inputs.buildType == 'Debug' |
| 106 | + with: |
| 107 | + path: webrtc-build |
| 108 | + repository: shiguredo-webrtc-build/webrtc-build |
| 109 | + ref: ${{ steps.version.outputs.webrtc_build_version }} |
| 110 | + - name: Setup libwebrtc |
| 111 | + if: steps.webrtc-build-cache.outputs.cache-hit != 'true' && inputs.buildType == 'Debug' |
| 112 | + run: | |
| 113 | + sudo bash -c ' |
| 114 | + set -ex |
| 115 | + apt-get -y install tzdata |
| 116 | + echo "Asia/Tokyo" > /etc/timezone |
| 117 | + dpkg-reconfigure -f noninteractive tzdata |
| 118 | + export DEBIAN_FRONTEND=noninteractive |
| 119 | + apt-get -y install \ |
| 120 | + binutils \ |
| 121 | + git \ |
| 122 | + locales \ |
| 123 | + lsb-release \ |
| 124 | + ninja-build \ |
| 125 | + pkg-config \ |
| 126 | + python3 \ |
| 127 | + python3-setuptools \ |
| 128 | + rsync \ |
| 129 | + sudo \ |
| 130 | + unzip \ |
| 131 | + vim \ |
| 132 | + wget \ |
| 133 | + xz-utils |
| 134 | + ' |
| 135 | + - name: Build libwebrtc |
| 136 | + if: steps.webrtc-build-cache.outputs.cache-hit != 'true' && inputs.buildType == 'Debug' |
| 137 | + working-directory: webrtc-build |
| 138 | + run: | |
| 139 | + python3 run.py build ${{ inputs.buildType == 'Debug' && '--debug' }} ${{ matrix.platform.name }} |
| 140 | + python3 run.py package ${{ inputs.buildType == 'Debug' && '--debug' }} ${{ matrix.platform.name }} |
| 141 | +
|
| 142 | + # sora-cpp-sdk |
| 143 | + - uses: actions/cache@v4 |
| 144 | + id: sora-cpp-sdk-cache |
| 145 | + with: |
| 146 | + path: sora-cpp-sdk/_install/${{ matrix.platform.name }}/${{ inputs.buildType == 'Debug' && 'debug' || 'release' }}/sora |
| 147 | + key: sora-cpp-sdk-${{ inputs.buildType }}-${{ matrix.platform.name }}-${{ steps.version.outputs.sora_cpp_sdk_version }} |
| 148 | + - uses: actions/cache@v4 |
| 149 | + id: boost-cache |
| 150 | + with: |
| 151 | + path: sora-cpp-sdk/_install/${{ matrix.platform.name }}/${{ inputs.buildType == 'Debug' && 'debug' || 'release' }}/boost |
| 152 | + key: boost-${{ inputs.buildType }}-${{ matrix.platform.name }}-${{ steps.version.outputs.sora_cpp_sdk_version }} |
| 153 | + - uses: actions/checkout@v4 |
| 154 | + if: steps.sora-cpp-sdk-cache.outputs.cache-hit != 'true' |
| 155 | + with: |
| 156 | + path: sora-cpp-sdk |
| 157 | + repository: shiguredo/sora-cpp-sdk |
| 158 | + ref: ${{ steps.version.outputs.sora_cpp_sdk_version }} |
| 159 | + # Ubuntu 24.04 だと libtinfo5 が見つからない問題があるので、その修正 |
| 160 | + # ref: https://qiita.com/gengen16k/items/88cf3c18a40a94205fab |
| 161 | + - name: Fix CUDA issues for Ubuntu 24.04 |
| 162 | + if: steps.sora-cpp-sdk-cache.outputs.cache-hit != 'true' && matrix.platform.name == 'ubuntu-24.04_x86_64' |
| 163 | + run: | |
| 164 | + sudo tee /etc/apt/sources.list.d/jammy.list << EOF |
| 165 | + deb http://archive.ubuntu.com/ubuntu/ jammy universe |
| 166 | + EOF |
| 167 | +
|
| 168 | + sudo tee /etc/apt/preferences.d/pin-jammy <<EOF |
| 169 | + Package: * |
| 170 | + Pin: release n=jammy |
| 171 | + Pin-Priority: -10 |
| 172 | +
|
| 173 | + Package: libtinfo5 |
| 174 | + Pin: release n=jammy |
| 175 | + Pin-Priority: 990 |
| 176 | + EOF |
| 177 | + - name: Setup sora-cpp-sdk |
| 178 | + if: steps.sora-cpp-sdk-cache.outputs.cache-hit != 'true' |
| 179 | + working-directory: sora-cpp-sdk |
| 180 | + run: | |
| 181 | + source VERSION |
| 182 | + sudo apt-get update |
| 183 | + sudo apt-get install -y software-properties-common |
| 184 | +
|
| 185 | + # X11 |
| 186 | + sudo apt-get install -y libx11-dev libxext-dev |
| 187 | +
|
| 188 | + # CUDA |
| 189 | + wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb |
| 190 | + sudo dpkg -i libssl1.1_1.1.0g-2ubuntu4_amd64.deb |
| 191 | + wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb |
| 192 | + sudo dpkg -i cuda-keyring_*all.deb |
| 193 | + sudo apt-get update |
| 194 | + DEBIAN_FRONTEND=noninteractive sudo apt-get -y install cuda=$CUDA_VERSION |
| 195 | +
|
| 196 | + # Intel Media SDK のために libva-dev, libdrm-dev を入れる |
| 197 | + DEBIAN_FRONTEND=noninteractive sudo apt-get -y install libva-dev libdrm-dev |
| 198 | + - name: Copy libwebrtc to sora-cpp-sdk |
| 199 | + if: steps.sora-cpp-sdk-cache.outputs.cache-hit != 'true' && inputs.buildType == 'Debug' |
| 200 | + run: | |
| 201 | + mkdir -p sora-cpp-sdk/_install/${{ matrix.platform.name }}/${{ inputs.buildType == 'Debug' && 'debug' || 'release' }} |
| 202 | + cp -r webrtc-build/_package/${{ matrix.platform.name }}/webrtc sora-cpp-sdk/_install/${{ matrix.platform.name }}/${{ inputs.buildType == 'Debug' && 'debug' || 'release' }}/webrtc |
| 203 | + echo ${{ steps.version.outputs.webrtc_build_version }} > sora-cpp-sdk/_install/${{ matrix.platform.name }}/${{ inputs.buildType == 'Debug' && 'debug' || 'release' }}/webrtc.version |
| 204 | + - name: Build sora-cpp-sdk |
| 205 | + if: steps.sora-cpp-sdk-cache.outputs.cache-hit != 'true' |
| 206 | + working-directory: sora-cpp-sdk |
| 207 | + run: python3 run.py ${{ inputs.buildType == 'Debug' && '--debug' || '--relwithdebinfo' }} ${{ matrix.platform.name }} |
| 208 | + - name: Teardown sora-cpp-sdk |
| 209 | + if: steps.sora-cpp-sdk-cache.outputs.cache-hit != 'true' |
| 210 | + run: | |
| 211 | + # CUDA が入ってると使おうとしてエラーになるのでアンインストールしておく |
| 212 | + sudo apt-get remove -y cuda |
| 213 | + sudo apt-get autoremove -y |
| 214 | +
|
| 215 | + # sora-python-sdk |
| 216 | + - name: Setup sora-python-sdk |
| 217 | + run: | |
| 218 | + sudo apt-get update |
| 219 | + sudo apt-get -y install libva2 libdrm2 libva-dev libdrm-dev libx11-dev portaudio19-dev |
| 220 | +
|
| 221 | + # Download OpneH264 |
| 222 | + curl -LO http://ciscobinary.openh264.org/libopenh264-${{ env.OPENH264_VERSION }}-linux64.7.so.bz2 |
| 223 | + bzip2 -d libopenh264-${{ env.OPENH264_VERSION }}-linux64.7.so.bz2 |
| 224 | + mv libopenh264-${{ env.OPENH264_VERSION }}-linux64.7.so libopenh264.so |
| 225 | + echo "OPENH264_PATH=`pwd`/libopenh264.so" >> $GITHUB_ENV |
| 226 | + - name: Copy libwebrtc to sora-python-sdk |
| 227 | + if: inputs.buildType == 'Debug' |
| 228 | + run: | |
| 229 | + mkdir -p sora-python-sdk/_install/${{ matrix.platform.name }}/${{ inputs.buildType == 'Debug' && 'debug' || 'release' }} |
| 230 | + cp -r webrtc-build/_package/${{ matrix.platform.name }}/webrtc sora-python-sdk/_install/${{ matrix.platform.name }}/webrtc |
| 231 | + echo ${{ steps.version.outputs.webrtc_build_version }} > sora-python-sdk/_install/${{ matrix.platform.name }}/webrtc.version |
| 232 | + - name: Copy sora-cpp-sdk to sora-python-sdk |
| 233 | + run: | |
| 234 | + mkdir -p sora-python-sdk/_install/${{ matrix.platform.name }}/${{ inputs.buildType == 'Debug' && 'debug' || 'release' }} |
| 235 | + cp -r sora-cpp-sdk/_install/${{ matrix.platform.name }}/${{ inputs.buildType == 'Debug' && 'debug' || 'release' }}/sora sora-python-sdk/_install/${{ matrix.platform.name }}/sora |
| 236 | + echo ${{ steps.version.outputs.sora_cpp_sdk_version }} > sora-python-sdk/_install/${{ matrix.platform.name }}/sora.version |
| 237 | + - name: Copy boost to sora-python-sdk |
| 238 | + run: | |
| 239 | + mkdir -p sora-python-sdk/_install/${{ matrix.platform.name }}/${{ inputs.buildType == 'Debug' && 'debug' || 'release' }} |
| 240 | + cp -r sora-cpp-sdk/_install/${{ matrix.platform.name }}/${{ inputs.buildType == 'Debug' && 'debug' || 'release' }}/boost sora-python-sdk/_install/${{ matrix.platform.name }}/boost |
| 241 | + echo ${{ steps.version.outputs.boost_version }} > sora-python-sdk/_install/${{ matrix.platform.name }}/boost.version |
| 242 | + - uses: actions/cache@v4 |
| 243 | + id: llvm-cache |
| 244 | + with: |
| 245 | + path: sora-python-sdk/_install/${{ matrix.platform.name }}/llvm |
| 246 | + key: llvm-${{ inputs.buildType }}-${{ matrix.platform.name }}-${{ steps.version.outputs.sora_cpp_sdk_version }} |
| 247 | + - uses: actions/cache@v4 |
| 248 | + id: version-file-cache |
| 249 | + with: |
| 250 | + path: versions |
| 251 | + key: versions-${{ inputs.buildType }}-${{ matrix.platform.name }}-${{ steps.version.outputs.sora_cpp_sdk_version }} |
| 252 | + - name: Copy version file |
| 253 | + if: steps.version-file-cache.outputs.cache-hit == 'true' |
| 254 | + run: cp versions/llvm.version sora-python-sdk/_install/${{ matrix.platform.name }}/ |
| 255 | + - uses: astral-sh/setup-uv@v5 |
| 256 | + - name: Build sora-python-sdk |
| 257 | + working-directory: sora-python-sdk |
| 258 | + run: | |
| 259 | + set -x |
| 260 | + uv python pin ${{ matrix.python.version }} |
| 261 | + uv sync |
| 262 | + uv run python run.py ${{ inputs.buildType == 'Debug' && '--debug' || '--relwithdebinfo' }} ${{ matrix.platform.name }} |
| 263 | + # cache |
| 264 | + mkdir -p ../versions |
| 265 | + cp _install/${{ matrix.platform.name }}/llvm.version ../versions |
| 266 | + - name: Upload sora_sdk_ext.so |
| 267 | + uses: actions/upload-artifact@v4 |
| 268 | + with: |
| 269 | + name: ${{ matrix.python.soname }} |
| 270 | + path: sora-python-sdk/src/sora_sdk/${{ matrix.python.soname }} |
| 271 | + - name: E2E Test sora-python-sdk |
| 272 | + working-directory: sora-python-sdk |
| 273 | + run: | |
| 274 | + for i in {1..${{ inputs.loopCount || 10 }}}; do |
| 275 | + echo "---------------- $i 回目 ----------------" |
| 276 | + sleep 10 |
| 277 | + lldb-18 --batch -o 'command script import test_with_llvm.py' -o 'test' |
| 278 | + done |
0 commit comments