Skip to content
This repository was archived by the owner on Sep 17, 2022. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,16 @@
"**/bundle.js": true,
"**/yarn.lock": true
},
"tslint.enable": true,
"tslint.run": "onType",
"tslint.configFile": "tslint.json",
"files.trimTrailingWhitespace": true,
"editor.tabSize": 2,
"editor.insertSpaces": true,
"[typescript]": {
"editor.formatOnSave": true
},
"[javascript]": {
"editor.formatOnSave": true
},
"clang-format.style": "Google",
"editor.rulers": [80],
"C_Cpp.clang_format_fallbackStyle": "Google",
Expand All @@ -77,6 +78,4 @@
"typescript.tsdk": "node_modules/typescript/lib",
"clang-format.executable": "${workspaceRoot}/node_modules/.bin/clang-format",
"C_Cpp.intelliSenseEngineFallback": "Enabled",
"python.linting.enabled": false,
"editor.formatOnSave": true
}
14 changes: 14 additions & 0 deletions cloudbuild.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
steps:
# Install dev deps.
- name: 'node:10'
entrypoint: 'yarn'
id: 'yarn'
args: ['install']

# Run unit tests.
- name: 'node:10'
entrypoint: 'yarn'
id: 'test'
args: ['test-ci']
waitFor: ['yarn']

# Run integration tests.
- name: 'node:10'
entrypoint: 'yarn'
id: 'test-ts-integration'
args: ['test-ts-integration']
waitFor: ['yarn', 'test']

# Run travis
- name: 'node:10'
entrypoint: 'yarn'
id: 'test-travis'
args: ['test-travis']
env: ['BRANCH_NAME=$BRANCH_NAME', 'COMMIT_SHA=$COMMIT_SHA']
waitFor: ['yarn']

timeout: 1800s
logsBucket: 'gs://tfjs-build-logs'
options:
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"test": "ts-node src/run_tests.ts",
"test-ci": "./scripts/test-ci.sh",
"test-ts-integration": "./scripts/test-ts-integration.sh",
"test-travis": "./scripts/test-travis.js",
"upload-windows-addon": "./scripts/build-and-upload-windows-addon.bat",
"upload-windows-addon-gpu": "./scripts/build-and-upload-windows-addon-gpu.bat"
},
Expand All @@ -40,7 +41,7 @@
"@types/rimraf": "~2.0.2",
"clang-format": "~1.2.2",
"jasmine": "~3.1.0",
"node-fetch": "^2.3.0",
"node-fetch": "^2.6.0",
"nyc": "^13.3.0",
"tmp": "^0.0.33",
"ts-node": "^5.0.1",
Expand All @@ -67,4 +68,4 @@
4
]
}
}
}
74 changes: 74 additions & 0 deletions scripts/test-travis.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/usr/bin/env node
/**
* @license
* Copyright 2019 Google Inc. 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.
* =============================================================================
*/

const fetch = require('node-fetch');

const API_URL = 'https://api.travis-ci.org/repo/tensorflow%2Ftfjs-node';
const SUBMIT_BUILD_URL = `${API_URL}/requests`;
const GET_BUILD_INFO_URL = `${API_URL}/request`;
const HEADERS = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Travis-API-Version': '3',
'Authorization': 'token INKvoqirQIBD805HgU3Gew'
};

console.log('commit sha', process.env.COMMIT_SHA);

async function submitBuild() {
const body = {
request: {
branch: process.env.COMMIT_SHA,
}
};
console.log('sending body', body);
const response = await fetch(SUBMIT_BUILD_URL, {
method: 'post',
body: JSON.stringify(body),
headers: HEADERS,
});
return response.json();
}

async function getBuildInfo(requestId) {
console.log('Getting request info for', requestId);
const response = await fetch(`${GET_BUILD_INFO_URL}/${requestId}`, {
method: 'get',
headers: HEADERS,
});
return response.json();
}

async function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}

async function run() {
const requestInfo = await submitBuild();
console.log(requestInfo);
console.log('=======================================');
await sleep(30000);
const buildInfo = await getBuildInfo(requestInfo.request.id);
console.log(buildInfo);
const buildId = buildInfo.builds[0].id;
const slug = buildInfo.repository.slug;
const buildUrl = `https://travis-ci.org/${slug}/builds/${buildId}`;
console.log(`See build at: ${buildUrl}`);
}

run();
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ nice-try@^1.0.4:
resolved "https://registry.yarnpkg.com/nice-try/-/nice-try-1.0.5.tgz#a3378a7696ce7d223e88fc9b764bd7ef1089e366"
integrity sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==

node-fetch@^2.3.0:
node-fetch@^2.6.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd"
integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==
Expand Down