Skip to content

Commit

Permalink
Switch to GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Borewit committed Feb 11, 2021
1 parent c3d2a97 commit cc03b38
Show file tree
Hide file tree
Showing 7 changed files with 192 additions and 20 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/karma-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Browserstack CI
on:
push:

jobs:

test:

runs-on: ubuntu-latest

steps:

- name: 'BrowserStack Env Setup' # Invokes the setup-env action
uses: browserstack/github-actions/setup-env@master
with:
username: ${{ secrets.BROWSERSTACK_USERNAME }}
access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}

- name: 'Checkout the repository'
uses: actions/checkout@v2

- uses: actions/setup-node@v1
with:
node-version: 12.x

- name: Install dependencies
run: yarn install

- name: Perform Karma tests on Browserstack
run: yarn run karma-browserstack

- name: Coveralls Parallel
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
flag-name: run-${{ matrix.test_number }}
parallel: true

finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
72 changes: 72 additions & 0 deletions .github/workflows/nodejs-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Node.js CI
on:
push:

jobs:

build:

runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v2

- uses: actions/setup-node@v1
with:
node-version: 12.x

- name: Install production dependencies, check node engine compatiblity
run: yarn install --production=true

- name: Install development dependencies
run: yarn install --production=false --ignore-engines

- name: Build & Code analysis
run: yarn run lint

- name: Build
run: yarn run build

- name: Upload build
uses: actions/upload-artifact@v2
with:
name: build
path: |
lib/**/*.js
lib/**/*.js.map
lib/**/*.d.ts
test/**/*.js
test/**/*.js.map
test:

runs-on: ubuntu-latest

needs: build

strategy:
matrix:
node-version: [10.x, 12.x, 14.x]

steps:

- name: 'Checkout the repository'
uses: actions/checkout@v2

- name: Test with Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: yarn install --ignore-engines

- name: Download build
uses: actions/download-artifact@v2
with:
name: build

- name: Test with Node.js ${{ matrix.node-version }}
run: yarn run test-node

14 changes: 0 additions & 14 deletions .travis.yml

This file was deleted.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
![Node.js CI](https://github.com/Borewit/tokenizer-http/workflows/Node.js%20CI/badge.svg)
![Browserstack CI](https://github.com/Borewit/tokenizer-http/workflows/Browserstack%20CI/badge.svg)
[![Build Status](https://travis-ci.org/Borewit/tokenizer-http.svg?branch=master)](https://travis-ci.org/Borewit/tokenizer-http)
[![npm version](https://badge.fury.io/js/%40tokenizer%2Fhttp.svg)](https://www.npmjs.com/package/@tokenizer/http)
[![npm downloads](http://img.shields.io/npm/dm/@tokenizer/http.svg)](https://npmcharts.com/compare/@tokenizer/http?interval=30)
Expand Down
72 changes: 67 additions & 5 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,38 @@ module.exports = config => {
},

webpack: {
module: webpackConfig.module,
resolve: webpackConfig.resolve,
mode: webpackConfig.mode,
devtool: 'inline-source-map',
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader'
},
{
test: /\.ts$/,
use: {loader: 'istanbul-instrumenter-loader'},
enforce: 'post',
exclude: /\.spec\.ts$/
}

]
},
},

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress', 'kjhtml', 'coverage-istanbul', 'spec'],
reporters: ['coverage-istanbul'],

// https://www.npmjs.com/package/karma-coverage-istanbul-reporter
coverageIstanbulReporter: {
dir: path.join(__dirname, 'coverage'),
reports: ['text-summary'],
fixWebpackSourcePaths: true
reports: ['text-summary', 'lcovonly', 'html'],
fixWebpackSourcePaths: true,
combineBrowserReports: true, // Combines coverage information from multiple browsers into one report
skipFilesWithNoCoverage: true
},

// enable / disable colors in the output (reporters and logs)
Expand All @@ -61,6 +77,52 @@ module.exports = config => {

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false
singleRun: false,

// global BrowserStack configuration
browserStack: {
forcelocal: true, // force traffic through the local BrowserStack tunnel, passes flag through to BrowserStackTunnel
project: 'tokenizer-http',
timeout: 30, // BROWSERSTACK_IDLE_TIMEOUT
captureTimeout: 30
},

// define browsers, see https://www.browserstack.com/automate/capabilities
customLaunchers: {
bs_win_chrome: {
base: 'BrowserStack',
os: 'Windows',
os_version: '10',
browser: 'Chrome',
browser_version: '88.0'
},
bs_win_firefox: {
base: 'BrowserStack',
os: 'Windows',
os_version: '10',
browser: 'Firefox',
browser_version: '84.0'
},
bs_osx_safari: {
base: 'BrowserStack',
os: 'OS X',
os_version: 'Big Sur',
browser: 'Safari',
browser_version: '14'
},
bs_win_edge: {
base: 'BrowserStack',
os: 'Windows',
os_version: '10',
browser: 'Edge',
browser_version: '88'
}
},

// Increase time-outs to prevent disconnects on BrowserStack
browserDisconnectTimeout : 10000, // default 2000
browserDisconnectTolerance : 1, // default 0
browserNoActivityTimeout : 4*60*1000, //default 10000
captureTimeout : 4*60*1000, //default 60000
})
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"test": "npm run karma-once",
"test-node": "cd node && yarn install && yarn test",
"karma-once": "karma start --browsers ChromeHeadless --single-run",
"travis-karma": "karma start --browsers Firefox --single-run",
"karma-browserstack": "karma start --browsers bs_win_chrome,bs_osx_safari,bs_win_edge --single-run --reporters coverage-istanbul,spec,BrowserStack",
"post-coveralls": "coveralls < coverage/lcov.info"
},
"devDependencies": {
Expand All @@ -63,6 +63,7 @@
"istanbul-instrumenter-loader": "^3.0.1",
"jasmine-core": "^3.6.0",
"karma": "^6.1.0",
"karma-browserstack-launcher": "^1.6.0",
"karma-chrome-launcher": "^3.1.0",
"karma-coverage-istanbul-reporter": "^3.0.3",
"karma-firefox-launcher": "^2.1.0",
Expand Down
2 changes: 2 additions & 0 deletions test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ const parsers: IParserTest[] = [

describe('streaming-http-token-reader', () => {

jasmine.DEFAULT_TIMEOUT_INTERVAL = 20000;

describe('Parse WebAmp tracks', () => {

const profiles: IFetchProfile[] = [
Expand Down

0 comments on commit cc03b38

Please sign in to comment.