diff --git a/list-builds.js b/list-builds.js index 7e65406..db9d779 100644 --- a/list-builds.js +++ b/list-builds.js @@ -18,7 +18,7 @@ function listBuilds (type, config, callback) { return callback(new Error(`no builds for "${type}"`)) data = data.map(function (d) { - let m = d.version.match(/nightly(20\d\d)(\d\d)(\d\d)([0-9a-f]{7,})/) + let m = d.version.match(/(?:nightly|v8-canary)(20\d\d)(\d\d)(\d\d)([0-9a-f]{7,})/) , date = new Date(m && `${m[1]}-${m[2]}-${m[3]}` || d.date) , commit = m && m[4] @@ -41,7 +41,7 @@ function listBuilds (type, config, callback) { module.exports = listBuilds if (require.main == module) { - listBuilds('nightly', function (err, data) { + listBuilds(process.argv[2] || 'nightly', function (err, data) { if (err) throw err diff --git a/nightly-builder.js b/nightly-builder.js index 84a1e75..503ecfa 100755 --- a/nightly-builder.js +++ b/nightly-builder.js @@ -26,7 +26,7 @@ if (typeof argv.type != 'string') let config = argv.config && require(argv.config) config = xtend(defaultConfig, config) -if (!/^(nightly|next-nightly)$/.test(argv.type) +if (!/^(nightly|v8-canary)$/.test(argv.type) || typeof argv.ref != 'string' || typeof config.jenkinsToken != 'string' || typeof config.jenkinsJobUrl != 'string' @@ -40,7 +40,7 @@ if (!/^(nightly|next-nightly)$/.test(argv.type) ) { console.error('Invalid arguments or config') - console.error('Usage: nodejs-nightly-builder [--type ] --ref --config [--force]') + console.error('Usage: nodejs-nightly-builder [--type ] --ref --config [--force]') return process.exit(1) } diff --git a/package.json b/package.json index 1f35679..3bef8e8 100644 --- a/package.json +++ b/package.json @@ -14,18 +14,19 @@ }, "dependencies": { "after": "~0.8.2", - "bl": "~1.1.2", + "bl": "~1.2.1", "ghrepos": "~2.0.0", - "hyperquest": "~2.1.0", - "jsonist": "~1.3.0", + "hyperquest": "~2.1.2", + "jsonist": "~2.1.0", + "level": "~1.7.0", "minimist": "~1.2.0", - "strftime": "~0.9.2", + "strftime": "~0.10.0", "xtend": "~4.0.1" }, "devDependencies": { "application-config": "~1.0.1", "ghauth": "~3.2.1", - "tape": "~4.6.2" + "tape": "~4.6.3" }, "bin": { "nodejs-nightly-builder": "./nightly-builder.js" diff --git a/test.js b/test.js index 6c15e1a..23378f0 100644 --- a/test.js +++ b/test.js @@ -35,7 +35,7 @@ test('list-builds', function (t) { t.ok(data[0].date < new Date(), `date (${data[0].date.toISOString()}) looks correct`) t.ok(data[0].commit && data[0].commit.length >= 10, `commit (${data[0].commit}) looks right`) t.notEqual(data[0].commit, other, 'commit not the same as other type of commit') - other = data[0].commit // who's gonna be first?? + other = data[0].commit // who's gonna be first?? } } @@ -43,6 +43,29 @@ test('list-builds', function (t) { }) +test('list-builds v8-canary', function (t) { + t.plan(7) + let other = null + + + function verify () { + return function (err, data) { + t.error(err, 'no error') + t.ok(Array.isArray(data), 'is array') + t.ok(data.length >= 1, 'has data') + let m = data[0].version && data[0].version.match(/v\d+\.\d+\.\d+-v8-canary20\d{6}\w{10,}/) + t.ok(m, `version (${data[0].version}) looks correct`) + t.ok(data[0].date < new Date(), `date (${data[0].date.toISOString()}) looks correct`) + t.ok(data[0].commit && data[0].commit.length >= 10, `commit (${data[0].commit}) looks right`) + t.notEqual(data[0].commit, other, 'commit not the same as other type of commit') + other = data[0].commit // who's gonna be first?? + } + } + + listBuilds('v8-canary', { releaseUrlBase: 'https://nodejs.org/download/' }, verify()) +}) + + test('latest-commit', function (t) { t.plan(4) let other = null @@ -71,3 +94,33 @@ test('latest-commit', function (t) { }, verify()) }) }) + + +test('latest-commit v8-canary', function (t) { + t.plan(4) + let other = null + + appCfg(authOptions.configName).read(function (err, config) { + if (err) { + console.error('You need GitHub authentication credentials saved first, run `node test.js auth` to set this up') + return process.exit(1) + } + + function verify () { + return function (err, sha) { + t.error(err, 'no error') + t.equal(typeof sha, 'string', 'got sha') + t.equal(sha.length, 40, `sha looks good (${sha})`) + t.notEqual(sha, other, 'sha not the same as other type of sha') + other = sha // who's gonna be first?? + } + } + + latestCommit('v8-canary', 'heads/canary', { + githubOrg : 'nodejs' + , githubRepo : 'node-v8' + , githubAuthUser : config.user + , githubAuthToken : config.token + }, verify()) + }) +})