test Mac build against other repos (#4527)

* test Mac build against other repos

* trigger projects again to confirm all work

* when triggering projects filter by platform too

* linting
This commit is contained in:
Gleb Bahmutov
2019-06-21 12:16:04 -04:00
committed by Brian Mann
parent c2861ba557
commit e5106d95f5
5 changed files with 166 additions and 14 deletions
+65
View File
@@ -0,0 +1,65 @@
exports['list of all projects'] = [
{
"repo": "cypress-io/cypress-test-tiny",
"provider": "appVeyor",
"platform": "win32"
},
{
"repo": "cypress-io/cypress-test-example-repos",
"provider": "appVeyor",
"platform": "win32"
},
{
"repo": "cypress-io/cypress-test-tiny",
"provider": "circle",
"platform": "linux"
},
{
"repo": "cypress-io/cypress-test-module-api",
"provider": "circle",
"platform": "linux"
},
{
"repo": "cypress-io/cypress-test-node-versions",
"provider": "circle",
"platform": "linux"
},
{
"repo": "cypress-io/cypress-test-nested-projects",
"provider": "circle",
"platform": "linux"
},
{
"repo": "cypress-io/cypress-test-ci-environments",
"provider": "circle",
"platform": "linux"
},
{
"repo": "cypress-io/cypress-test-example-repos",
"provider": "circle",
"platform": "linux"
},
{
"repo": "cypress-io/cypress-test-tiny",
"provider": "circle",
"platform": "darwin"
},
{
"repo": "cypress-io/cypress-test-example-repos",
"provider": "circle",
"platform": "darwin"
}
]
exports['should have just circle and darwin projects'] = [
{
"repo": "cypress-io/cypress-test-tiny",
"provider": "circle",
"platform": "darwin"
},
{
"repo": "cypress-io/cypress-test-example-repos",
"provider": "circle",
"platform": "darwin"
}
]
+15
View File
@@ -855,6 +855,7 @@ mac-workflow: &mac-workflow
branches:
only:
- develop
- test-example-repos-on-mac-4526
requires:
- Mac build
@@ -867,6 +868,7 @@ mac-workflow: &mac-workflow
only:
- develop
- binary-metadata
- test-example-repos-on-mac-4526
requires:
- Mac build
@@ -891,6 +893,19 @@ mac-workflow: &mac-workflow
requires:
- Mac NPM package
- Mac binary
- test-binary-and-npm-against-other-projects:
name: Test Mac binary against other projects
executor: mac
filters:
branches:
only:
- develop
- test-example-repos-on-mac-4526
requires:
- Mac NPM package
- Mac binary
workflows:
linux:
<<: *linux-workflow
+38 -13
View File
@@ -21,7 +21,7 @@ car = null
_PROVIDERS = {
appVeyor: {
main: "cypress-io/cypress"
others: [
win32: [
"cypress-io/cypress-test-tiny"
"cypress-io/cypress-test-example-repos"
]
@@ -29,7 +29,7 @@ _PROVIDERS = {
circle: {
main: "cypress-io/cypress"
others: [
linux: [
"cypress-io/cypress-test-tiny"
"cypress-io/cypress-test-module-api"
"cypress-io/cypress-test-node-versions"
@@ -37,6 +37,10 @@ _PROVIDERS = {
"cypress-io/cypress-test-ci-environments"
"cypress-io/cypress-test-example-repos"
]
darwin: [
"cypress-io/cypress-test-tiny"
"cypress-io/cypress-test-example-repos"
]
}
}
@@ -44,11 +48,17 @@ remapProjects = (projectsByProvider) ->
list = []
_.mapValues projectsByProvider, (provider, name) ->
provider.others.forEach (repo) ->
list.push({
repo
provider: name
})
remapPlatform = (platform, repos) ->
repos.forEach (repo) ->
list.push({
repo
provider: name
platform
})
if provider.win32 then remapPlatform("win32", provider.win32)
if provider.linux then remapPlatform("linux", provider.linux)
if provider.darwin then remapPlatform("darwin", provider.darwin)
list
@@ -64,7 +74,7 @@ remapMain = (projectsByProvider) ->
list
# make flat list of objects
# {repo, provider}
# {repo, provider, platform}
PROJECTS = remapProjects(_PROVIDERS)
getCiConfig = ->
@@ -115,15 +125,30 @@ awaitEachProjectAndProvider = (projects, fn, filter = R.identity) ->
# do not trigger all projects if there is specific provider
# for example appVeyor should be used for Windows testing
getFilterByProvider = (providerName) ->
getFilterByProvider = (providerName, platformName) ->
if providerName
console.log("only allow projects for provider", providerName)
projectFilter = R.propEq("provider", providerName)
providerFilter = R.propEq("provider", providerName)
else
projectFilter = R.identity
providerFilter = R.identity
if platformName
console.log("only allow projects for platform", platformName)
platformFilter = R.propEq("platform", platformName)
else
platformFilter = R.identity
# combined filter is when both filters pass
projectFilter = R.allPass([providerFilter, platformFilter])
projectFilter
module.exports = {
_PROVIDERS,
remapProjects,
getFilterByProvider,
nextVersion: (version) ->
MAIN_PROJECTS = remapMain(_PROVIDERS)
console.log("Setting next version to build", version)
@@ -175,9 +200,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: (getStatusAndMessage, providerName, version) ->
runTestProjects: (getStatusAndMessage, providerName, version, platform) ->
projectFilter = getFilterByProvider(providerName)
projectFilter = getFilterByProvider(providerName, platform)
makeCommit = (project, provider, creds) ->
## make empty commit to trigger CIs
+1 -1
View File
@@ -158,5 +158,5 @@ const onError = (e) => {
}
bump
.runTestProjects(getStatusAndMessage, cliOptions.provider, shortNpmVersion)
.runTestProjects(getStatusAndMessage, cliOptions.provider, shortNpmVersion, platform)
.catch(onError)
+47
View File
@@ -0,0 +1,47 @@
const la = require('lazy-ass')
const snapshot = require('snap-shot-it')
const R = require('ramda')
const bump = require('../../binary/bump')
/* eslint-env mocha */
describe('bump', () => {
context('remapProjects', () => {
it('returns flat list of projects', () => {
la(bump._PROVIDERS, 'has _PROVIDERS', bump)
const list = bump.remapProjects(bump._PROVIDERS)
snapshot('list of all projects', list)
})
})
context('getFilterByProvider', () => {
it('returns a filter function without provider name', () => {
const projects = bump.remapProjects(bump._PROVIDERS)
const filter = bump.getFilterByProvider()
// should return ALL projects
const filtered = R.filter(filter, projects)
la(
R.equals(filtered, projects),
'should have kept all projects',
filtered
)
})
it('returns a filter function for circle and darwin', () => {
const projects = bump.remapProjects(bump._PROVIDERS)
la(
projects.length,
'there should be at least a few projects in the list of projects',
projects
)
const filter = bump.getFilterByProvider('circle', 'darwin')
const filtered = R.filter(filter, projects)
la(filtered.length, 'there should be at least a few projects', filtered)
snapshot('should have just circle and darwin projects', filtered)
})
})
})