Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Commit 26533ac

Browse files
authored
Add a workflow for WebTransport E2E test. (#1040)
* Add a workflow for WebTransport E2E test. * Add karma tests. * Address comments. * Remove unnecessary methods from sample service for E2E test. * Remove owt.js and rest-sample.js.
1 parent 8c959bc commit 26533ac

23 files changed

+4777
-30
lines changed

.github/workflows/webtransport.yaml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: WebTransport E2E Test
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
ci:
7+
runs-on: ubuntu-18.04
8+
services:
9+
rabbitmq:
10+
image: rabbitmq:latest
11+
ports:
12+
- 5672:5672
13+
steps:
14+
- uses: actions/checkout@v2
15+
name: Checkout server code
16+
- uses: actions/checkout@v2
17+
name: Checkout JavaScript SDK and sample
18+
with:
19+
repository: open-webrtc-toolkit/owt-client-javascript
20+
path: third_party/owt-client-javascript/
21+
- uses: actions/setup-node@v2
22+
with:
23+
node-version: "10"
24+
- uses: actions/setup-python@v2
25+
with:
26+
python-version: '3.x'
27+
- run: npm install
28+
name: Install dependencies for JavaScript SDK
29+
working-directory: third_party/owt-client-javascript/scripts
30+
- run: mkdir -p third_party/quic-transport
31+
name: Create directory for QUIC SDK
32+
- name: Download QUIC SDK
33+
uses: dawidd6/action-download-artifact@v2
34+
with:
35+
github_token: ${{secrets.GITHUB_TOKEN}}
36+
workflow: ci.yaml
37+
branch: main
38+
event: push
39+
name: quic-sdk-ubuntu-x64-ci
40+
path: third_party/quic-transport
41+
repo: open-webrtc-toolkit/owt-sdk-quic
42+
- name: Generate certificates
43+
run: |
44+
wget https://chromium.googlesource.com/chromium/src/+archive/refs/tags/93.0.4575.1/net/tools/quic/certs.tar.gz
45+
tar xvzf certs.tar.gz
46+
./generate-certs.sh
47+
openssl pkcs12 -inkey out/leaf_cert.key -in out/leaf_cert.pem -export -out out/leaf_cert.pfx -passout pass:abc123
48+
working-directory: ./source/agent/quic/e2e-test/scripts
49+
- name: Install dependencies
50+
run: ./installDepsUnattended.sh
51+
working-directory: ./scripts
52+
- run: grunt
53+
name: Build JavaScript SDK and sample release package
54+
working-directory: third_party/owt-client-javascript/scripts
55+
- name: Build and pack server
56+
run: |
57+
./scripts/build.js -t quic -t internal-io -t logger -c
58+
./scripts/pack.js -t conference-agent -t quic-agent -t management-api -t cluster-manager -t portal -p third_party/owt-client-javascript/dist/samples/conference -i
59+
- name: Start server
60+
run: |
61+
cp ./source/agent/quic/e2e-test/scripts/out/leaf_cert.pfx dist/quic_agent/cert/certificate.pfx
62+
cp ./source/agent/quic/e2e-test/config/management_api.toml dist/management_api/management_api.toml
63+
cp ./source/agent/quic/e2e-test/config/quic_agent.toml dist/quic_agent/agent.toml
64+
cp ./source/agent/quic/e2e-test/config/portal.toml dist/portal/portal.toml
65+
cp ./source/agent/quic/e2e-test/service/rest_service.js dist/apps/current_app/samplertcservice.js
66+
./dist/bin/init-webtransport.sh
67+
- name: Prepare testing environment
68+
run: python3 prepare.py
69+
working-directory: ./source/agent/quic/e2e-test/scripts
70+
- run: npm install
71+
name: Install dependencies for E2E test
72+
working-directory: ./source/agent/quic/e2e-test
73+
- run: node_modules/karma/bin/karma start e2e-test/config/karma.config.js --cert_fingerprint="$(openssl x509 -noout -fingerprint -sha256 -inform pem -in e2e-test/scripts/out/leaf_cert.pem | cut -c20-124)"
74+
working-directory: ./source/agent/quic
75+
name: Run E2E tests
76+
- uses: actions/upload-artifact@v2
77+
name: Upload log
78+
with:
79+
name: log
80+
path: dist/logs
81+
retention-days: 1
82+
if: ${{ always() }}

scripts/installCommonDeps.sh

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -308,27 +308,30 @@ install_quic(){
308308
tar xzf dist.tgz
309309
popd
310310

311-
# QUIC transport
312-
local QUIC_SDK_VERSION=`cat ${ROOT}/source/agent/addons/quic/quic_sdk_version`
313-
local QUIC_TRANSPORT_PATH=${ROOT}/third_party/quic-transport
314-
local QUIC_HEADERS_DIR=${ROOT}/build/libdeps/build/include/owt
315-
if [ -d ${QUIC_TRANSPORT_PATH} ]; then
316-
rm -r ${QUIC_TRANSPORT_PATH}
317-
fi
318-
mkdir ${QUIC_TRANSPORT_PATH}
319-
pushd ${QUIC_TRANSPORT_PATH}
320-
if wget ${QUIC_TRANSPORT_PACKAGE_URL_PREFIX}/linux/${QUIC_SDK_VERSION}.zip; then
321-
unzip ${QUIC_SDK_VERSION}.zip
322-
rm ${QUIC_SDK_VERSION}.zip
323-
cp bin/release/libowt_quic_transport.so ${ROOT}/build/libdeps/build/lib
324-
if [ -d ${QUIC_HEADERS_DIR} ]; then
325-
rm -r ${QUIC_HEADERS_DIR}
311+
# WebTransport
312+
if [ "$ENABLE_WEBTRANSPORT" == "true" ]; then
313+
local QUIC_SDK_PACKAGE_NAME="quic-sdk-ubuntu-x64-ci"
314+
local QUIC_SDK_URL=`cat ${ROOT}/source/agent/addons/quic/quic_sdk_url`
315+
local QUIC_TRANSPORT_PATH=${ROOT}/third_party/quic-transport
316+
local QUIC_HEADERS_DIR=${ROOT}/build/libdeps/build/include/owt
317+
pushd ${QUIC_TRANSPORT_PATH}
318+
if [ ! -d ${QUIC_HEADERS_DIR} ]; then
319+
mkdir -p ${QUIC_HEADERS_DIR}
326320
fi
327-
cp -r include/owt ${QUIC_HEADERS_DIR}
328-
else
329-
read -p "Failed to download prebuild QUIC SDK. Please download and compile QUIC SDK version ${QUIC_SDK_VERSION} from https://github.com/open-webrtc-toolkit/owt-deps-quic."
321+
if [ ! -d ${ROOT}/build/libdeps/build/lib ]; then
322+
mkdir -p ${ROOT}/build/libdeps/build/lib
323+
fi
324+
if [ -d bin/release ]; then
325+
cp bin/release/libowt_web_transport.so ${ROOT}/build/libdeps/build/lib
326+
if [ -d ${QUIC_HEADERS_DIR} ]; then
327+
rm -r ${QUIC_HEADERS_DIR}
328+
fi
329+
cp -r include/owt ${QUIC_HEADERS_DIR}
330+
else
331+
read -p "Unable to find prebuild QUIC SDK. Please download it from ${QUIC_SDK_URL} with a GitHub personal access token or compile it from https://github.com/open-webrtc-toolkit/owt-sdk-quic."
332+
fi
333+
popd
330334
fi
331-
popd
332335
}
333336

334337
install_nicer(){

scripts/installDeps.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ CLEANUP=false
1313
NO_INTERNAL=false
1414
INCR_INSTALL=false
1515
ONLY_INSTALL=""
16+
ENABLE_WEBTRANSPORT=false
1617
SUDO=""
1718

1819
if [[ $EUID -ne 0 ]]; then
@@ -34,6 +35,9 @@ parse_arguments(){
3435
"--incremental")
3536
INCR_INSTALL=true
3637
;;
38+
"--enable-webtransport")
39+
ENABLE_WEBTRANSPORT=true
40+
;;
3741
"--only")
3842
shift
3943
ONLY_INSTALL=$1

scripts/installDepsUnattended.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@ CLEANUP=false
1313
NIGHTLY=false
1414
NO_INTERNAL=false
1515
INCR_INSTALL=false
16+
ENABLE_WEBTRANSPORT=false
1617
SUDO=""
1718

19+
if [ "$GITHUB_ACTIONS" == "true" ]; then
20+
ENABLE_WEBTRANSPORT=true
21+
fi
22+
1823
if [[ $EUID -ne 0 ]]; then
1924
SUDO="sudo -E"
2025
fi
@@ -74,9 +79,11 @@ then
7479
fi
7580
fi
7681

77-
install_node
82+
if [ "$GITHUB_ACTIONS" != "true" ]; then
83+
install_node
84+
fi
7885

79-
if [ "$NIGHTLY" != "true" ]; then
86+
if [ "$NIGHTLY" != "true" ] && [ "$GITHUB_ACTIONS" != "true" ]; then
8087

8188
if [ "$DISABLE_NONFREE" = "true" ]; then
8289
install_mediadeps
@@ -112,7 +119,12 @@ if [ "$NIGHTLY" != "true" ]; then
112119

113120
fi
114121

115-
${NO_INTERNAL} || install_webrtc
122+
if [ "$GITHUB_ACTIONS" != "true" ]; then
123+
${NO_INTERNAL} || install_webrtc
124+
else
125+
install_node_tools
126+
install_quic
127+
fi
116128

117129
if [ "$CLEANUP" = "true" ]; then
118130
echo "Cleaning up..."

scripts/installUbuntuDeps.sh

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,23 @@
33
install_apt_deps(){
44
${SUDO} apt-get update -y
55
${SUDO} apt-get install git make gcc g++ libglib2.0-dev docbook2x pkg-config -y
6-
${SUDO} apt-get install libboost-regex-dev libboost-thread-dev libboost-system-dev liblog4cxx-dev rabbitmq-server -y
7-
${SUDO} apt-get install mongodb openjdk-8-jre curl libboost-test-dev nasm yasm gyp libx11-dev libkrb5-dev intel-gpu-tools -y
6+
${SUDO} apt-get install libboost-regex-dev libboost-thread-dev libboost-system-dev liblog4cxx-dev -y
7+
${SUDO} apt-get install openjdk-8-jre curl libboost-test-dev nasm yasm gyp libx11-dev libkrb5-dev intel-gpu-tools -y
88
${SUDO} apt-get install m4 autoconf libtool automake cmake libfreetype6-dev libgstreamer-plugins-base1.0-dev -y
9+
if [ "$GITHUB_ACTIONS" != "true" ]; then
10+
${SUDO} apt-get install rabbitmq-server mongodb -y
11+
else
12+
if [ -d $LIB_DIR ]; then
13+
echo "Installing mongodb-org from tar"
14+
${SUDO} apt-get install -y libcurl4 openssl liblzma5
15+
wget -P $LIB_DIR https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1804-4.4.6.tgz
16+
tar -zxvf $LIB_DIR/mongodb-linux-x86_64-ubuntu1804-4.4.6.tgz -C $LIB_DIR
17+
${SUDO} ln -s $LIB_DIR/mongodb-linux-x86_64-ubuntu1804-4.4.6/bin/* /usr/local/bin/
18+
else
19+
mkdir -p $LIB_DIR
20+
install_mongodb
21+
fi
22+
fi
923
}
1024

1125
install_gcc_7(){

scripts/pack.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,9 @@ function packScripts() {
606606
execSync(`cp -a ${rootDir}/scripts/release/package.mcu.json ${distDir}/package.json`);
607607
execSync(`cp -a ${rootDir}/third_party/NOTICE ${distDir}`);
608608
execSync(`cp -a ${rootDir}/third_party/ThirdpartyLicenses.txt ${distDir}`);
609+
if (process.env.GITHUB_ACTION) {
610+
execSync(`cp -a ${rootDir}/scripts/release/init-webtransport.sh ${binDir}`);
611+
}
609612
if (options.binary) {
610613
execSync(`cp -a ${rootDir}/scripts/release/daemon-bin.sh ${binDir}/daemon.sh`);
611614
} else {

scripts/release/init-webtransport.sh

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#!/usr/bin/env bash
2+
# Copyright (C) <2019> Intel Corporation
3+
#
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
bin=`dirname "$0"`
7+
bin=`cd "$bin"; pwd`
8+
ROOT=`cd "${bin}/.."; pwd`
9+
10+
SUDO=""
11+
if [[ $EUID -ne 0 ]]; then
12+
SUDO="sudo -E"
13+
fi
14+
15+
OWT_UPDATE_DONE=false
16+
HAVE_AUTH_UPDATE=false
17+
18+
usage()
19+
{
20+
echo "Usage: [--deps] [--hardware] (Default: without deps and hardware)"
21+
}
22+
23+
init_software()
24+
{
25+
if ${INSTALL_DEPS}; then
26+
echo "Installing dependency..."
27+
${ROOT}/bin/install_node.sh
28+
${ROOT}/bin/init-mongodb.sh --deps
29+
${ROOT}/bin/init-rabbitmq.sh --deps
30+
OWT_UPDATE_DONE=true
31+
${ROOT}/management_api/init.sh
32+
${ROOT}/webrtc_agent/install_deps.sh
33+
${ROOT}/video_agent/install_deps.sh
34+
${ROOT}/video_agent/init.sh
35+
${ROOT}/analytics_agent/install_deps.sh
36+
else
37+
${SUDO} systemctl start mongod
38+
OWT_UPDATE_DONE=true
39+
${ROOT}/management_api/init.sh
40+
fi
41+
}
42+
43+
init_auth()
44+
{
45+
local AUTH_SCRIPT="${ROOT}/cluster_manager/initauth.js"
46+
local CIPHER_JS="${ROOT}/cluster_manager/cipher.js"
47+
local AUTH_STORE=""
48+
if [[ "${HAVE_AUTH_UPDATE}" == "true" ]]; then
49+
${AUTH_SCRIPT}
50+
AUTH_STORE=`node -e "console.log(require('${CIPHER_JS}').astore)"`
51+
cp ${ROOT}/cluster_manager/${AUTH_STORE} ${ROOT}/portal/
52+
cp ${ROOT}/cluster_manager/${AUTH_STORE} ${ROOT}/conference_agent/
53+
cp ${ROOT}/cluster_manager/${AUTH_STORE} ${ROOT}/management_api/
54+
fi
55+
}
56+
57+
INSTALL_DEPS=false
58+
HARDWARE=false
59+
60+
shopt -s extglob
61+
while [[ $# -gt 0 ]]; do
62+
case $1 in
63+
*(-)deps )
64+
INSTALL_DEPS=true
65+
;;
66+
*(-)help )
67+
usage
68+
exit 0
69+
;;
70+
esac
71+
shift
72+
done
73+
74+
echo "Initializing..."
75+
init_software
76+
init_auth
77+
78+
bin=`cd "$bin"; pwd`
79+
${bin}/daemon.sh start management-api
80+
${bin}/daemon.sh start cluster-manager
81+
${bin}/daemon.sh start conference-agent
82+
${bin}/daemon.sh start quic-agent
83+
${bin}/daemon.sh start portal
84+
${bin}/daemon.sh start app

source/agent/addons/quic/binding.gyp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
],
3636
'include_dirs': [
3737
"<!(node -e \"require('nan')\")",
38-
'conn_handler',
3938
'../../../core/common',
4039
'../../../core/owt_base',
4140
'$(DEFAULT_DEPENDENCY_PATH)/include',
@@ -44,10 +43,9 @@
4443
],
4544
'ldflags': [
4645
'-Wl,--no-as-needed',
47-
'-Wl,-rpath,/home/jianjunz/code/quic/src/out/debug',
4846
'-L$(DEFAULT_DEPENDENCY_PATH)/lib',
47+
'-Wl,-rpath,$(DEFAULT_DEPENDENCY_PATH)/lib',
4948
'-fPIC',
50-
'-L/home/jianjunz/code/quic/src/out/debug',
5149
],
5250
'cflags_cc!': [
5351
'-std=gnu++0x',

source/agent/addons/quic/quic_sdk_url

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
https://api.github.com/repos/open-webrtc-toolkit/owt-sdk-quic/actions/artifacts/71814132/zip

source/agent/addons/quic/quic_sdk_version

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)