build: make empty commit in next version branch first, close #1070 (#1071)

* build: make empty commit in next version branch first, close #1070

* build: add branch name = version to commit message
This commit is contained in:
Gleb Bahmutov
2017-12-14 14:49:15 -05:00
committed by GitHub
parent 26873b60f2
commit e3e1a5fe15
4 changed files with 45 additions and 33 deletions
+27 -23
View File
@@ -36,14 +36,6 @@ _PROVIDERS = {
circle: {
main: "cypress-io/cypress"
others: [
# "cypress-io/cypress-dashboard"
# "cypress-io/cypress-core-example"
# "cypress-io/cypress-core-desktop-gui"
# "cypress-io/cypress-example-kitchensink"
# "cypress-io/cypress-example-todomvc"
# "cypress-io/cypress-example-piechopper"
# "cypress-io/cypress-example-recipes"
"cypress-io/cypress-test-tiny"
"cypress-io/cypress-test-module-api"
"cypress-io/cypress-test-node-versions"
@@ -52,16 +44,6 @@ _PROVIDERS = {
"cypress-io/cypress-test-example-repos"
]
}
# travis: [
# # "cypress-io/cypress-dashboard"
# "cypress-io/cypress-core-example"
# "cypress-io/cypress-core-desktop-gui"
# "cypress-io/cypress-example-kitchensink"
# "cypress-io/cypress-example-todomvc"
# "cypress-io/cypress-example-piechopper"
# "cypress-io/cypress-example-recipes"
# ]
}
remapProjects = (projectsByProvider) ->
@@ -196,13 +178,16 @@ module.exports = {
awaitEachProjectAndProvider(PROJECTS, updateProject, projectFilter)
.then R.always(result)
run: (message, providerName) ->
# triggers test projects on multiple CIs
# the test projects will exercise the new version of
# the Cypress test runner we just built
runTestProjects: (message, providerName, version) ->
projectFilter = getFilterByProvider(providerName)
if not message
message =
"""
Testing new Cypress version
Testing new Cypress version #{version}
"""
if process.env.CIRCLE_BUILD_URL
@@ -221,12 +206,31 @@ module.exports = {
# make empty commit to trigger CIs
parsedRepo = parse(project)
console.log("running project", project)
makeEmptyGithubCommit({
console.log("making commit to project", project)
defaultOptions = {
owner: parsedRepo[0],
repo: parsedRepo[1],
token: creds.githubToken,
message
})
}
if not version
return makeEmptyGithubCommit(defaultOptions)
# first try to commit to branch for next upcoming version
specificBranchOptions = {
owner: parsedRepo[0],
repo: parsedRepo[1],
token: creds.githubToken,
message,
branch: version
}
makeEmptyGithubCommit(specificBranchOptions)
.catch () ->
# maybe there is no branch for next version
# try default branch
makeEmptyGithubCommit(defaultOptions)
awaitEachProjectAndProvider(PROJECTS, makeCommit, projectFilter)
}
+1 -1
View File
@@ -100,7 +100,7 @@ deploy = {
.then (task) ->
switch task
when "run"
bump.run()
bump.runTestProjects()
when "version"
ask.whichVersion(meta.distDir(""))
.then (v) ->
+15 -7
View File
@@ -28,11 +28,11 @@ const cliOptions = minimist(process.argv, {
},
})
const shorten = (s) =>
s.substr(0, 7)
const shorten = (s) => s.substr(0, 7)
const getShortCommit = () => {
const sha = process.env.APPVEYOR_REPO_COMMIT ||
const sha =
process.env.APPVEYOR_REPO_COMMIT ||
process.env.CIRCLE_SHA1 ||
process.env.BUILDKITE_COMMIT
if (sha) {
@@ -76,7 +76,12 @@ if (shortSha) {
const env = {
CYPRESS_BINARY_VERSION: binary,
}
const commitMessageInstructions = getInstallJson(npm, env, platform)
const commitMessageInstructions = getInstallJson(
npm,
env,
platform,
shortNpmVersion
)
const jsonBlock = toMarkdownJsonBlock(commitMessageInstructions)
const footer = 'Use tool `commit-message-install` to install from above block'
let message = `${subject}\n\n${jsonBlock}\n${footer}\n`
@@ -98,9 +103,12 @@ if (process.env.APPVEYOR) {
console.log('commit message')
console.log(message)
bump.run(message, cliOptions.provider)
.catch((e) => {
const onError = (e) => {
console.error('could not bump test projects')
console.error(e)
process.exit(1)
})
}
bump
.runTestProjects(message, cliOptions.provider, shortNpmVersion)
.catch(onError)