Skip to content

Commit

Permalink
Enable Travis and add a test that verifies the union build (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsmilkov committed Mar 31, 2018
1 parent 6533c73 commit 4030a12
Show file tree
Hide file tree
Showing 6 changed files with 3,244 additions and 52 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
language: node_js
node_js: "8"
script:
- yarn build
- yarn lint
- yarn test-travis
64 changes: 64 additions & 0 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/

module.exports = function(config) {
config.set({
frameworks: ['jasmine', 'karma-typescript'],
files: [{pattern: 'src/**/*.ts'}],
preprocessors: {
'**/*.ts': ['karma-typescript'], // *.tsx for React Jsx
},
karmaTypescriptConfig: {
tsconfig: 'tsconfig.json',
compilerOptions: {
module: 'commonjs'
},
reports: {} // Do not produce coverage html.
},
reporters: ['progress', 'karma-typescript'],
browsers: ['Chrome', 'Firefox'],
browserStack: {
username: process.env.BROWSERSTACK_USERNAME,
accessKey: process.env.BROWSERSTACK_KEY
},
reportSlowerThan: 500,
browserNoActivityTimeout: 30000,
customLaunchers: {
bs_chrome_mac: {
base: 'BrowserStack',
browser: 'chrome',
browser_version: 'latest',
os: 'OS X',
os_version: 'Sierra'
},
bs_firefox_mac: {
base: 'BrowserStack',
browser: 'firefox',
browser_version: 'latest',
os: 'OS X',
os_version: 'Sierra'
},
chrome_with_swift_shader: {
base: 'Chrome',
flags: ['--blacklist-accelerated-compositing', '--blacklist-webgl']
}
},
client: {
args: ['--grep', config.grep || '']
}
});
};
15 changes: 14 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,28 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@types/jasmine": "~2.8.6",
"@types/node": "~9.6.1",
"browserify": "~16.1.1",
"jasmine-core": "~3.1.0",
"karma": "~2.0.0",
"karma-browserstack-launcher": "~1.3.0",
"karma-chrome-launcher": "~2.2.0",
"karma-firefox-launcher": "~1.1.0",
"karma-jasmine": "~1.1.1",
"karma-typescript": "~3.0.12",
"rimraf": "~2.6.2",
"tsify": "~3.0.4",
"tslint": "~5.9.1",
"typescript": "2.7.2",
"uglify-js": "~3.0.28"
},
"scripts": {
"build": "tsc",
"build-npm": "./scripts/build-npm.sh"
"build-npm": "./scripts/build-npm.sh",
"lint": "tslint -p . -t verbose",
"test": "karma start",
"test-travis": "karma start --browsers='bs_firefox_mac,bs_chrome_mac' --singleRun"
},
"dependencies": {
"@tensorflow/tfjs-core": "0.6.0",
Expand Down
41 changes: 41 additions & 0 deletions src/index_test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* @license
* Copyright 2018 Google LLC. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/

import * as tf from './index';

describe('Union package', () => {
it('has core ops', () => {
expect(tf.matMul).not.toBeNull();
expect(tf.tensor).not.toBeNull();
expect(tf.scalar).not.toBeNull();
expect(tf.square).not.toBeNull();
});

it('has layers', () => {
expect(tf.sequential).not.toBeNull();
expect(tf.model).not.toBeNull();
expect(tf.layers.dense).not.toBeNull();
});

it('version', () => {
// tslint:disable-next-line:no-require-imports
const expected = require('../package.json').version;
expect(tf.version.tfjs).toBe(expected);
expect(tf.version["tfjs-core"]).not.toBeNull();
expect(tf.version["tfjs-layers"]).not.toBeNull();
});
});
60 changes: 60 additions & 0 deletions tslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"rules": {
"array-type": [true, "array-simple"],
"arrow-return-shorthand": true,
"ban": [true,
["fit"],
["fdescribe"],
["xit"],
["xdescribe"],
["fitAsync"],
["xitAsync"],
["fitFakeAsync"],
["xitFakeAsync"]
],
"ban-types": [true,
["Object", "Use {} instead."],
["String", "Use 'string' instead."],
["Number", "Use 'number' instead."],
["Boolean", "Use 'boolean' instead."]
],
"class-name": true,
"curly": true,
"interface-name": [true, "never-prefix"],
"jsdoc-format": true,
"forin": false,
"label-position": true,
"max-line-length": [true, 80],
"new-parens": true,
"no-angle-bracket-type-assertion": true,
"no-any": true,
"no-construct": true,
"no-consecutive-blank-lines": true,
"no-debugger": true,
"no-default-export": true,
"no-inferrable-types": true,
"no-namespace": [true, "allow-declarations"],
"no-reference": true,
"no-require-imports": true,
"no-string-throw": true,
"no-unused-expression": true,
"no-unused-variable": true,
"no-var-keyword": true,
"object-literal-shorthand": true,
"only-arrow-functions": [true, "allow-declarations", "allow-named-functions"],
"prefer-const": true,
"radix": true,
"restrict-plus-operands": true,
"semicolon": [true, "always", "ignore-bound-class-methods"],
"switch-default": true,
"triple-equals": [true, "allow-null-check"],
"use-isnan": true,
"variable-name": [
true,
"check-format",
"ban-keywords",
"allow-leading-underscore",
"allow-trailing-underscore"
]
}
}
Loading

1 comment on commit 4030a12

@mikanga10
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

restoration of daudi karanja indigenous land to promote agriculture and biotechnology product in kenya

Please sign in to comment.