Skip to content

Commit

Permalink
add support for v8-canary builds
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Jun 12, 2017
1 parent 4496054 commit aa80771
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 10 deletions.
4 changes: 2 additions & 2 deletions list-builds.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions nightly-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -40,7 +40,7 @@ if (!/^(nightly|next-nightly)$/.test(argv.type)
) {

console.error('Invalid arguments or config')
console.error('Usage: nodejs-nightly-builder [--type <nightly|next-nightly>] --ref <git head ref> --config <config file> [--force]')
console.error('Usage: nodejs-nightly-builder [--type <nightly|v8-canary>] --ref <git head ref> --config <config file> [--force]')
return process.exit(1)
}

Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
55 changes: 54 additions & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,37 @@ 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??
}
}

listBuilds('nightly', { releaseUrlBase: 'https://nodejs.org/download/' }, verify())
})


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
Expand Down Expand Up @@ -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())
})
})

0 comments on commit aa80771

Please sign in to comment.