Skip to content

Commit

Permalink
Merge branch 'main' into fix/issue-408
Browse files Browse the repository at this point in the history
  • Loading branch information
burak-58 committed Dec 20, 2024
2 parents 4c61347 + b15fe00 commit 334b471
Show file tree
Hide file tree
Showing 44 changed files with 3,477 additions and 938 deletions.
295 changes: 226 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,268 @@ 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
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ webapp/src/main/webapp/
react/.env.development
react/.idea/workspace.xml
react/.env.fakeeh
test/run.sh
test/runw.sh
Loading

0 comments on commit 334b471

Please sign in to comment.