]> git.proxmox.com Git - mirror_novnc.git/commitdiff
Use GitHub actions instead of Travis/Sauce Labs
authorPierre Ossman <ossman@cendio.se>
Tue, 23 Jun 2020 11:56:33 +0000 (13:56 +0200)
committerPierre Ossman <ossman@cendio.se>
Tue, 23 Jun 2020 11:56:33 +0000 (13:56 +0200)
The ability to use Sauce Labs for pull requests has now stopped working,
as Travis warned about several years ago. Instead run our tests directly
on GitHub on their various virtual machines.

.github/workflows/deploy.yml [new file with mode: 0644]
.github/workflows/lint.yml [new file with mode: 0644]
.github/workflows/test.yml [new file with mode: 0644]
.travis.yml [deleted file]
karma.conf.js
package.json

diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
new file mode 100644 (file)
index 0000000..cd90eba
--- /dev/null
@@ -0,0 +1,16 @@
+name: Publish
+
+on:
+  release:
+    types: [published]
+
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-node@v1
+      - run: npm install
+      - run: npm publish --access public
+        env:
+          NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
new file mode 100644 (file)
index 0000000..aaa3673
--- /dev/null
@@ -0,0 +1,19 @@
+name: Lint
+
+on: [push, pull_request]
+
+jobs:
+  eslint:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-node@v1
+      - run: npm install
+      - run: npm run lint
+  html:
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-node@v1
+      - run: npm install
+      - run: git ls-tree --name-only -r HEAD | grep -E "[.](html|css)$" | xargs ./utils/validate
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644 (file)
index 0000000..5b03504
--- /dev/null
@@ -0,0 +1,30 @@
+name: Test
+
+on: [push, pull_request]
+
+jobs:
+  test:
+    strategy:
+      matrix:
+        os:
+          - ubuntu-latest
+          - windows-latest
+        browser:
+          - ChromeHeadless
+          - FirefoxHeadless
+        include:
+          - os: macos-latest
+            browser: Safari
+          - os: windows-latest
+            browser: EdgeHeadless
+          - os: windows-latest
+            browser: IE
+      fail-fast: false
+    runs-on: ${{ matrix.os }}
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-node@v1
+      - run: npm install
+      - run: npm run test
+        env:
+          TEST_BROWSER_NAME: ${{ matrix.browser }}
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644 (file)
index da51f67..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-language: node_js
-sudo: false
-cache:
-  directories:
-  - node_modules
-node_js:
-  - lts/*
-env:
-  matrix:
-  - TEST_BROWSER_NAME=chrome TEST_BROWSER_OS='Windows 10'
-# FIXME Skip tests in Linux since Sauce Labs browser versions are ancient.
-#  - TEST_BROWSER_NAME=chrome TEST_BROWSER_OS='Linux'
-  - TEST_BROWSER_NAME=chrome TEST_BROWSER_OS='OS X 10.11'
-  - TEST_BROWSER_NAME=firefox TEST_BROWSER_OS='Windows 10'
-#  - TEST_BROWSER_NAME=firefox TEST_BROWSER_OS='Linux'
-  - TEST_BROWSER_NAME=firefox TEST_BROWSER_OS='OS X 10.11'
-  - TEST_BROWSER_NAME='internet explorer' TEST_BROWSER_OS='Windows 10'
-  - TEST_BROWSER_NAME='internet explorer' TEST_BROWSER_OS='Windows 7'
-  - TEST_BROWSER_NAME=microsoftedge TEST_BROWSER_OS='Windows 10'
-  - TEST_BROWSER_NAME=safari TEST_BROWSER_OS='OS X 10.13'
-before_script: npm install -g karma-cli
-addons:
-  sauce_connect:
-    username: "directxman12"
-  jwt:
-    secure: "d3ekMYslpn6R4f0ajtRMt9SUFmNGDiItHpqaXC5T4KI0KMEsxgvEOfJot5PiFFJWg1DSpJZH6oaW2UxGZ3duJLZrXIEd/JePY8a6NtT35BNgiDPgcp+eu2Bu3rhrSNg7/HEsD1ma+JeUTnv18Ai5oMFfCCQJx2J6osIxyl/ZVxA="
-stages:
-- lint
-- test
-- name: deploy
-  if: tag is PRESENT
-jobs:
-  include:
-  - stage: lint
-    env:
-    addons:
-    before_script:
-    script: npm run lint
-  -
-    env:
-    addons:
-    before_script:
-    script: git ls-tree --name-only -r HEAD | grep -E "[.](html|css)$" | xargs ./utils/validate
-  - stage: deploy
-    env:
-    addons:
-    script: skip
-    before_script: skip
-    deploy:
-      provider: npm
-      skip_cleanup: true
-      email: ossman@cendio.se
-      api_key:
-        secure: "Qq2Mi9xQawO2zlAigzshzMu2QMHvu1IaN9l0ZIivE99wHJj7eS5f4miJ9wB+/mWRRgb3E8uj9ZRV24+Oc36drlBTU9sz+lHhH0uFMfAIseceK64wZV9sLAZm472fmPp2xdUeTCCqPaRy7g1XBqiJ0LyZvEFLsRijqcLjPBF+b8w="
-      on:
-        tags: true
-        repo: novnc/noVNC
-
-
index 0e316f1ea88eba8284c5c6a76eeb7b748ca20f25..c295b1f900cfdc2812bc11c468847bd81620af4d 100644 (file)
@@ -1,48 +1,23 @@
 // Karma configuration
 
+// The Safari launcher is broken, so construct our own
+function SafariBrowser(id, baseBrowserDecorator, args) {
+  baseBrowserDecorator(this);
+
+  this._start = function(url) {
+    this._execCommand('/usr/bin/open', ['-W', '-n', '-a', 'Safari', url]);
+  }
+}
+
+SafariBrowser.prototype = {
+  name: 'Safari'
+}
+
 module.exports = (config) => {
-  const customLaunchers = {};
   let browsers = [];
-  let useSauce = false;
-
-  // use Sauce when running on Travis
-  if (process.env.TRAVIS_JOB_NUMBER) {
-    useSauce = true;
-  } 
-
-  if (useSauce && process.env.TEST_BROWSER_NAME && process.env.TEST_BROWSER_NAME != 'PhantomJS') {
-    const names = process.env.TEST_BROWSER_NAME.split(',');
-    const platforms = process.env.TEST_BROWSER_OS.split(',');
-    const versions = process.env.TEST_BROWSER_VERSION
-      ? process.env.TEST_BROWSER_VERSION.split(',')
-      : [null];
-
-    for (let i = 0; i < names.length; i++) {
-      for (let j = 0; j < platforms.length; j++) {
-        for (let k = 0; k < versions.length; k++) {
-          let launcher_name = 'sl_' + platforms[j].replace(/[^a-zA-Z0-9]/g, '') + '_' + names[i];
-          if (versions[k]) {
-            launcher_name += '_' + versions[k];
-          }
-
-          customLaunchers[launcher_name] = {
-            base: 'SauceLabs',
-            browserName: names[i],
-            platform: platforms[j],
-          };
-
-          if (versions[i]) {
-            customLaunchers[launcher_name].version = versions[k];
-          }
-        }
-      }
-    }
 
-    browsers = Object.keys(customLaunchers);
-  } else {
-    useSauce = false;
-    //browsers = ['PhantomJS'];
-    browsers = [];
+  if (process.env.TEST_BROWSER_NAME) {
+    browsers = process.env.TEST_BROWSER_NAME.split(',');
   }
 
   const my_conf = {
@@ -80,7 +55,11 @@ module.exports = (config) => {
     exclude: [
     ],
 
-    customLaunchers: customLaunchers,
+    plugins: [
+      'karma-*',
+      '@chiragrupani/karma-chromium-edge-launcher',
+      { 'launcher:Safari': [ 'type', SafariBrowser ] },
+    ],
 
     // start these browsers
     // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
@@ -103,24 +82,7 @@ module.exports = (config) => {
     // Continuous Integration mode
     // if true, Karma captures browsers, runs the tests and exits
     singleRun: true,
-
-    // Increase timeout in case connection is slow/we run more browsers than possible
-    // (we currently get 3 for free, and we try to run 7, so it can take a while)
-    captureTimeout: 240000,
-
-    // similarly to above
-    browserNoActivityTimeout: 100000,
   };
 
-  if (useSauce) {
-    my_conf.reporters.push('saucelabs');
-    my_conf.captureTimeout = 0; // use SL timeout
-    my_conf.sauceLabs = {
-      testName: 'noVNC Tests (all)',
-      startConnect: false,
-      tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER
-    };
-  }
-
   config.set(my_conf);
 };
index 8ef1ccf5560301c3c9a6fb682e80c3bf2d930b91..cf95942feaa47451f24898248ce1798d69ac5550 100644 (file)
     "jsdom": "*",
     "karma": "*",
     "karma-mocha": "*",
+    "karma-chrome-launcher": "*",
+    "@chiragrupani/karma-chromium-edge-launcher": "*",
+    "karma-firefox-launcher": "*",
+    "karma-ie-launcher": "*",
     "karma-mocha-reporter": "*",
-    "karma-sauce-launcher": "*",
+    "karma-safari-launcher": "*",
+    "karma-script-launcher": "*",
     "karma-sinon-chai": "*",
     "mocha": "*",
     "node-getopt": "*",