Skip to content

Commit

Permalink
Merge pull request #429 from ant-media/parallelWorkFlow
Browse files Browse the repository at this point in the history
Parallel work flow & general refactor
  • Loading branch information
burak-58 authored Dec 10, 2024
2 parents 342ca81 + b6a94af commit aae518c
Show file tree
Hide file tree
Showing 11 changed files with 259 additions and 99 deletions.
296 changes: 227 additions & 69 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,6 @@ jobs:
run: |
mkdir $HOME/.kube
echo "${{ secrets.KUBE_CONFIG_DATA }}" > $HOME/.kube/config
- name: Run Unit Test
run: |
cd react
npm install --include=dev
npm test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Set up JDK 17
uses: actions/setup-java@v3
Expand Down Expand Up @@ -113,7 +102,7 @@ jobs:
cp target/*.war /tmp/circle-webinar.war
cd ..
- name: Build React application
- name: Build React application for conferencing
env:
CI: false
NODE_OPTIONS: '--max-old-space-size=4096'
Expand All @@ -129,100 +118,269 @@ jobs:
rm -r webapp/src/main/webapp/static/*
cp -a react/build/. webapp/src/main/webapp
- name: Build Maven project
- name: Build Maven project for conferencing
run: |
cd webapp
mvn clean install -DskipTests -Dgpg.skip=true --quiet
ls -alh
ls -alh target/
cp target/*.war /tmp/circle-conferencing.war
cd ..
- name: Install Test Tool
- name: Create Test Tool
run: |
sudo apt-get update
sudo apt-get install -y unzip iproute2 libva-drm2 libva-x11-2 libvdpau-dev ffmpeg
git clone https://gitlab.com/Ant-Media/webrtc-test.git
cd webrtc-test
./redeploy.sh
cp target/webrtc-load-test-tool-*.zip ../
cd ..
unzip webrtc-load-test-tool-*.zip
mkdir ~/test
mv webrtc-load-test ~/test
- name: Install Selenium
run: |
wget https://storage.googleapis.com/chrome-for-testing-public/130.0.6723.58/linux64/chromedriver-linux64.zip
unzip chromedriver-linux64.zip
sudo cp chromedriver-linux64/chromedriver /tmp
ls -al /tmp
pip3 install selenium==4.14
pip3 install requests
pip3 show selenium
pip3 install psutil
- name: Run Integration Test
run: |
cd test
python3 test_main.py ${{ secrets.STAGING_SERVER_URL }} ${{ secrets.USER_NAME }} ${{ secrets.PASSWORD }} /tmp/circle-conferencing.war false
- name: Run Integration Test for webinar
run: |
cd test
python3 test_main.py ${{ secrets.STAGING_SERVER_URL }} ${{ secrets.USER_NAME }} ${{ secrets.PASSWORD }} /tmp/circle-webinar.war true
- name: Cache Test Tool
uses: actions/cache@v3
with:
path: webrtc-test/
key: test-tool-${{ hashFiles('**/tool-source/**') }}
restore-keys: test-tool-

- name: Copy Logs From Pods
if: always()
run: |
for pod in $(kubectl -n circle get pods | grep "ant-media-server" | awk '{print $1}'); do
node_ip=$(kubectl -n circle get pods -o wide | grep "$pod" | awk '{print $6}')
kubectl -n circle cp $pod:/usr/local/antmedia/log/ant-media-server.log /tmp/ant-media-server-$node_ip.log
kubectl -n circle cp $pod:/usr/local/antmedia/log/antmedia-error.log /tmp/antmedia-error-$node_ip.log
done

- name: Upload PNG files as artifacts
- name: Upload conferencing war file as artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: screenshots
path: ${{ github.workspace }}/test/**/*.png
name: circle-conferencing.war
path: /tmp/circle-conferencing.war

- name: Upload log files as artifacts
- name: Upload webinar war file as artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: logs
path: /tmp/*.log
name: circle-webinar.war
path: /tmp/circle-webinar.war

- name: Debug WAR file paths
run: ls -alh /tmp

- name: Upload war files as artifacts
if: always()
uses: actions/upload-artifact@v4
unit-tests:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Run Unit Test
run: |
echo "pwd:"
pwd
echo "ls:"
ls -al
cd react
npm install --include=dev
npm test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}

conference-integration-tests:
needs: [build]
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Restore Cached Test Tool
uses: actions/cache@v3
with:
path: webrtc-test/
key: test-tool-${{ hashFiles('**/tool-source/**') }}
restore-keys: test-tool-

- name: Locate Test Tool
run: |
pwd
ls
cp webrtc-test/target/webrtc-load-test-tool-*.zip ../
cd ..
unzip webrtc-load-test-tool-*.zip
mkdir ~/test
mv webrtc-load-test ~/test
ls -al ~/test
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'temurin'
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME # env variable for username in deploy
server-password: MAVEN_PASSWORD # env variable for token in deploy
gpg-private-key: ${{ secrets.MVN_GPG_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase

- name: Download circle-conferencing.war Artifact
uses: actions/download-artifact@v4
with:
name: circle-conferencing.war
path: /tmp

- name: Debug WAR file paths
run: ls -alh /tmp

- name: Install Selenium
run: |
wget https://storage.googleapis.com/chrome-for-testing-public/130.0.6723.58/linux64/chromedriver-linux64.zip
unzip chromedriver-linux64.zip
sudo cp chromedriver-linux64/chromedriver /tmp
ls -al /tmp
pip3 install selenium==4.14
pip3 install requests
pip3 show selenium
pip3 install psutil
- name: Run Integration Test
run: |
cd test
python3 test_main.py ${{ secrets.STAGING_SERVER_URL }} ${{ secrets.USER_NAME }} ${{ secrets.PASSWORD }} /tmp/circle-conferencing.war false
- name: Upload PNG files as artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: screenshots
path: ${{ github.workspace }}/test/**/*.png

webinar-integration-tests:
needs: [build]
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Restore Cached Test Tool
uses: actions/cache@v3
with:
path: webrtc-test/
key: test-tool-${{ hashFiles('**/tool-source/**') }}
restore-keys: test-tool-

- name: Locate Test Tool
run: |
pwd
ls
cp webrtc-test/target/webrtc-load-test-tool-*.zip ../
cd ..
unzip webrtc-load-test-tool-*.zip
mkdir ~/test
mv webrtc-load-test ~/test
- name: Download circle-webinar.war Artifact
uses: actions/download-artifact@v4
with:
name: circle-webinar.war
path: /tmp

- name: Debug WAR file paths
run: ls -alh /tmp

- name: Install Selenium
run: |
wget https://storage.googleapis.com/chrome-for-testing-public/130.0.6723.58/linux64/chromedriver-linux64.zip
unzip chromedriver-linux64.zip
sudo cp chromedriver-linux64/chromedriver /tmp
ls -al /tmp
pip3 install selenium==4.14
pip3 install requests
pip3 show selenium
pip3 install psutil
- name: Run Integration Test for webinar
run: |
sleep 10
cd test
python3 test_main.py ${{ secrets.STAGING_SERVER_URL }} ${{ secrets.USER_NAME }} ${{ secrets.PASSWORD }} /tmp/circle-webinar.war true
collect-and-upload-logs:
needs: [unit-tests, webinar-integration-tests , conference-integration-tests]
if: always()
runs-on: ubuntu-latest

steps:
- name: Upload PNG files as artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: screenshots
path: ${{ github.workspace }}/test/**/*.png

- name: Copy Logs From Pods
if: always()
run: |
for pod in $(kubectl -n circle get pods | grep "ant-media-server" | awk '{print $1}'); do
node_ip=$(kubectl -n circle get pods -o wide | grep "$pod" | awk '{print $6}')
kubectl -n circle cp $pod:/usr/local/antmedia/log/ant-media-server.log /tmp/ant-media-server-$node_ip.log
kubectl -n circle cp $pod:/usr/local/antmedia/log/antmedia-error.log /tmp/antmedia-error-$node_ip.log
done
- name: Upload log files as artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: logs
path: /tmp/*.log


deploy:
runs-on: ubuntu-latest
needs: collect-and-upload-logs
if: github.ref == 'refs/heads/main'

steps:
- uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
name: wars
path: /tmp/*.war

java-version: 17
distribution: 'temurin'
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME # env variable for username in deploy
server-password: MAVEN_PASSWORD # env variable for token in deploy
gpg-private-key: ${{ secrets.MVN_GPG_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase

- name: Build React application for conferencing
env:
CI: false
NODE_OPTIONS: '--max-old-space-size=4096'
run: |
cd react
mv .env.production.conferencing .env.production
sed -i "s#^REACT_APP_TURN_SERVER_URL=.*#REACT_APP_TURN_SERVER_URL=\"turn:${{ secrets.STAGING_TURN_URL }}\"#" .env.production
sed -i "s#^REACT_APP_TURN_SERVER_USERNAME=.*#REACT_APP_TURN_SERVER_USERNAME=\"${{ secrets.STAGING_TURN_USERNAME }}\"#" .env.production
sed -i "s#^REACT_APP_TURN_SERVER_CREDENTIAL=.*#REACT_APP_TURN_SERVER_CREDENTIAL=\"${{ secrets.STAGING_TURN_PASSWORD }}\"#" .env.production
npm install
npm run build
cd ..
rm -r webapp/src/main/webapp/static/*
cp -a react/build/. webapp/src/main/webapp
- name: Publish to Maven Central
if: github.ref == 'refs/heads/main'
run: |
cd webapp
ls -alh
ls -alh target/
mvn -e deploy -DskipTests --quiet --settings ../mvn-settings.xml
sleep 60
env:
MAVEN_USERNAME: ${{ secrets.MVN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MVN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MVN_GPG_PASSPHRASE }}


deploy:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/main'

steps:
- uses: actions/checkout@v3

- name: Get versions data from repo
run: wget -O maven-metadata.xml https://oss.sonatype.org/service/local/repositories/snapshots/content/io/antmedia/ant-media-server/maven-metadata.xml
- name: Install jq
Expand Down
1 change: 1 addition & 0 deletions react/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ REACT_APP_TIME_ZONE_LIVE_TEXT_VISIBILITY=true

# Video Overlay configurations
REACT_APP_VIDEO_OVERLAY_ADMIN_MODE_ENABLED=false
REACT_APP_VIDEO_OVERLAY_ADMIN_CAMERA_CONTROL_ENABLED=false

# Participant Tab configurations
REACT_APP_PARTICIPANT_TAB_ADMIN_MODE_ENABLED=true
Expand Down
1 change: 1 addition & 0 deletions react/.env.production.webinar
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ REACT_APP_TIME_ZONE_LIVE_TEXT_VISIBILITY=true

# Video Overlay configurations
REACT_APP_VIDEO_OVERLAY_ADMIN_MODE_ENABLED=true
REACT_APP_VIDEO_OVERLAY_ADMIN_CAMERA_CONTROL_ENABLED=false

# Speed Test configurations
REACT_APP_SPEED_TEST_BEFORE_JOINING_THE_ROOM=true
Expand Down
6 changes: 3 additions & 3 deletions react/src/Components/Cards/VideoCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function VideoCard(props) {

return (
<>
{!useAvatar && (
{(!useAvatar && process.env.REACT_APP_VIDEO_OVERLAY_ADMIN_MODE_ENABLED === "true") && (
<OverlayButton
title={`Camera ${useAvatar ? "off" : "on"} ${props.name}`}
icon={useAvatar ? "camera-off" : "camera"}
Expand All @@ -123,8 +123,8 @@ function VideoCard(props) {
)}
<OverlayButton
title={`Microphone ${micMuted ? "on" : "off"} ${props.name}`}
icon={micMuted ? "microphone" : "muted-microphone"}
color={micMuted ? "primary" : "error"}
icon={micMuted ? "muted-microphone" : "microphone"}
color={micMuted ? "error" : "primary"}
onClick={handleToggleMic}
/>
</>
Expand Down
2 changes: 1 addition & 1 deletion react/src/Components/ParticipantTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function ParticipantTab(props) {
onClick={() => { handleToggleMic(micMuted, streamId, name) }
}
>
<SvgIcon size={28} name={micMuted ? "muted-microphone" : "microphone"} color={micMuted ? "primary" : "error"} />
<SvgIcon size={28} name={micMuted ? "muted-microphone" : "microphone"} color={theme.palette?.participantListIcon?.primary} />
</PinBtn>
)
}
Expand Down
Loading

0 comments on commit aae518c

Please sign in to comment.