Skip to content

Commit

Permalink
chore: trigger downstream project tests for windows workflow (#19381)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilyrohrbough committed Dec 17, 2021
1 parent 8e23567 commit aea8b2b
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 37 deletions.
50 changes: 27 additions & 23 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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$"
Expand All @@ -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 >>
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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: |
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -2026,23 +2022,23 @@ 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
command: npx @bahmutov/cly init
- 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
Expand Down Expand Up @@ -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
Expand Down
45 changes: 31 additions & 14 deletions scripts/test-unique-npm-and-binary.js
Original file line number Diff line number Diff line change
@@ -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('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)

console.log('in', cwd)
return execa(`npm install ${npm}`, {
...spawnOpts,
env: {
CYPRESS_INSTALL_BINARY: binary,
},
}).then(console.log)
})
.then(() => {
console.log('Verify Cypress binary')

execa(`npm install ${npm}`, {
cwd,
shell: true,
stdio: 'inherit',
env: {
CYPRESS_INSTALL_BINARY: binary,
},
return execa('$(yarn bin cypress) verify', spawnOpts)
.then(console.log)
})
.then(console.log)
.catch((e) => {
console.error(e)
process.exit(1)
Expand Down

3 comments on commit aea8b2b

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on aea8b2b Dec 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.1.2/circle-develop-aea8b2b788979cd2ad7ffedf0ebb33c1984b52b5/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on aea8b2b Dec 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.1.2/circle-develop-aea8b2b788979cd2ad7ffedf0ebb33c1984b52b5/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on aea8b2b Dec 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.1.2/circle-develop-aea8b2b788979cd2ad7ffedf0ebb33c1984b52b5/cypress.tgz

Please sign in to comment.