Skip to content

WebRTC

WebRTC #10

Workflow file for this run

name: WebRTC
permissions: {}
on:
workflow_dispatch:
inputs:
webrtc_commit:
description: 'WebRTC src commit (full or short).'
required: false
default: 'e8b4d4c5952a8fb7b35c2a6cba4e8c3de2ea2e1e'
depot_tools_commit:
description: 'depot_tools commit (override pin in webrtc_build.sh).'
required: false
default: '10eda50a3fd9c34ad8d31ec74e5f4eb5823d60f6'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
WEBRTC_COMMIT: ${{ github.event.inputs.webrtc_commit }}
DEPOT_TOOLS_COMMIT: ${{ github.event.inputs.depot_tools_commit }}
WEBRTC_WORK_ROOT: ${{ github.workspace }}/..
GCLIENT_JOBS: 8
jobs:
Unix:
permissions:
contents: read
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
package_suffix: linux_cxx-abi-1
- os: macos-14
package_suffix: macos_arm64
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies (Ubuntu)
if: matrix.os == 'ubuntu-22.04'
run: |
source 3rdparty/webrtc/webrtc_build.sh
install_dependencies_ubuntu
- name: Download WebRTC sources
run: |
source 3rdparty/webrtc/webrtc_build.sh
download_webrtc_sources
- name: Build WebRTC
run: |
source 3rdparty/webrtc/webrtc_build.sh
build_webrtc
- name: Upload WebRTC
uses: actions/upload-artifact@v4
with:
name: webrtc_${{ matrix.package_suffix }}
path: |
webrtc_*.tar.gz
checksum_webrtc_*.tar.gz
if-no-files-found: error
Windows:
permissions:
contents: read
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
include:
- config: Release
static_runtime: ON
tag: Release_mt
- config: Release
static_runtime: OFF
tag: Release_md
- config: Debug
static_runtime: ON
tag: Debug_mt
- config: Debug
static_runtime: OFF
tag: Debug_md
env:
WORK_DIR: 'C:\WebRTC'
OPEN3D_DIR: ${{ github.workspace }}
WEBRTC_WORK_ROOT: 'C:\WebRTC'
DEPOT_TOOLS_UPDATE: 0 # belt-and-suspenders; also set by webrtc_setup_path
DEPOT_TOOLS_WIN_TOOLCHAIN: 0 # use locally installed VS, not the Chromium toolchain
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Prepare work directory
shell: pwsh
run: |
Get-PSDrive
New-Item -ItemType Directory -Force -Path $env:WORK_DIR
- name: Setup PATH for Visual Studio
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
- name: Download WebRTC sources
# shell: bash uses Git Bash on Windows, which transparently converts
# Windows-style env paths (e.g. OPEN3D_DIR, WEBRTC_WORK_ROOT) so they
# work in bash string and pushd contexts.
shell: bash
run: |
source "$OPEN3D_DIR/3rdparty/webrtc/webrtc_build.sh"
download_webrtc_sources
- name: Patch WebRTC
shell: pwsh
working-directory: ${{ env.WORK_DIR }}
run: |
$ErrorActionPreference = 'Stop'
Copy-Item "$env:OPEN3D_DIR/3rdparty/webrtc/CMakeLists.txt" webrtc/
Copy-Item "$env:OPEN3D_DIR/3rdparty/webrtc/webrtc_common.cmake" webrtc/
bash "$env:OPEN3D_DIR/3rdparty/webrtc/apply_webrtc_patches.sh" `
"$env:OPEN3D_DIR" "$env:WORK_DIR/webrtc/src"
- name: Build and package WebRTC
shell: pwsh
working-directory: ${{ env.WORK_DIR }}
env:
BUILD_CONFIG: ${{ matrix.config }}
STATIC_RT: ${{ matrix.static_runtime }}
WIN_TAG: ${{ matrix.tag }}
run: |
$ErrorActionPreference = 'Stop'
$env:Path = (Get-Item depot_tools).FullName + ';' + $env:Path
$installRoot = Join-Path $env:WORK_DIR "webrtc_pkg"
if (Test-Path $installRoot) { Remove-Item -Recurse -Force $installRoot }
New-Item -ItemType Directory -Force -Path webrtc/build | Out-Null
Push-Location webrtc/build
$debugFlag = if ($env:BUILD_CONFIG -eq 'Debug') { 'ON' } else { 'OFF' }
cmake -G Ninja `
-D CMAKE_BUILD_TYPE=$env:BUILD_CONFIG `
-D WEBRTC_IS_DEBUG=$debugFlag `
-D WEBRTC_STATIC_MSVC_RUNTIME=$env:STATIC_RT `
-D CMAKE_INSTALL_PREFIX=$installRoot `
..
ninja install
Pop-Location
$short = (git -C webrtc/src rev-parse --short=7 HEAD)
$zip = "webrtc_${short}_win_$env:WIN_TAG.zip"
Push-Location $installRoot
cmake -E tar cvf (Join-Path $env:OPEN3D_DIR $zip) --format=zip .
Pop-Location
cmake -E sha256sum (Join-Path $env:OPEN3D_DIR $zip) | Tee-Object -FilePath (Join-Path $env:OPEN3D_DIR "checksum_$zip")
- name: Upload WebRTC
uses: actions/upload-artifact@v4
with:
name: webrtc_win_${{ matrix.tag }}
path: |
webrtc_*_win_*.zip
checksum_webrtc_*_win_*.zip
if-no-files-found: error