From e107c705edfdef42bbd9ac92b419070793d1450f Mon Sep 17 00:00:00 2001 From: Gilad Nadav Date: Tue, 18 Apr 2023 00:42:30 +0300 Subject: [PATCH 1/7] github actions canary --- .github/workflows/run_canary_full_flow.yaml | 27 ++++++ .github/workflows/run_prod.yaml | 24 ++++++ .github/workflows/run_tests.yaml | 24 ++++++ .travis.yml | 96 --------------------- karma.conf.js | 27 +----- scripts/after_deploy.sh | 38 -------- scripts/travis.sh | 40 --------- 7 files changed, 79 insertions(+), 197 deletions(-) create mode 100644 .github/workflows/run_canary_full_flow.yaml create mode 100644 .github/workflows/run_prod.yaml create mode 100644 .github/workflows/run_tests.yaml delete mode 100644 .travis.yml delete mode 100644 scripts/after_deploy.sh delete mode 100644 scripts/travis.sh diff --git a/.github/workflows/run_canary_full_flow.yaml b/.github/workflows/run_canary_full_flow.yaml new file mode 100644 index 0000000..724a364 --- /dev/null +++ b/.github/workflows/run_canary_full_flow.yaml @@ -0,0 +1,27 @@ +## Canary CI/CD +name: Canary Full Flow +run-name: Canary Full Flow + +on: + push: + branches: + - devops-deployment + +jobs: + canary-full-flow: + if: ${{ github.actor != 'PlaykitJs-Bot' }} + uses: kaltura/ovp-pipelines-pub/.github/workflows/player_cicd.yaml@v1.0.0 + secrets: + PLAYER_CENTRAL_ACCOUNT_ID: ${{ secrets.PLAYER_CENTRAL_ACCOUNT_ID }} + PLAYER_SERVICES_ACCOUNT_ID: ${{ secrets.PLAYER_SERVICES_ACCOUNT_ID }} + PLAYER_S3_BUCKET_DEPLOYMENT: ${{ secrets.PLAYER_S3_BUCKET_DEPLOYMENT }} + PLAYER_S3_BUCKET_APPS: ${{ secrets.PLAYER_S3_BUCKET_APPS }} + PLAYER_NPM_TOKEN: ${{ secrets.PLAYER_NPM_TOKEN }} + PLAYER_LAMBDA_NAME: ${{ secrets.PLAYER_LAMBDA_NAME }} + PLAYER_MSTEAMS_WEBHOOK: ${{ secrets.PLAYER_MSTEAMS_WEBHOOK }} + PLAYER_GITHUB_BOT_TOKEN: ${{ secrets.PLAYER_GITHUB_BOT_TOKEN }} + with: + type: "plugin" + stage: "canary" + schema-type: "playerV3Versions" + tests-yarn-run-to-execute: 'eslint flow test' diff --git a/.github/workflows/run_prod.yaml b/.github/workflows/run_prod.yaml new file mode 100644 index 0000000..b74800d --- /dev/null +++ b/.github/workflows/run_prod.yaml @@ -0,0 +1,24 @@ +## Prod CI +name: Prod +run-name: Prod + +on: + workflow_dispatch: + +jobs: + prod: + uses: kaltura/ovp-pipelines-pub/.github/workflows/player_cicd.yaml@v1.0.0 + secrets: + PLAYER_CENTRAL_ACCOUNT_ID: ${{ secrets.PLAYER_CENTRAL_ACCOUNT_ID }} + PLAYER_SERVICES_ACCOUNT_ID: ${{ secrets.PLAYER_SERVICES_ACCOUNT_ID }} + PLAYER_S3_BUCKET_DEPLOYMENT: ${{ secrets.PLAYER_S3_BUCKET_DEPLOYMENT }} + PLAYER_S3_BUCKET_APPS: ${{ secrets.PLAYER_S3_BUCKET_APPS }} + PLAYER_NPM_TOKEN: ${{ secrets.PLAYER_NPM_TOKEN }} + PLAYER_LAMBDA_NAME: ${{ secrets.PLAYER_LAMBDA_NAME }} + PLAYER_MSTEAMS_WEBHOOK: ${{ secrets.PLAYER_MSTEAMS_WEBHOOK }} + PLAYER_GITHUB_BOT_TOKEN: ${{ secrets.PLAYER_GITHUB_BOT_TOKEN }} + with: + type: "plugin" + env: "prod" + schema-type: "playerV3Versions" + tests-yarn-run-to-execute: 'eslint flow test' diff --git a/.github/workflows/run_tests.yaml b/.github/workflows/run_tests.yaml new file mode 100644 index 0000000..182242c --- /dev/null +++ b/.github/workflows/run_tests.yaml @@ -0,0 +1,24 @@ +## CI - Player And Plugin Tests +name: Player And Plugin Tests +run-name: Player And Plugin Tests + +on: + pull_request: + branches: + - "*" + +jobs: + running-tests: + uses: kaltura/ovp-pipelines-pub/.github/workflows/player_tests.yaml@v1.0.0 + with: + yarn-run-to-execute: 'eslint flow test' + notification: + if: always() + uses: kaltura/ovp-pipelines-pub/.github/workflows/notification.yaml@v1.0.0 + needs: running-tests + secrets: + PLAYER_MSTEAMS_WEBHOOK: ${{ secrets.PLAYER_MSTEAMS_WEBHOOK }} + with: + failure-status: ${{ contains(needs.*.result, 'failure') }} + cancelled-status: ${{ contains(needs.*.result, 'cancelled') }} + is-test: 'true' \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1946677..0000000 --- a/.travis.yml +++ /dev/null @@ -1,96 +0,0 @@ -notifications: - webhooks: - urls: - - https://kaltura.webhook.office.com/webhookb2/b992a7e1-5ff6-49a7-8d78-2f5e2909a982@0c503748-de3f-4e25-97e2-6819d53a42b6/TravisCI/27ca561440dc48628cfc54b19e8df7d8/4779c8dc-fa74-44a9-9710-010265f09a25 - on_success: never - on_cancel: never - -conditions: v1 -sudo: required -dist: xenial -language: node_js -node_js: - - '15' - -addons: - chrome: stable - -services: - - xvfb -cache: - yarn: true - directories: - - node_modules - -before_install: - - export DISPLAY=:99.0 - - chmod +x ./scripts/travis.sh - - chmod +x ./scripts/after_deploy.sh - -script: ./scripts/travis.sh - -stages: - - Tests - - Release canary - - Release - - Deploy - -jobs: - fast_finish: true - include: - # https://docs.travis-ci.com/user/build-stages/deploy-github-releases/ - - stage: Deploy - name: "Deploying a new version" - if: tag IS present - env: TRAVIS_MODE=deploy - deploy: - - provider: script - on: - tags: true - all_branches: true - script: bash ./scripts/after_deploy.sh "$JENKINS_TAG_TOKEN" - - stage: Release - name: 'Releasing a new version' - if: tag IS present - env: TRAVIS_MODE=release - deploy: - - provider: releases - api_key: $GH_TOKEN - file_glob: true - file: dist/* - prerelease: false - skip_cleanup: true - on: - branch: master - tags: true - - provider: npm - api_key: $NPM_TOKEN - email: $NPM_EMAIL - skip_cleanup: true - on: - tags: true - branch: master - # publish canary package if on master - - stage: Release canary - if: (branch = master) AND (type != pull_request) AND commit_message !~ /^chore\(release\)/ - env: TRAVIS_MODE=releaseCanary - deploy: - provider: npm - api_key: $NPM_TOKEN - email: $NPM_EMAIL - skip_cleanup: true - tag: canary - on: - tags: false - branch: master - after_deploy: - - ./scripts/after_deploy.sh "$JENKINS_CANARY_TOKEN" - # Required tests - - stage: Tests - if: ((branch = master) OR (tag IS present) OR (type = pull_request)) AND commit_message !~ /^chore\(release\)/ - name: 'Running lint' - env: TRAVIS_MODE=lint - - stage: Tests - if: ((branch = master) OR (tag IS present) OR (type = pull_request)) AND commit_message !~ /^chore\(release\)/ - name: 'Running Flow type check' - env: TRAVIS_MODE=flow diff --git a/karma.conf.js b/karma.conf.js index 9305a32..5021e41 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,13 +1,4 @@ -const isWindows = /^win/.test(process.platform); -const isMacOS = /^darwin/.test(process.platform); -// Create custom launcher in case running with Travis -const customLaunchers = { - Safari_travis_ci: { - base: 'Safari', - flags: ['--no-sandbox', '--autoplay-policy=no-user-gesture-required'] - } -}; - +//Create custom launcher in case running with Travis const launchers = { Safari_browser: { base: 'Safari', @@ -20,8 +11,7 @@ module.exports = function (config) { logLevel: config.LOG_INFO, browserDisconnectTimeout: 30000, browserNoActivityTimeout: 60000, - customLaunchers: launchers, - browsers: ['Safari_browser'], + browsers: [], concurrency: 1, singleRun: true, colors: true, @@ -49,16 +39,7 @@ module.exports = function (config) { } }; - if (process.env.TRAVIS) { - karmaConf.customLaunchers = customLaunchers; - karmaConf.browsers = ['Safari_travis_ci']; - } else { - if (isWindows) { - karmaConf.browsers.push('IE'); - } else if (isMacOS) { - karmaConf.browsers.push('Safari'); - } - } - + karmaConf.customLaunchers = launchers; + karmaConf.browsers = ['Safari_browser']; config.set(karmaConf); }; diff --git a/scripts/after_deploy.sh b/scripts/after_deploy.sh deleted file mode 100644 index 33d2b15..0000000 --- a/scripts/after_deploy.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash -set -x -curl ifconfig.me - -#!/bin/bash -REPO_PREFIX="@playkit-js/playkit-js-" -HTTP_SUCCESS=false - -currentVersion=$(npx -c 'echo "$npm_package_version"') -repoName=$(npx -c 'echo "$npm_package_name"') -packageName="playkit-${repoName#$REPO_PREFIX}" -echo "$packageName" -echo "$currentVersion" - -TAGGED_BRANCH=$(git ls-remote origin | sed -n "\|$TRAVIS_COMMIT\s\+refs/heads/|{s///p}") -UPDATE_SCHEMA=true -if [ "$TAGGED_BRANCH" != "master" ]; then - UPDATE_SCHEMA=false -fi - -for i in {1..3}; do - echo "Try number $i for pinging Jenkins...\n" - HTTP_CODE=$(curl -k -d "{'name': $packageName, 'version':$currentVersion, 'source':'npm', 'schema_type': 'playerV3Versions', 'update_schema': $UPDATE_SCHEMA}" -H "Content-Type: application/json" --silent --output /dev/stderr --write-out "%{http_code}" --fail -X POST https://jenkins-central.prod.ovp.kaltura.com/generic-webhook-trigger/invoke?token=$1) - STATUS_CODE=$? - echo "Request return with http code $HTTP_CODE and curl finished with status code $STATUS_CODE" - if [ "$HTTP_CODE" -eq 200 ] && [ "$STATUS_CODE" -eq 0 ]; then - HTTP_SUCCESS=true - break - fi -done - -echo "Jenkins ping success status - $HTTP_SUCCESS" - -if [ "$HTTP_SUCCESS" = true ]; then - exit 0 -else - exit 1 -fi diff --git a/scripts/travis.sh b/scripts/travis.sh deleted file mode 100644 index 07c635d..0000000 --- a/scripts/travis.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -# https://docs.travis-ci.com/user/customizing-the-build/#Implementing-Complex-Build-Steps -set -ev -yarn install -if [ "${TRAVIS_MODE}" = "lint" ]; then - yarn run eslint -elif [ "${TRAVIS_MODE}" = "flow" ]; then - yarn run flow -elif [ "${TRAVIS_MODE}" = "unitTests" ]; then - yarn run test -elif [ "${TRAVIS_MODE}" = "release" ] || [ "${TRAVIS_MODE}" = "releaseCanary" ]; then - if [ "${TRAVIS_MODE}" = "releaseCanary" ]; then - echo "Run standard-version" - yarn run release --prerelease canary --skip.commit=true --skip.tag=true - sha=$(git rev-parse --verify --short HEAD) - echo "Current sha ${sha}" - commitNumberAfterTag=$(git rev-list `git rev-list --tags --no-walk --max-count=1`..HEAD --count) - echo "Number of commit from last tag ${commitNumberAfterTag}" - currentVersion=$(npx -c 'echo "$npm_package_version"') - echo "Current version ${currentVersion}" - newVersion=$(echo $currentVersion | sed -e "s/canary\.[[:digit:]]/canary.${commitNumberAfterTag}-${sha}/g") - echo "New version ${newVersion}" - sed -iE "s/$currentVersion/$newVersion/g" package.json - sed -iE "s/$currentVersion/$newVersion/g" CHANGELOG.md - rm package.jsonE - rm CHANGELOG.mdE - else - echo "Run conventional-github-releaser" - #ignore error to make sure release won't get stuck - conventional-github-releaser -p angular -t $GH_TOKEN || true - fi - echo "Building..." - yarn run build - echo "Finish building" -elif [ "${TRAVIS_MODE}" = "deploy" ]; then - echo "Deploy..." -else - echo "Unknown travis mode: ${TRAVIS_MODE}" 1>&2 - exit 1 -fi From 911b60fa1313133e29b7a53b97663662c0ddf106 Mon Sep 17 00:00:00 2001 From: Gilad Nadav Date: Mon, 24 Apr 2023 14:21:11 +0300 Subject: [PATCH 2/7] run on safari --- .github/workflows/run_canary_full_flow.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/run_canary_full_flow.yaml b/.github/workflows/run_canary_full_flow.yaml index 724a364..a93d44b 100644 --- a/.github/workflows/run_canary_full_flow.yaml +++ b/.github/workflows/run_canary_full_flow.yaml @@ -25,3 +25,6 @@ jobs: stage: "canary" schema-type: "playerV3Versions" tests-yarn-run-to-execute: 'eslint flow test' + run-on-ubuntu: "false" + run-on-macos: "true" + \ No newline at end of file From 029f87cfb048eb405eca7b0da10a727048d3875f Mon Sep 17 00:00:00 2001 From: Gilad Nadav Date: Mon, 24 Apr 2023 14:53:09 +0300 Subject: [PATCH 3/7] add empty test --- test/src/airplay.spec.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 test/src/airplay.spec.js diff --git a/test/src/airplay.spec.js b/test/src/airplay.spec.js new file mode 100644 index 0000000..3d2883b --- /dev/null +++ b/test/src/airplay.spec.js @@ -0,0 +1,5 @@ +describe('Airplay Engine', () => { + it('should return true', () => { + return true; + }); +}); From 7f9eb10d9302f42b6ab4b165f3b895e6987f3660 Mon Sep 17 00:00:00 2001 From: Gilad Nadav Date: Mon, 24 Apr 2023 15:21:46 +0300 Subject: [PATCH 4/7] remove tests --- .github/workflows/run_canary_full_flow.yaml | 3 +-- .github/workflows/run_tests.yaml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run_canary_full_flow.yaml b/.github/workflows/run_canary_full_flow.yaml index a93d44b..e511507 100644 --- a/.github/workflows/run_canary_full_flow.yaml +++ b/.github/workflows/run_canary_full_flow.yaml @@ -24,7 +24,6 @@ jobs: type: "plugin" stage: "canary" schema-type: "playerV3Versions" - tests-yarn-run-to-execute: 'eslint flow test' + tests-yarn-run-to-execute: 'eslint flow' run-on-ubuntu: "false" run-on-macos: "true" - \ No newline at end of file diff --git a/.github/workflows/run_tests.yaml b/.github/workflows/run_tests.yaml index 182242c..2c8a3e8 100644 --- a/.github/workflows/run_tests.yaml +++ b/.github/workflows/run_tests.yaml @@ -11,7 +11,7 @@ jobs: running-tests: uses: kaltura/ovp-pipelines-pub/.github/workflows/player_tests.yaml@v1.0.0 with: - yarn-run-to-execute: 'eslint flow test' + yarn-run-to-execute: 'eslint flow' notification: if: always() uses: kaltura/ovp-pipelines-pub/.github/workflows/notification.yaml@v1.0.0 From e0cfedaafb432fdd4d559939f3aef2bdc22377db Mon Sep 17 00:00:00 2001 From: Gilad Nadav Date: Thu, 27 Apr 2023 20:08:49 +0300 Subject: [PATCH 5/7] change to master --- .github/workflows/run_canary_full_flow.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_canary_full_flow.yaml b/.github/workflows/run_canary_full_flow.yaml index e511507..852be66 100644 --- a/.github/workflows/run_canary_full_flow.yaml +++ b/.github/workflows/run_canary_full_flow.yaml @@ -5,7 +5,7 @@ run-name: Canary Full Flow on: push: branches: - - devops-deployment + - master jobs: canary-full-flow: From 7cdee702a4ab8a6f778cfaec3c57b7384f51a08a Mon Sep 17 00:00:00 2001 From: Gilad Nadav Date: Thu, 27 Apr 2023 21:23:49 +0300 Subject: [PATCH 6/7] fix run_prod --- .github/workflows/run_prod.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_prod.yaml b/.github/workflows/run_prod.yaml index b74800d..ffc688a 100644 --- a/.github/workflows/run_prod.yaml +++ b/.github/workflows/run_prod.yaml @@ -21,4 +21,4 @@ jobs: type: "plugin" env: "prod" schema-type: "playerV3Versions" - tests-yarn-run-to-execute: 'eslint flow test' + tests-yarn-run-to-execute: 'eslint flow' From 732eb9413be1ecf0eacee7def002569c5e618c0a Mon Sep 17 00:00:00 2001 From: Sivan Agranov <88330203+SivanA-Kaltura@users.noreply.github.com> Date: Thu, 4 May 2023 14:38:22 +0300 Subject: [PATCH 7/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a31541f..f107f0b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # PlayKit JS AirPlay - Apple AirPlay Plugin for the [Kaltura Player JS] -[![Build Status](https://travis-ci.com/kaltura/playkit-js-airplay.svg?branch=master)](https://travis-ci.com/kaltura/playkit-js-airplay) +[![Build Status](https://github.com/kaltura/playkit-js-airplay/actions/workflows/run_canary_full_flow.yaml/badge.svg)](https://github.com/kaltura/playkit-js-airplay/actions/workflows/run_canary_full_flow.yaml) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier) [![](https://img.shields.io/npm/v/@playkit-js/playkit-js-airplay/latest.svg)](https://www.npmjs.com/package/@playkit-js/playkit-js-airplay) [![](https://img.shields.io/npm/v/@playkit-js/playkit-js-airplay/canary.svg)](https://www.npmjs.com/package/@playkit-js/playkit-js-airplay/v/canary)