From c0767ff5b08d9005a94286b1b9b32e4d8636966f Mon Sep 17 00:00:00 2001 From: Gilad Nadav Date: Tue, 18 Apr 2023 01:12:53 +0300 Subject: [PATCH 1/3] fix karma.conf --- .github/workflows/run_canary_full_flow.yaml | 27 +++++ .github/workflows/run_prod.yaml | 24 +++++ .github/workflows/run_tests.yaml | 24 +++++ .travis.yml | 103 -------------------- karma.conf.js | 27 +---- scripts/after_deploy.sh | 38 -------- scripts/travis.sh | 40 -------- 7 files changed, 79 insertions(+), 204 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 9e9b95f..0000000 --- a/.travis.yml +++ /dev/null @@ -1,103 +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: - - 17 -env: - global: - - NODE_OPTIONS="--openssl-legacy-provider" - -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 - - stage: Tests - if: ((branch = master) OR (tag IS present) OR (type = pull_request)) AND commit_message !~ /^chore\(release\)/ - name: 'Running unit tests' - env: TRAVIS_MODE=unitTests diff --git a/karma.conf.js b/karma.conf.js index 9ada233..246ba3d 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -1,16 +1,7 @@ -const isWindows = /^win/.test(process.platform); -const isMacOS = /^darwin/.test(process.platform); // Create custom launcher in case running with Travis -const customLaunchers = { - Chrome_travis_ci: { - base: 'Chrome', - flags: ['--no-sandbox', '--autoplay-policy=no-user-gesture-required'] - } -}; - const launchers = { Chrome_browser: { - base: 'Chrome', + base: 'ChromeHeadless', flags: ['--no-sandbox', '--autoplay-policy=no-user-gesture-required'] } }; @@ -18,8 +9,7 @@ const launchers = { module.exports = config => { const karmaConf = { logLevel: config.LOG_INFO, - customLaunchers: launchers, - browsers: ['Chrome_browser', 'Firefox'], + browsers: [], concurrency: 1, singleRun: true, colors: true, @@ -47,16 +37,7 @@ module.exports = config => { } }; - if (process.env.TRAVIS) { - karmaConf.customLaunchers = customLaunchers; - karmaConf.browsers = ['Chrome_travis_ci']; - } else { - if (isWindows) { - karmaConf.browsers.push('IE'); - } else if (isMacOS) { - karmaConf.browsers.push('Safari'); - } - } - + karmaConf.customLaunchers = launchers; + karmaConf.browsers = ['Chrome_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 1e6f1e4bb216d975ef6e528c3b9b755f7bff9b89 Mon Sep 17 00:00:00 2001 From: Gilad Nadav Date: Thu, 27 Apr 2023 20:26:53 +0300 Subject: [PATCH 2/3] 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 724a364..d107029 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 2a66dd29d2a835643f3a7fb078bb0955fb71d406 Mon Sep 17 00:00:00 2001 From: Sivan Agranov <88330203+SivanA-Kaltura@users.noreply.github.com> Date: Thu, 4 May 2023 14:46:47 +0300 Subject: [PATCH 3/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bc655ab..025446d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # PlayKit JS Google Analytics - Google Analytics plugin for the [Kaltura Player JS] -[![Build Status](https://travis-ci.org/kaltura/playkit-js-google-analytics.svg?branch=master)](https://travis-ci.org/kaltura/playkit-js-google-analytics) +[![Build Status](https://github.com/kaltura/playkit-js-google-analytics/actions/workflows/run_canary_full_flow.yaml/badge.svg)](https://github.com/kaltura/playkit-js-google-analytics/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-google-analytics/latest.svg)](https://www.npmjs.com/package/@playkit-js/playkit-js-google-analytics) [![](https://img.shields.io/npm/v/@playkit-js/playkit-js-google-analytics/canary.svg)](https://www.npmjs.com/package/@playkit-js/playkit-js-google-analytics/v/canary)