Skip to content

Better video toggle with black frame sender #1275

Better video toggle with black frame sender

Better video toggle with black frame sender #1275

Workflow file for this run

name: Android SDK CI
on: [pull_request]
# Important Information:
# -It's running in ci.antmedia.cloud and Linux hardware acceleration is enabled.
# Check this out -> https://developer.android.com/studio/run/emulator-acceleration#vm-linux
#
# - If runner is not working, start the service.
# Go to /home/ubuntu/actions-runner and execute the following command
# sudo ./svc.sh start
# stop and status commands are also available
# sudo ./svc.sh status
# sudo ./svc.sh stop
# for more information -> https://docs.github.com/en/actions/hosting-your-own-runners/configuring-the-self-hosted-runner-application-as-a-service#customizing-the-self-hosted-runner-service
#
# - For reactivecircus/[email protected] , ANDROID_SDK_ROOT env should be set
# in later versions, ANDROID_HOME should be set
#
# - Important: In the actions-runner directory, add the following lines to the .env directory and .bashrc
# ANDROID_HOME=/home/ubuntu/android
# ANDROID_SDK_ROOT=/home/ubuntu/android
# JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/
#
env:
GITHUB_TOKEN: ${{ secrets.G_TOKEN }}
REPO: ${{ github.repository }}
OWNER: ${{ github.repository_owner }}
OS_USERNAME: ${{ secrets.OS_USERNAME }}
OS_PASSWORD: ${{ secrets.OS_PASSWORD }}
OS_PROJECT_NAME: ${{ secrets.OS_PROJECT_NAME }}
OS_AUTH_URL: ${{ secrets.OS_AUTH_URL }}
OS_REGION_NAME: ${{ secrets.OS_REGION_NAME }}
OS_TENANT_ID: ${{ secrets.OS_TENANT_ID }}
OS_TENANT_NAME: ${{ secrets.OS_TENANT_NAME }}
OS_API_VERSION: ${{ secrets.OS_API_VERSION }}
OS_USER_DOMAIN_NAME: ${{ secrets.OS_USER_DOMAIN_NAME }}
INSTANCE_TYPE: "c3-16"
IMAGE_ID: "Ubuntu 24.04"
jobs:
setup-runner:
runs-on: ubuntu-latest
outputs:
server_id: ${{ steps.set-server-id.outputs.server_id }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y python3-pip python3-dev libffi-dev libssl-dev
sudo pip3 install python-openstackclient
- name: server-id
id: set-server-id
run: |
REPO=$(echo "$REPO" | cut -d'/' -f2)
BRANCH_NAME="${{ github.head_ref }}"
SERVER_ID="ci-$REPO-$BRANCH_NAME"
echo $SERVER_ID
echo "server_id=$SERVER_ID" >> $GITHUB_OUTPUT
- name: Configure OpenStack CLI and Create Instance
run: |
echo "Setting up OpenStack CLI environment variables..."
echo "GITHUB_TOKEN=${GITHUB_TOKEN}" >> $GITHUB_ENV
sed -i "s/^GITHUB_TOKEN=.*$/GITHUB_TOKEN=${GITHUB_TOKEN}/" user_data.sh
sed -i "s|RUNNER_ORG=\"[^\"]*\"|RUNNER_ORG=\"$REPO\"|g" user_data.sh
SERVER_ID="${{ steps.set-server-id.outputs.server_id }}"
echo $SERVER_ID
openstack server create --flavor "$INSTANCE_TYPE" --image "$IMAGE_ID" --key-name ovh --security-group default --user-data user_data.sh --network Ext-Net $SERVER_ID
echo "Server creation initiated."
STATUS=$(openstack server show $SERVER_ID -f value -c status)
echo "Current server status: $STATUS"
while [[ "$STATUS" != "ACTIVE" && "$STATUS" != "ERROR" ]]; do
echo "Waiting for server to be ACTIVE. Current status: $STATUS"
sleep 10
STATUS=$(openstack server show $SERVER_ID -f value -c status)
done
if [[ "$STATUS" == "ERROR" ]]; then
echo "Server creation failed."
exit 1
fi
- name: Check runner status and wait if offline
id: check_status
run: |
MAX_WAIT=300
WAIT_INTERVAL=10
ELAPSED_TIME=0
RUNNER_STATUS=$(curl -s -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$REPO/actions/runners | jq -r '.runners[0].status')
echo "Initial Runner status is: $RUNNER_STATUS"
while [[ "$RUNNER_STATUS" != "online" && "$ELAPSED_TIME" -lt "$MAX_WAIT" ]]; do
echo "Runner is $RUNNER_STATUS. Waiting for $WAIT_INTERVAL seconds..."
sleep $WAIT_INTERVAL
ELAPSED_TIME=$((ELAPSED_TIME + WAIT_INTERVAL))
RUNNER_STATUS=$(curl -s -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$REPO/actions/runners | jq -r '.runners[0].status')
echo "Runner status is: $RUNNER_STATUS"
done
echo "::set-output name=runner_status::$RUNNER_STATUS"
- name: Cancel workflow if runner is still offline
if: steps.check_status.outputs.runner_status == 'offline'
run: |
exit 1
unit-tests:
needs: setup-runner
runs-on: self-hosted
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'adopt'
- name: Enable KVM
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
- name: Gradle Cache
uses: gradle/gradle-build-action@v2
- name: Run ffmpeg
#send test stream to the server to play test
run: ffmpeg -re -stream_loop 20 -i ./webrtc-android-sample-app/src/androidTest/resources/test.flv -codec copy -f flv rtmp://test.antmedia.io/LiveApp/stream556677i4d 2>&1 < /dev/null &
- uses: browser-actions/setup-chrome@v1
id: setup-chrome
with:
chrome-version: 127
install-chromedriver: true
- name: Get Chrome and ChromeDriver Paths
id: paths
run: |
echo "CHROME_PATH=${{ steps.setup-chrome.outputs.chrome-path }}" >> $GITHUB_ENV
echo "CHROMEDRIVER_PATH=${{ steps.setup-chrome.outputs.chromedriver-path }}" >> $GITHUB_ENV
- name: Setting up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install python packages
run: |
#wget https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing/119.0.6045.105/linux64/chromedriver-linux64.zip
#unzip chromedriver-linux64.zip
#cp chromedriver-linux64/chromedriver /home/ubuntu
pip3 install requests selenium==4.14 flask
- name: Run Multitrack Conference Test Server
run: python3 multitrack-conference-server.py &
- name: Run Tests and Generate Report
uses: reactivecircus/[email protected]
with:
api-level: 33
arch: x86_64
target: playstore
emulator-build: 9322596 #31.3.14.0 It can be get by running -> ./emulator -version
force-avd-creation: false
disable-animations: true
cores: 3
emulator-options: -no-snapshot-save -gpu swiftshader_indirect -no-window -noaudio -no-boot-anim
script: |
touch emulator.log
chmod 777 emulator.log
adb logcat io.antmedia:I >> emulator.log &
./gradlew jacocoTestReport; EXIT_CODE=$?; exit $EXIT_CODE
- name: Archive Test Report
if: always()
uses: actions/upload-artifact@v3
with:
name: Test report
path: |
webrtc-android-sample-app/build/reports/tests/testDebugUnitTest/
webrtc-android-sample-app/build/reports/jacoco/jacocoTestReport/
webrtc-android-sample-app/build/reports/androidTests/
webrtc-android-sample-app/build/outputs/connected_android_test_additional_output/
webrtc-android-framework/build/reports/tests/testDebugUnitTest/
webrtc-android-framework/build/reports/jacoco/jacocoTestReport/
webrtc-android-framework/build/reports/androidTests/
webrtc-android-sample-app/build/logcat.txt
webrtc-android-sample-app/build/screen.png
emulator.log
- name: Upload Test Report to Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: webrtc-android-framework/build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml,webrtc-android-sample-app/build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml
fail_ci_if_error: true
- name: Deploy to Sonatype
#deploy only in master branches
if: github.ref == 'refs/heads/master'
run: ./gradlew publish
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
clean:
needs: [setup-runner, unit-tests]
runs-on: ubuntu-latest
if: always()
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Delete runner
if: ${{ always() }}
run: |
echo "GITHUB_TOKEN=${GITHUB_TOKEN}" >> $GITHUB_ENV
RUNNER_ID=$(curl -s -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$REPO/actions/runners | jq -r '.runners[0].id')
echo "Deleting runner with ID: $RUNNER_ID"
curl -X DELETE -H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$REPO/actions/runners/$RUNNER_ID
echo "Runner deleted successfully."
- name: Install Dependencies
if: ${{ always() }}
run: |
sudo apt-get update
sudo apt-get install -y python3-pip python3-dev libffi-dev libssl-dev
sudo pip3 install python-openstackclient
- name: Delete CI Instance
if: ${{ always() }}
run: |
SERVER_ID="${{ needs.setup-runner.outputs.server_id }}"
echo "server id" $SERVER_ID
if [ -n "$SERVER_ID" ]; then
openstack server delete $SERVER_ID
echo $SERVER_ID
else
echo "SERVER_ID is empty, skipping server delete."
fi