Skip to content

Commit 5a6b867

Browse files
committed
add config to run kite tests in Github Actions
1 parent 1e9df50 commit 5a6b867

File tree

10 files changed

+322
-0
lines changed

10 files changed

+322
-0
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: Bug Report
3+
about: Create a report to help us improve
4+
---
5+
6+
**Describe the bug**
7+
8+
<!-- Explain the bug, if an error is being thrown a stack trace helps -->
9+
10+
**Instructions To reproduce**
11+
12+
<!-- Please add steps to reproduce the error -->
13+
14+
**Versions (please complete the following information):**
15+
16+
- React Native Version:
17+
- React Native Web Version:
18+
- React Native WebRTC Version:

.github/workflows/app.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: App Tests
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
recordVideo:
6+
description: 'Record E2E Tests'
7+
required: true
8+
default: 'false'
9+
push:
10+
branches:
11+
pull_request:
12+
defaults:
13+
run:
14+
shell: bash
15+
jobs:
16+
generate:
17+
name: e2e-${{ matrix.app_type }}
18+
runs-on: macos-latest
19+
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.pull_request.title, '[skip ci]') && !contains(github.event.pull_request.title, '[ci skip]') && !contains(github.event.ref_type, '[tag]')"
20+
timeout-minutes: 60
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
node_version: [14.x]
25+
app_type:
26+
- DemoApp
27+
include:
28+
- app_type: DemoApp
29+
env:
30+
SCRIPT_DIR: ./test/scripts
31+
steps:
32+
- name: 'SETUP: Checkout'
33+
uses: actions/checkout@v2
34+
- name: 'SETUP: History'
35+
run: git --no-pager log -n 10 --graph --pretty='%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue) <%an>%Creset' --abbrev-commit
36+
- name: 'SETUP: Node'
37+
uses: actions/[email protected]
38+
with:
39+
node-version: ${{ matrix.node_version }}
40+
- name: 'SETUP: Java'
41+
uses: actions/setup-java@v1
42+
with:
43+
java-version: '8.x'
44+
- name: 'SETUP: Cache Maven archetypes'
45+
uses: actions/cache@v1
46+
with:
47+
path: ~/.m2/repository
48+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
49+
restore-keys: |
50+
${{ runner.os }}-maven-
51+
- name: 'SETUP: Clone Kite'
52+
run: $SCRIPT_DIR/clone-kite.sh
53+
- name: 'SETUP: Config Git'
54+
run: $SCRIPT_DIR/git-config.sh
55+
- name: 'INSTALL: Install Browsers and Drivers'
56+
run: $SCRIPT_DIR/install-kite.sh
57+
env:
58+
KITE_HOME: ${{ runner.workspace }}/KITE
59+
KITE_SCRIPT_DIR: ${{ runner.workspace }}/KITE/scripts/mac
60+
- name: 'TEST: Start Grid'
61+
run: $SCRIPT_DIR/start-kite.sh
62+
env:
63+
KITE_HOME: ${{ runner.workspace }}/KITE
64+
KITE_SCRIPT_DIR: ${{ runner.workspace }}/KITE/scripts/mac
65+
- name: 'TEST: Run Kite Tests'
66+
run: $SCRIPT_DIR/run-kite.sh
67+
env:
68+
KITE_HOME: ${{ runner.workspace }}/KITE
69+
KITE_SCRIPT_DIR: ${{ runner.workspace }}/KITE/scripts/mac
70+
- name: 'POST-TEST: Display Tools'
71+
run: $SCRIPT_DIR/display-tools.sh
72+
if: ${{ always() }}
73+
- name: 'POST-TEST: Upload Artifacts'
74+
uses: actions/upload-artifact@v2
75+
if: ${{ always() }}
76+
with:
77+
name: kite-artifacts-${{ matrix.app_type }}
78+
path: |
79+
${{ runner.workspace }}/KITE/KITE-Example-Test
80+
!${{ runner.workspace }}/KITE/KITE-Example-Test/target
81+
!${{ runner.workspace }}/KITE/KITE-Example-Test/js/node_modules

test/scripts/clone-kite.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env bash
2+
brew install coreutils
3+
4+
git clone https://github.com/webrtc/KITE.git ../KITE
5+
cd ../KITE
6+
7+
# setup maven wrapper
8+
mvn -N io.takari:maven:0.7.7:wrapper
9+
10+
# configure $KITE_HOME
11+
ghead -n -29 configureMac.sh > configureMacCI.sh
12+
chmod +x configureMacCI.sh
13+
./configureMacCI.sh

test/scripts/conf.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "Kite Test Search Example with Allure reporting",
3+
"grids": [
4+
{
5+
"type": "local",
6+
"url": "http://localhost:4444/wd/hub"
7+
}
8+
],
9+
"tests": [
10+
{
11+
"name": "KiteExampleSearchTest %ts",
12+
"tupleSize": 1,
13+
"description": "This example test opens google and searches for Cosmo Software Consulting and verify the first result",
14+
"testImpl": "org.webrtc.kite.example.KiteExampleSearchTest",
15+
"payload": {
16+
"test1": "ONE",
17+
"test2": "TWO"
18+
}
19+
}
20+
],
21+
"clients": [
22+
{
23+
"browserName": "chrome",
24+
"platform": "localhost"
25+
},
26+
{
27+
"browserName": "firefox",
28+
"platform": "localhost"
29+
},
30+
{
31+
"browserName": "safari",
32+
"platform": "localhost"
33+
}
34+
]
35+
}

test/scripts/createFolderLocalGrid.sh

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#! /bin/bash
2+
cd $KITE_HOME/scripts/mac
3+
source gridConfig.sh
4+
5+
cd $KITE_HOME
6+
7+
mkdir localGrid
8+
cd localGrid
9+
mkdir chrome
10+
mkdir firefox
11+
mkdir safari
12+
mkdir hub
13+
14+
if [[ "$LOCALHOST" = "TRUE" ]]
15+
then
16+
IP="localhost"
17+
else
18+
IF=$(route get default |grep 'interface' |awk -F: '{print $2}');
19+
IP=$(ifconfig |grep -A5 $IF | grep 'inet ' | cut -d: -f2 |awk '{print $2}');
20+
fi
21+
22+
rm startGrid.sh || true
23+
echo cd $KITE_HOME/localGrid/hub >> startGrid.sh
24+
echo "$KITE_HOME/localGrid/hub/startHub.sh &" >> startGrid.sh
25+
26+
echo cd $KITE_HOME/localGrid/chrome >> startGrid.sh
27+
echo "$KITE_HOME/localGrid/chrome/startNode.sh &" >> startGrid.sh
28+
29+
echo cd $KITE_HOME/localGrid/safari >> startGrid.sh
30+
echo "$KITE_HOME/localGrid/safari/startNode.sh &" >> startGrid.sh
31+
32+
echo cd $KITE_HOME/localGrid/firefox >> startGrid.sh
33+
echo "$KITE_HOME/localGrid/firefox/startNode.sh &" >> startGrid.sh
34+
echo cd .. >> startGrid.sh
35+
36+
rm stopGrid.sh || true
37+
echo kill $(ps aux | grep role | grep -v grep | awk '{print $2}') >> stopGrid.sh
38+
echo pkill -f hub >> stopGrid.sh
39+
40+
rm chrome/startNode.sh || true
41+
echo echo -n -e '"\033]0;NODE CHROME\007"' >> chrome/startNode.sh
42+
echo java -Dwebdriver.chrome.driver=$KITE_HOME/localGrid/chrome/chromedriver -jar $KITE_HOME/localGrid/selenium.jar -role node -maxSession 5 -port 6001 -host $IP -hub http://$IP:4444/grid/register -browser browserName=chrome,version=$CHROME_VERSION,platform=MAC,maxInstances=5 --debug >> chrome/startNode.sh
43+
44+
45+
rm firefox/startNode.sh || true
46+
echo echo -n -e '"\033]0;NODE FIREFOX\007"' >> firefox/startNode.sh
47+
echo java -Dwebdriver.gecko.driver=$KITE_HOME/localGrid/firefox/geckodriver -jar $KITE_HOME/localGrid/selenium.jar -role node -maxSession 10 -port 6002 -host $IP -hub http://$IP:4444/grid/register -browser browserName=firefox,version=$FIREFOX_VERSION,platform=MAC,maxInstances=10 --debug >> firefox/startNode.sh
48+
49+
50+
rm safari/startNode.sh || true
51+
echo echo -n -e '"\033]0;NODE SAFARI\007"' >> safari/startNode.sh
52+
echo java -Dwebdriver.safari.driver=/Applications/Safari.app/Contents/MacOS/safaridriver -jar $KITE_HOME/localGrid/selenium.jar -role node -maxSession 1 -port 6003 -host $IP -hub http://$IP:4444/grid/register -browser browserName=safari,version=$SAFARI_VERSION,platform=MAC,maxInstances=1 --debug >> safari/startNode.sh
53+
54+
55+
rm hub/startHub.sh || true
56+
echo echo -n -e '"\033]0;HUB\007"' >> hub/startHub.sh
57+
echo java -jar $KITE_HOME/localGrid/selenium.jar -role hub --debug -host $IP >> hub/startHub.sh
58+
59+
60+
chmod +x startGrid.sh
61+
62+
cd hub
63+
chmod +x startHub.sh
64+
cd ..
65+
66+
cd safari
67+
chmod +x startNode.sh
68+
cd ..
69+
cd chrome
70+
chmod +x startNode.sh
71+
cd ..
72+
cd firefox
73+
chmod +x startNode.sh
74+
cd ..
75+
76+
echo $PPID

test/scripts/display-tools.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
set -x
3+
4+
pwd
5+
git version
6+
java -version
7+
node -v
8+
npm -v
9+
10+
env

test/scripts/git-config.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
3+
git config --global user.name "React Native WebRTC Web Shim Github Pipelines"
4+
git config --global user.email "react-native-webrtc-web-shim@localhost"

test/scripts/install-kite.sh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
cd ../KITE
5+
6+
# configure $KITE_HOME
7+
./configureMacCI.sh
8+
9+
# install browsers and drivers
10+
cd $KITE_SCRIPT_DIR
11+
sed -i'' -e s/INSTALL_BROWSERS=FALSE/INSTALL_BROWSERS=TRUE/ ./gridConfig.sh
12+
13+
chmod +x *.sh
14+
source ./gridConfig.sh
15+
echo "Creating local folders for grid"
16+
17+
sed -i'.backup' "s~kill -9~echo~g" *.sh
18+
sed -i'.backup' "s~rew cask install~rew install --cask~g" *.sh
19+
rm *.backup
20+
21+
# configure versions
22+
GECKO_VERSION="v0.29.0"
23+
CHROMEDRIVER_VERSION="88.0.4324.96"
24+
FIREFOX_VERSION="85"
25+
CHROME_VERSION="88"
26+
27+
sed -i'.backup' "s~GECKO_VERSION=v0.28.0~GECKO_VERSION=$GECKO_VERSION~" ./gridConfig.sh
28+
sed -i'.backup' "s~CHROMEDRIVER_VERSION=87.0.4280.88~CHROMEDRIVER_VERSION=$CHROMEDRIVER_VERSION~" ./gridConfig.sh
29+
sed -i'.backup' "s~FIREFOX_VERSION=83~FIREFOX_VERSION=$FIREFOX_VERSION~" ./gridConfig.sh
30+
sed -i'.backup' "s~CHROME_VERSION=87~CHROME_VERSION=$CHROME_VERSION~" ./gridConfig.sh
31+
32+
$GITHUB_WORKSPACE/test/scripts/createFolderLocalGrid.sh
33+
sleep 1
34+
35+
if [[ "$INSTALL_BROWSERS" = "TRUE" ]]
36+
then
37+
echo "Installing Chrome"
38+
$KITE_HOME/scripts/mac/installChrome.sh
39+
echo "Chrome Version: $(/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version)"
40+
echo "Installing Firefox"
41+
$KITE_HOME/scripts/mac/installFirefox.sh
42+
echo "Firefox Version: $(/Applications/Firefox.app/Contents/MacOS/firefox --version)"
43+
else
44+
echo "Skipping Chrome and Firefox installation"
45+
fi
46+
47+
# enable safari automation
48+
sudo safaridriver --enable
49+
50+
echo "Installing Drivers"
51+
$KITE_HOME/scripts/mac/installDrivers.sh
52+
echo "Installing Selenium"
53+
$KITE_HOME/scripts/mac/installSelenium.sh
54+
55+
echo "Installing Kite"
56+
cd $KITE_HOME
57+
./mvnw clean install -DskipTests -ntp

test/scripts/run-kite.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
3+
cd ../KITE
4+
5+
# configure $KITE_HOME
6+
./configureMacCI.sh
7+
8+
echo 'Running tests...'
9+
cd $KITE_HOME/KITE-Example-Test
10+
11+
# setup maven wrapper
12+
mvn -N io.takari:maven:0.7.7:wrapper
13+
14+
# build
15+
./mvnw clean install -DskipTests -ntp
16+
17+
# run tests
18+
java -Dkite.firefox.profile="$KITE_HOME"/third_party/firefox-h264-profiles/ -cp "$KITE_HOME/KITE-Engine/target/kite-jar-with-dependencies.jar:target/*" org.webrtc.kite.Engine $GITHUB_WORKSPACE/test/scripts/conf.json

test/scripts/start-kite.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
3+
cd ../KITE
4+
5+
# configure $KITE_HOME
6+
./configureMacCI.sh
7+
8+
echo 'Starting Grid...'
9+
$KITE_HOME/localGrid/startGrid.sh
10+
echo 'Started Grid...'

0 commit comments

Comments
 (0)