diff --git a/appveyor.yml b/appveyor.yml index b912ef91ab..f70540dd72 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -81,6 +81,8 @@ test_script: # - cd packages/server && npm run test-unit # - npm test + - echo Running other test projects with new NPM package and binary + - node scripts/test-other-projects.js --npm npm-package-url.json --binary /binary-url.json --provider appveyor # Don't actually build. build: off diff --git a/circle.yml b/circle.yml index 58c538b585..f7c8bdfa93 100644 --- a/circle.yml +++ b/circle.yml @@ -480,7 +480,8 @@ jobs: command: | node scripts/test-other-projects.js \ --npm /tmp/urls/npm-package-url.json \ - --binary /tmp/urls/binary-url.json + --binary /tmp/urls/binary-url.json \ + --provider circle "test-next-version-locally": <<: *defaults diff --git a/package.json b/package.json index d5d23df4f5..55ad0c2e71 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ ] }, "devDependencies": { - "@cypress/bumpercar": "^1.1.1", + "@cypress/bumpercar": "^1.1.2", "@cypress/env-or-json-file": "^1.2.0", "@cypress/npm-run-all": "^4.0.4", "@cypress/questions-remain": "^1.0.1", diff --git a/scripts/binary/bump.coffee b/scripts/binary/bump.coffee index 1216d47abb..7cfcf2983b 100644 --- a/scripts/binary/bump.coffee +++ b/scripts/binary/bump.coffee @@ -86,7 +86,7 @@ getCiConfig = -> throw new Error('CI config not found') config -awaitEachProjectAndProvider = (fn) -> +awaitEachProjectAndProvider = (fn, filter = R.identity) -> creds = getCiConfig() # TODO only check tokens for providers we really going to use la(check.unemptyString(creds.githubToken), "missing githubToken") @@ -108,13 +108,24 @@ awaitEachProjectAndProvider = (fn) -> } }) - Promise.mapSeries PROJECTS, (project) -> + filteredProjects = R.filter(filter, PROJECTS) + console.table("filtered projects", filteredProjects) + Promise.mapSeries filteredProjects, (project) -> fn(project.repo, project.provider, creds) +# do not trigger all projects if there is specific provider +# for example appVeyor should be used for Windows testing +getFilterByProvider = (providerName) -> + if providerName + projectFilter = R.propEq("provider", providerName) + else + projectFilter = R.identity + projectFilter + module.exports = { # in each project, set a couple of environment variables - version: (nameOrUrl, binaryVersionOrUrl, platform) -> - console.table(PROJECTS) + version: (nameOrUrl, binaryVersionOrUrl, platform, providerName) -> + console.table("All possible projects", PROJECTS) la(check.unemptyString(nameOrUrl), "missing cypress name or url to set", nameOrUrl) @@ -132,16 +143,20 @@ module.exports = { binary: binaryVersionOrUrl } + projectFilter = getFilterByProvider(providerName) + updateProject = (project, provider) -> console.log("setting environment variables in", project) car.updateProjectEnv(project, provider, { CYPRESS_NPM_PACKAGE_NAME: nameOrUrl, CYPRESS_BINARY_VERSION: binaryVersionOrUrl }) - awaitEachProjectAndProvider(updateProject) + awaitEachProjectAndProvider(updateProject, projectFilter) .then R.always(result) - run: (message) -> + run: (message, providerName) -> + projectFilter = getFilterByProvider(providerName) + if not message message = """ @@ -149,7 +164,7 @@ module.exports = { CI build url #{process.env.CIRCLE_BUILD_URL} """ - awaitEachProjectAndProvider (project, provider, creds) -> + makeCommit = (project, provider, creds) -> # instead of triggering CI via API # car.runProject(project, provider) # make empty commit to trigger CIs @@ -162,4 +177,5 @@ module.exports = { token: creds.githubToken, message }) + awaitEachProjectAndProvider(makeCommit, projectFilter) } diff --git a/scripts/test-other-projects.js b/scripts/test-other-projects.js index e9aad61597..e695132ffe 100644 --- a/scripts/test-other-projects.js +++ b/scripts/test-other-projects.js @@ -6,6 +6,7 @@ const { getNameAndBinary, getJustVersion } = require('./utils') const bump = require('./binary/bump') const { stripIndent } = require('common-tags') const os = require('os') +const minimist = require('minimist') /* eslint-disable no-console */ @@ -19,7 +20,14 @@ console.log('npm:', npm) console.log('binary:', binary) console.log('platform:', platform) -bump.version(npm, binary, platform) +const cliOptions = minimist(process.argv, { + string: 'provider', + alias: { + provider: 'p', + }, +}) + +bump.version(npm, binary, platform, cliOptions.provider) .then((result) => { console.log('bumped all test projects with new env variables') console.log(result) @@ -44,7 +52,7 @@ bump.version(npm, binary, platform) } console.log('commit message') console.log(message) - return bump.run(message) + return bump.run(message, cliOptions.provider) }) .catch((e) => { console.error('could not bump test projects')