diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index e3b050d36e..0000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,243 +0,0 @@ -version: 2.1 -orbs: - browser-tools: circleci/browser-tools@1.4.8 - -executors: - dashjs-executor: - working_directory: ~/repo - resource_class: large - docker: - - image: cimg/node:20.11.1 - -commands: - dependencies_setup: - steps: - - restore_cache: - keys: - - v1-dependencies-{{ checksum "package.json" }} - # fallback to using the latest cache if no exact match is found - - v1-dependencies- - - run: - name: Install dependencies - command: npm install - - save_cache: - paths: - - node_modules - key: v1-dependencies-{{ checksum "package.json" }} - - functional_precondition: - steps: - - run: - name: Check if preconditions are met for functional tests - command: | - if [ -z "LAMBDATEST_ACCESS_KEY" ]; then - echo "Lambdatest not configured, functional tests will not be executed." - circleci-agent step halt - fi - - functional_test_setup: - steps: - - run: - name: "Downloading tunnel binary" - command: | - wget https://downloads.lambdatest.com/tunnel/v3/linux/64bit/LT_Linux.zip - - - run: - name: "Extracting tunnel binary" - command: | - sudo apt-get install unzip - unzip LT_Linux.zip - - - run: - name: "Executing tunnel binary" - background: true - command: | - ./LT --user ${LAMBDATEST_EMAIL} --key ${LAMBDATEST_KEY} - sleep 40 - - - run: - name: "Setup custom environment variables" - command: | - echo 'export LT_USERNAME="${LAMBDATEST_USER}"' >> $BASH_ENV - echo 'export LT_ACCESS_KEY="${LAMBDATEST_ACCESS_KEY}"' >> $BASH_ENV - - run_testbuild: - steps: - - browser-tools/install-browser-tools - - run: - name: Build and run unit tests - command: | - npm run build - - process_test_results: # CircleCI can not handle NaN values so we replace them with 0 - steps: - - run: - name: Install xmlstarlet - when: always - command: sudo apt-get -y update && sudo apt-get -y install xmlstarlet - - run: - name: Modify XML files recursively and copy to another folder - when: always - command: | - mkdir test/functional/results/test/karma/junit/adjusted - cd test/functional/results/test/karma/junit - for file in **/*.xml; do - [ -f "$file" ] || continue - xmlstarlet ed -L -u '//testcase[@time="NaN"]/@time' -v '0' "$file" - modified_file="${file//\//_}" - cp "$file" adjusted/$modified_file - done - - store_test_results: - path: test/functional/results/test/karma/junit/adjusted - - functional_steps: - steps: - - functional_precondition - - checkout - - run: - name: Virtual merge into development branch - command: | - if [ "${CIRCLE_BRANCH}" = "development" ]; then - echo "On development branch already, no merge needed" - else - git config --global user.email "circleci@example.com" - git config --global user.name "CircleCI" - git checkout development - git merge --no-edit --no-ff $CIRCLE_BRANCH - fi - - dependencies_setup - - run_testbuild - - functional_test_setup - - run_test_suite: - parameters: - streamsfile: - default: "single" - type: string - configfile: - default: "lambdatest" - type: string - steps: - - run: - name: Sleep - command: | - sleep 30 - - run: - name: Run functional tests <> - <> - when: always - command: - node_modules/karma/bin/karma start test/functional/config/karma.functional.conf.cjs --configfile=<> --streamsfile=<> - build_samples: - # parameters: - # samples: - # default: "network-interceptor" - # type: string - steps: - - run: - name: Install dependencies and build samples - command: | - for sample in "${SAMPLES}"; do - echo "Build sample $sample" - cd samples/$sample - npm install - npm run build - done - -jobs: - build-and-unit-test: - environment: - SAMPLES: "network-interceptor" - executor: dashjs-executor - steps: - - checkout - - dependencies_setup - - run_testbuild - - build_samples - - merge-build-and-unit-test: - executor: dashjs-executor - steps: - - checkout - - run: - name: Merge into development virtually - command: | - git config --global user.email "circleci@example.com" - git config --global user.name "CircleCI" - git checkout development - git merge --no-edit --no-ff $CIRCLE_BRANCH - - dependencies_setup - - run_testbuild - - functional-tests-single: - executor: dashjs-executor - steps: - - functional_steps - - run_test_suite: - streamsfile: single - configfile: lambdatest - - process_test_results - - functional-tests-smoke: - executor: dashjs-executor - steps: - - functional_steps - - run_test_suite: - streamsfile: smoke - configfile: lambdatest-smoke - - process_test_results - - functional-tests-single-and-smoke: - executor: dashjs-executor - steps: - - functional_steps - - run_test_suite: - streamsfile: single - configfile: lambdatest - - run_test_suite: - streamsfile: smoke - configfile: lambdatest-smoke - - process_test_results - - functional-tests-full-part-1: - executor: dashjs-executor - steps: - - functional_steps - - run_test_suite: - streamsfile: drm_emsg_eptdelta_gaps - configfile: lambdatest-full - - process_test_results - - functional-tests-full-part-2: - executor: dashjs-executor - steps: - - functional_steps - - run_test_suite: - streamsfile: multiperiod_subtitle_vendor - configfile: lambdatest-full - - process_test_results - - functional-tests-full-part-3: - executor: dashjs-executor - steps: - - functional_steps - - run_test_suite: - streamsfile: vod_live_lowlatency_mss_multiaudio - configfile: lambdatest-full - - process_test_results - -workflows: - version: 2 - commit-workflow: - jobs: - - build-and-unit-test # run unit tests on feature branch - - merge-build-and-unit-test: # run unit tests on virtually merged feature branch - filters: - branches: - ignore: - - development # skiping redundant job if already on development - - functional-tests-single-and-smoke: - filters: - branches: - ignore: # as creds are available only for non-forked branches - - /pull\/[0-9]+/ - diff --git a/.github/workflows/scheduled_smoke_vector_execution.yml b/.github/workflows/scheduled_smoke_vector_execution.yml new file mode 100644 index 0000000000..a1b3c55f12 --- /dev/null +++ b/.github/workflows/scheduled_smoke_vector_execution.yml @@ -0,0 +1,50 @@ +name: scheduled_smoke_vector_execution + +on: + schedule: + - cron: '0 0 * * *' # This will run once a day at midnight UTC + +jobs: + run_functional_test_single_stream_lambdatest: + if: github.repository == 'Dash-Industry-Forum/dash.js' + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: development + fetch-depth: 0 + - name: Cache node modules + id: cache-npm + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} + name: List the state of node modules + continue-on-error: true + run: npm list + - run: npm install + - run: npm run webpack-build + - name: Start Tunnel + uses: LambdaTest/LambdaTest-tunnel-action@v2 + id: tunnel + with: + user: ${{ secrets.LT_USERNAME }} + accessKey: ${{ secrets.LT_ACCESS_KEY }} + tunnelName: "dashjs-tunnel-${{github.run_number}}" + - name: Run functional tests for a single vector on Lambdatest + env: + LT_USERNAME: ${{ secrets.LT_USERNAME }} + LT_ACCESS_KEY: ${{ secrets.LT_ACCESS_KEY }} + run: node_modules/karma/bin/karma start test/functional/config/karma.functional.conf.cjs --configfile=lambdatest-smoke --streamsfile=smoke + + diff --git a/.github/workflows/verify_branch.yml b/.github/workflows/verify_branch.yml new file mode 100644 index 0000000000..3fc1db9c5e --- /dev/null +++ b/.github/workflows/verify_branch.yml @@ -0,0 +1,40 @@ +name: verify_branch + +on: + push: + branches: + - '**' # Triggers on push to any branch + +jobs: + build_and_unit_test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 'latest' + cache: 'npm' + - name: Cache node modules + id: cache-npm + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} + name: List the state of node modules + continue-on-error: true + run: npm list + - run: npm install + - run: tsc + - run: npm run lint + - run: npm run test + - run: npm run webpack-build + diff --git a/.github/workflows/verify_pull_request.yml b/.github/workflows/verify_pull_request.yml new file mode 100644 index 0000000000..a4fd6c4670 --- /dev/null +++ b/.github/workflows/verify_pull_request.yml @@ -0,0 +1,100 @@ +name: verify_pull_request + +on: + pull_request: + branches: + - 'development' + +jobs: + merge_build_and_unit_test: + runs-on: ubuntu-latest + steps: + - name: Checkout development branch of origin + uses: actions/checkout@v4 + with: + repository: Dash-Industry-Forum/dash.js + ref: development + - name: Merge to development + run: | + git config --global user.name "GitHub Action" + git config --global user.email "action@github.com" + git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-branch + git merge pr-branch --no-ff + - name: Setup node + uses: actions/setup-node@v4 + with: + node-version: 'latest' + cache: 'npm' + - name: Cache node modules + id: cache-npm + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} + name: List the state of node modules + continue-on-error: true + run: npm list + - run: npm install + - run: tsc + - run: npm run lint + - run: npm run test + - run: npm run webpack-build + + run_functional_test_single_stream_lambdatest: + if: github.event.pull_request.head.repo.fork == false + runs-on: ubuntu-latest + steps: + - name: Checkout development branch of origin + uses: actions/checkout@v4 + with: + repository: Dash-Industry-Forum/dash.js + ref: development + - name: Merge to development + run: | + git config --global user.name "GitHub Action" + git config --global user.email "action@github.com" + git fetch origin pull/${{ github.event.pull_request.number }}/head:pr-branch + git merge pr-branch --no-ff + - name: Cache node modules + id: cache-npm + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + # npm cache files are stored in `~/.npm` on Linux/macOS + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} + name: List the state of node modules + continue-on-error: true + run: npm list + - run: npm install + - run: npm run webpack-build + - name: Start Tunnel + uses: LambdaTest/LambdaTest-tunnel-action@v2 + id: tunnel + with: + user: ${{ secrets.LT_USERNAME }} + accessKey: ${{ secrets.LT_ACCESS_KEY }} + tunnelName: "dashjs-tunnel-${{github.run_number}}" + - name: Run functional tests for a single vector on Lambdatest + env: + LT_USERNAME: ${{ secrets.LT_USERNAME }} + LT_ACCESS_KEY: ${{ secrets.LT_ACCESS_KEY }} + run: node_modules/karma/bin/karma start test/functional/config/karma.functional.conf.cjs --configfile=lambdatest --streamsfile=single + + diff --git a/test/functional/config/karma.functional.conf.cjs b/test/functional/config/karma.functional.conf.cjs index e922f4088d..83e88a5320 100644 --- a/test/functional/config/karma.functional.conf.cjs +++ b/test/functional/config/karma.functional.conf.cjs @@ -129,8 +129,8 @@ module.exports = function (config) { autoWatch: false, captureTimeout: 600000, - browserNoActivityTimeout: 400000, - browserDisconnectTimeout: 20000, + browserNoActivityTimeout: 90000, + browserDisconnectTimeout: 90000, browserDisconnectTolerance: 2, // start these browsers @@ -177,8 +177,8 @@ function _getExcludedTestfiles(testConfiguration) { function _adjustConfigurationForLambdatest(testConfiguration) { if (testConfiguration && testConfiguration.customLaunchers) { Object.keys(testConfiguration.customLaunchers).forEach((key) => { - testConfiguration.customLaunchers[key].user = process.env.LAMBDATEST_USER; - testConfiguration.customLaunchers[key].accessKey = process.env.LAMBDATEST_ACCESS_KEY; + testConfiguration.customLaunchers[key].user = process.env.LT_USERNAME; + testConfiguration.customLaunchers[key].accessKey = process.env.LT_ACCESS_KEY; testConfiguration.customLaunchers[key].config = { hostname: 'hub.lambdatest.com', port: 80 diff --git a/test/functional/config/test-configurations/lambdatest.json b/test/functional/config/test-configurations/lambdatest.json index 59b88b6521..3cfd2b20ba 100644 --- a/test/functional/config/test-configurations/lambdatest.json +++ b/test/functional/config/test-configurations/lambdatest.json @@ -9,6 +9,7 @@ "hostname": "localhost", "port": 9876, "protocol": "http", + "concurrency": 4, "customLaunchers": { "chrome_windows_11": { "base": "WebDriver", diff --git a/test/functional/src/Constants.js b/test/functional/src/Constants.js index e1f42a649c..a64067681f 100644 --- a/test/functional/src/Constants.js +++ b/test/functional/src/Constants.js @@ -26,7 +26,7 @@ const TESTCASES = { const TEST_TIMEOUT_THRESHOLDS = { IS_PLAYING: 5000, - IS_PROGRESSING: 10000, + IS_PROGRESSING: 15000, IS_NOT_PROGRESSING: 3000, TO_REACH_TARGET_OFFSET: 10000, EVENT_WAITING_TIME: 10000,