Add travis file to catch version mismatches sooner

This commit is contained in:
Peter Squicciarini 2019-07-09 14:30:19 -07:00
parent f8003371e8
commit f04a4d2497
No known key found for this signature in database
GPG Key ID: F32B1833EB870AD6
3 changed files with 22 additions and 2 deletions

3
.travis.yml Normal file
View File

@ -0,0 +1,3 @@
language: node_js
node_js:
- "node"

View File

@ -70,7 +70,7 @@ function compareSums (sums, json) {
}
async function validateAssets () {
async function validateAssets (throwErrors = false) {
const results = {}
for (let type in TYPES) {
console.log('Checking', type, '...')
@ -81,11 +81,13 @@ async function validateAssets () {
console.log('Downloaded asset. Computing sums ...')
const sums = await getSums(file)
const valid = compareSums(sums, json)
if (!valid && throwErrors) throw new Error(`Invalid hashes for ${type} ${json.productVersion}`)
results[type] = valid
? `Hashes match (${json.productVersion})`
: `Invalid hashes (${json.productVersion})`
console.log(results[type])
} catch (e) {
if (throwErrors) throw e
console.log('Encountered an error, skipping ...')
results[type] = `Error: ${e.message}`
}
@ -94,4 +96,4 @@ async function validateAssets () {
console.log(JSON.stringify(results, null, 4))
}
validateAssets()
validateAssets(process.argv[2] === 'test')

15
package.json Normal file
View File

@ -0,0 +1,15 @@
{
"name": "vscodium-versions",
"version": "0.0.1",
"scripts": {
"test": "node integrity.js test"
},
"repository": {
"type": "git",
"url": "https://github.com/vscodium/versions"
},
"author": {
"name": "Peter Squicciarini",
"email": "stripedpajamas273@gmail.com"
}
}