diff --git a/circle.yml b/circle.yml index f445d09500..2a115cfa0f 100644 --- a/circle.yml +++ b/circle.yml @@ -29,6 +29,7 @@ mainBuildFilters: &mainBuildFilters only: - develop - 10.0-release + - test-binary-downstream-windows # usually we don't build Mac app - it takes a long time # but sometimes we want to really confirm we are doing the right thing @@ -37,7 +38,6 @@ macWorkflowFilters: &mac-workflow-filters when: or: - equal: [ develop, << pipeline.git.branch >> ] - - equal: [ tgriesser/fix/patch-resolutions, << pipeline.git.branch >> ] - equal: [ renovate/cypress-request-2.x, << pipeline.git.branch >> ] - matches: pattern: "-release$" @@ -48,7 +48,7 @@ windowsWorkflowFilters: &windows-workflow-filters or: - equal: [ master, << pipeline.git.branch >> ] - equal: [ develop, << pipeline.git.branch >> ] - - equal: [ tgriesser/fix/patch-resolutions, << pipeline.git.branch >> ] + - equal: [ test-binary-downstream-windows, << pipeline.git.branch >> ] - matches: pattern: "-release$" value: << pipeline.git.branch >> @@ -1588,7 +1588,7 @@ jobs: - run: name: Check current branch to persist artifacts command: | - if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "tgriesser/fix/patch-resolutions" ]]; then + if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "test-binary-downstream-windows" ]]; then echo "Not uploading artifacts or posting install comment for this branch." circleci-agent step halt fi @@ -1664,7 +1664,12 @@ jobs: test-binary-and-npm-against-other-projects: <<: *defaults - resource_class: medium + parameters: + <<: *defaultsParameters + resource_class: + type: string + default: medium + resource_class: << parameters.resource_class >> steps: # needs uploaded NPM and test binary - restore_cached_workspace @@ -1673,23 +1678,14 @@ jobs: - run: ls -la binary-url.json npm-package-url.json - run: cat binary-url.json - run: cat npm-package-url.json - - run: mkdir /tmp/testing - - run: - name: create dummy package - working_directory: /tmp/testing - command: npm init -y - run: # install NPM from unique urls - name: Install Cypress + name: Install Cypress Binary in Dummy Package command: | node scripts/test-unique-npm-and-binary.js \ --npm npm-package-url.json \ --binary binary-url.json \ --cwd /tmp/testing - - run: - name: Verify Cypress binary - working_directory: /tmp/testing - command: $(yarn bin)/cypress verify - run: name: Running other test projects with new NPM package and binary command: | @@ -1720,19 +1716,19 @@ jobs: - run: name: Cypress version working_directory: test-binary - command: $(yarn bin)/cypress version + command: $(yarn bin cypress) version - run: name: Verify Cypress binary working_directory: test-binary - command: $(yarn bin)/cypress verify + command: $(yarn bin cypress) verify - run: name: Cypress help working_directory: test-binary - command: $(yarn bin)/cypress help + command: $(yarn bin cypress) help - run: name: Cypress info working_directory: test-binary - command: $(yarn bin)/cypress info + command: $(yarn bin cypress) info - store-npm-logs test-npm-module-on-minimum-node-version: @@ -1891,7 +1887,7 @@ jobs: CYPRESS_PROJECT_ID=$TEST_TINY_PROJECT_ID \ CYPRESS_RECORD_KEY=$TEST_TINY_RECORD_KEY \ CYPRESS_INTERNAL_ENV=staging \ - $(yarn bin)/cypress run --record + $(yarn bin cypress) run --record - store-npm-logs test-binary-against-recipes-firefox: @@ -2026,11 +2022,11 @@ jobs: - run: name: Cypress help working_directory: test-binary - command: $(yarn bin)/cypress help + command: $(yarn bin cypress) help - run: name: Cypress info working_directory: test-binary - command: $(yarn bin)/cypress info + command: $(yarn bin cypress) info - run: name: Add Cypress demo working_directory: test-binary @@ -2038,11 +2034,11 @@ jobs: - run: name: Verify Cypress binary working_directory: test-binary - command: DEBUG=cypress:cli $(yarn bin)/cypress verify + command: DEBUG=cypress:cli $(yarn bin cypress) verify - run: name: Run Cypress binary working_directory: test-binary - command: DEBUG=cypress:cli $(yarn bin)/cypress run + command: DEBUG=cypress:cli $(yarn bin cypress) run - store-npm-logs linux-workflow: &linux-workflow @@ -2432,6 +2428,14 @@ windows-workflow: &windows-workflow requires: - windows-build + - test-binary-and-npm-against-other-projects: + context: test-runner:trigger-test-jobs + name: windows-test-binary-and-npm-against-other-projects + executor: windows + resource_class: windows.medium + requires: + - windows-create-build-artifacts + workflows: linux: <<: *linux-workflow diff --git a/scripts/test-unique-npm-and-binary.js b/scripts/test-unique-npm-and-binary.js index 85bba4587c..a0cec1ab2e 100644 --- a/scripts/test-unique-npm-and-binary.js +++ b/scripts/test-unique-npm-and-binary.js @@ -1,32 +1,49 @@ +/* eslint-disable no-console */ const minimist = require('minimist') -const options = minimist(process.argv) +const os = require('os') const la = require('lazy-ass') +const fs = require('fs-extra') const is = require('check-more-types') const execa = require('execa') const { getNameAndBinary } = require('./utils') -/* eslint-disable no-console */ +const options = minimist(process.argv) +const cwd = options.cwd || '/tmp/testing' + +fs.ensureDirSync(cwd) + +const spawnOpts = { + cwd, + shell: os.platform() === 'win32' ? 'bash.exe' : '/bin/bash', + stdio: 'inherit', +} const { npm, binary } = getNameAndBinary(process.argv) la(is.unemptyString(npm), 'missing npm url') la(is.unemptyString(binary), 'missing binary url') -console.log('testing NPM from', npm) -console.log('and binary from', binary) -const cwd = options.cwd || process.cwd() - -console.log('in', cwd) - -execa(`npm install ${npm}`, { - cwd, - shell: true, - stdio: 'inherit', - env: { - CYPRESS_INSTALL_BINARY: binary, - }, -}) +console.log('Create Dummy Project') +execa('npm init -y', spawnOpts) .then(console.log) +.then(() => { + console.log('testing NPM from', npm) + console.log('and binary from', binary) + console.log('in', cwd) + + return execa(`npm install ${npm}`, { + ...spawnOpts, + env: { + CYPRESS_INSTALL_BINARY: binary, + }, + }).then(console.log) +}) +.then(() => { + console.log('Verify Cypress binary') + + return execa('$(yarn bin cypress) verify', spawnOpts) + .then(console.log) +}) .catch((e) => { console.error(e) process.exit(1)