create status check after building binary (#3967)

* create status check after building binary

* rework status

* put platform first in the status check

* remove building this branch

* modify the status check context, misc cleanup


Co-authored-by: Brian Mann <brian.mann86@gmail.com>
This commit is contained in:
Gleb Bahmutov
2019-04-17 20:51:19 -04:00
committed by Brian Mann
parent 28f24b5997
commit 4bcc094623
3 changed files with 43 additions and 10 deletions
+2 -1
View File
@@ -64,9 +64,11 @@
},
"devDependencies": {
"@cypress/bumpercar": "2.0.6",
"@cypress/commit-message-install": "2.3.0",
"@cypress/env-or-json-file": "2.0.0",
"@cypress/npm-run-all": "4.0.5",
"@cypress/questions-remain": "1.0.1",
"@cypress/set-commit-status": "1.1.0",
"@types/bluebird": "3.5.21",
"@types/chai": "3.5.2",
"@types/debug": "0.0.31",
@@ -90,7 +92,6 @@
"check-more-types": "2.24.0",
"cloudflare-cli": "3.2.1",
"coffeelint": "1.16.2",
"@cypress/commit-message-install": "2.3.0",
"common-tags": "1.8.0",
"console.table": "0.10.0",
"debug": "3.1.0",
+40 -8
View File
@@ -7,9 +7,11 @@ path = require("path")
la = require('lazy-ass')
check = require('check-more-types')
R = require("ramda")
os = require("os")
{configFromEnvOrJsonFile, filenameToShellVariable} = require('@cypress/env-or-json-file')
makeEmptyGithubCommit = require("make-empty-github-commit")
parse = require("parse-github-repo-url")
{setCommitStatus} = require("@cypress/set-commit-status")
fs = Promise.promisifyAll(fs)
@@ -173,7 +175,9 @@ module.exports = {
# 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) ->
runTestProjects: (status, message, providerName, version) ->
# status is {owner, repo, sha}
projectFilter = getFilterByProvider(providerName)
if not message
@@ -197,32 +201,60 @@ module.exports = {
# car.runProject(project, provider)
# make empty commit to trigger CIs
parsedRepo = parse(project)
# project is owner/repo string like cypress-io/cypress-test-tiny
console.log("making commit to project", project)
parsedRepo = parse(project)
owner = parsedRepo[0]
repo = parsedRepo[1]
defaultOptions = {
owner: parsedRepo[0],
repo: parsedRepo[1],
owner,
repo,
message,
token: creds.githubToken,
message
}
createGithubCommitStatusCheck = ({ sha }) ->
return if not status
targetUrl = "https://github.com/#{owner}/#{repo}/commit/#{sha}"
commitStatusOptions = {
targetUrl,
owner: status.owner,
repo: status.repo,
sha: status.sha,
state: 'pending',
description: "#{owner}/#{repo}",
context: "[#{os.platform()}-#{os.arch()}] #{repo}"
}
console.log(
'creating commit status check',
commitStatusOptions.description,
commitStatusOptions.context
)
setCommitStatus(commitStatusOptions)
if not version
return makeEmptyGithubCommit(defaultOptions)
return makeEmptyGithubCommit(defaultOptions).then(createGithubCommitStatusCheck)
# first try to commit to branch for next upcoming version
specificBranchOptions = {
owner: parsedRepo[0],
repo: parsedRepo[1],
owner: owner,
repo: repo,
token: creds.githubToken,
message,
branch: version
}
makeEmptyGithubCommit(specificBranchOptions)
.catch () ->
# maybe there is no branch for next version
# try default branch
makeEmptyGithubCommit(defaultOptions)
.then(createGithubCommitStatusCheck)
awaitEachProjectAndProvider(PROJECTS, makeCommit, projectFilter)
}
+1 -1
View File
@@ -145,5 +145,5 @@ const onError = (e) => {
}
bump
.runTestProjects(message, cliOptions.provider, shortNpmVersion)
.runTestProjects(status, message, cliOptions.provider, shortNpmVersion)
.catch(onError)