Skip to content

Commit

Permalink
fix: use unique install cache folders for betas (#20296)
Browse files Browse the repository at this point in the history
  • Loading branch information
flotwig committed Mar 4, 2022
1 parent 2e62bbb commit 3c28617
Show file tree
Hide file tree
Showing 28 changed files with 618 additions and 528 deletions.
8 changes: 8 additions & 0 deletions __snapshots__/prepare-release-artifacts-spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
exports['prepare-release-artifacts runs expected commands 1'] = `
$ node ./scripts/prepare-release-artifacts.js --dry-run --sha 57d0a85108fad6f77b39db88b8a7d8a3bfdb51a2 --version 1.2.3
🏗 Running \`move-binaries\`...
🏗 Dry run, not executing: node ./scripts/binary.js move-binaries --sha 57d0a85108fad6f77b39db88b8a7d8a3bfdb51a2 --version 1.2.3
🏗 Running \`create-stable-npm-package\`...
🏗 Dry run, not executing: ./scripts/create-stable-npm-package.sh https://cdn.cypress.io/beta/npm/1.2.3/linux-x64/develop-57d0a85108fad6f77b39db88b8a7d8a3bfdb51a2/cypress.tgz
`
Binary file removed assets/cypress-bot-pre-release-comment.png
Binary file not shown.
8 changes: 4 additions & 4 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ mainBuildFilters: &mainBuildFilters
only:
- develop
- 10.0-release
- fix-release-scripts
- fix-beta-build-caching

# 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 @@ -38,7 +38,7 @@ macWorkflowFilters: &mac-workflow-filters
when:
or:
- equal: [ develop, << pipeline.git.branch >> ]
- equal: [ faster-mac-builds, << pipeline.git.branch >> ]
- equal: [ fix-beta-build-caching, << pipeline.git.branch >> ]
- matches:
pattern: "-release$"
value: << pipeline.git.branch >>
Expand All @@ -48,7 +48,7 @@ windowsWorkflowFilters: &windows-workflow-filters
or:
- equal: [ master, << pipeline.git.branch >> ]
- equal: [ develop, << pipeline.git.branch >> ]
- equal: [ fix-next-version-in-test-repos, << pipeline.git.branch >> ]
- equal: [ fix-beta-build-caching, << pipeline.git.branch >> ]
- matches:
pattern: "-release$"
value: << pipeline.git.branch >>
Expand Down Expand Up @@ -1633,7 +1633,7 @@ jobs:
- run:
name: Check current branch to persist artifacts
command: |
if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "fix-release-scripts" ]]; then
if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "fix-beta-build-caching" ]]; then
echo "Not uploading artifacts or posting install comment for this branch."
circleci-agent step halt
fi
Expand Down
1 change: 1 addition & 0 deletions cli/__snapshots__/build_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ exports['package.json build outputs expected properties 1'] = {
"name": "test",
"engines": "test engines",
"version": "x.y.z",
"buildInfo": "replaced by normalizePackageJson",
"description": "Cypress.io end to end testing tool",
"homepage": "https://github.com/cypress-io/cypress",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion cli/__snapshots__/download_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ https://download.cypress.io/desktop/0.20.2?platform=OS&arch=ARCH

exports['desktop url from template'] = `
https://download.cypress.io/desktop/0.20.2/darwin-x64/cypress.zip
`
`
44 changes: 41 additions & 3 deletions cli/__snapshots__/info_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Application Data: /user/app/data/path
Browser Profiles: /user/app/data/path/to/browsers
Binary Caches: /user/path/to/binary/cache
Cypress Version: 0.0.0-development
Cypress Version: 0.0.0-development (stable)
System Platform: linux (Foo-OsVersion)
System Memory: 1.2 GB free 400 MB
Expand All @@ -29,7 +29,7 @@ Application Data: /user/app/data/path
Browser Profiles: /user/app/data/path/to/browsers
Binary Caches: /user/path/to/binary/cache
Cypress Version: 0.0.0-development
Cypress Version: 0.0.0-development (stable)
System Platform: linux (Foo-OsVersion)
System Memory: 1.2 GB free 400 MB
Expand All @@ -48,8 +48,46 @@ Application Data: /user/app/data/path
Browser Profiles: /user/app/data/path/to/browsers
Binary Caches: /user/path/to/binary/cache
Cypress Version: 0.0.0-development
Cypress Version: 0.0.0-development (stable)
System Platform: linux (Foo-OsVersion)
System Memory: 1.2 GB free 400 MB
`

exports['logs additional info about pre-releases'] = `
Proxy Settings: none detected
Environment Variables: none detected
Application Data: /user/app/data/path
Browser Profiles: /user/app/data/path/to/browsers
Binary Caches: /user/path/to/binary/cache
Cypress Version: 0.0.0-development (pre-release)
System Platform: linux (Foo-OsVersion)
System Memory: 1.2 GB free 400 MB
This is a pre-release build of Cypress.
Build info:
Commit SHA: abc123
Commit Branch: someBranchName
Commit Date: 2022-02-02Txx:xx:xx.000Z
`

exports['logs additional info about development'] = `
Proxy Settings: none detected
Environment Variables: none detected
Application Data: /user/app/data/path
Browser Profiles: /user/app/data/path/to/browsers
Binary Caches: /user/path/to/binary/cache
Cypress Version: 0.0.0-development (pre-release)
System Platform: linux (Foo-OsVersion)
System Memory: 1.2 GB free 400 MB
This is the development (un-built) Cypress CLI.
`
36 changes: 36 additions & 0 deletions cli/__snapshots__/install_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,40 @@ https://on.cypress.io/guides/getting-started/installing-cypress#system-requireme
Platform: win32-ia32
`

exports['/lib/tasks/install .start non-stable builds logs a warning about installing a pre-release 1'] = `
⚠ Warning: You are installing a pre-release build of Cypress.
Bugs may be present which do not exist in production builds.
This build was created from:
* Commit SHA: abc123
* Commit Branch: aBranchName
* Commit Timestamp: 1996-11-27Txx:xx:xx.000Z
Installing Cypress (version: https://cdn.cypress.io/beta/binary/0.0.0-development/darwin-x64/aBranchName-abc123/cypress.zip)
⠋ Downloaded Cypress
✔ Downloaded Cypress
✔ Downloaded Cypress
⠋ Unzipped Cypress
✔ Downloaded Cypress
✔ Unzipped Cypress
✔ Downloaded Cypress
✔ Unzipped Cypress
⠋ Finished Installation /cache/Cypress/1.2.3
✔ Downloaded Cypress
✔ Unzipped Cypress
✔ Finished Installation /cache/Cypress/1.2.3
✔ Downloaded Cypress
✔ Unzipped Cypress
✔ Finished Installation /cache/Cypress/1.2.3
You can now open Cypress by running: node_modules/.bin/cypress open
https://on.cypress.io/installing-cypress
`
95 changes: 53 additions & 42 deletions cli/lib/exec/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const _ = require('lodash')
const g = chalk.green
// color for paths
const p = chalk.cyan
const red = chalk.red
// urls
const link = chalk.blue.underline

Expand Down Expand Up @@ -43,56 +44,66 @@ const formatCypressVariables = () => {
return maskSensitiveVariables(vars)
}

methods.start = (options = {}) => {
methods.start = async (options = {}) => {
const args = ['--mode=info']

return spawn.start(args, {
await spawn.start(args, {
dev: options.dev,
})
.then(() => {
console.log()
const proxyVars = methods.findProxyEnvironmentVariables()

if (_.isEmpty(proxyVars)) {
console.log('Proxy Settings: none detected')
} else {
console.log('Proxy Settings:')
_.forEach(proxyVars, (value, key) => {
console.log('%s: %s', key, g(value))
})

console.log()
console.log('Learn More: %s', link('https://on.cypress.io/proxy-configuration'))
console.log()
}
})
.then(() => {
const cyVars = formatCypressVariables()

if (_.isEmpty(cyVars)) {
console.log('Environment Variables: none detected')
} else {
console.log('Environment Variables:')
_.forEach(cyVars, (value, key) => {
console.log('%s: %s', key, g(value))
})
}
})
.then(() => {

console.log()
const proxyVars = methods.findProxyEnvironmentVariables()

if (_.isEmpty(proxyVars)) {
console.log('Proxy Settings: none detected')
} else {
console.log('Proxy Settings:')
_.forEach(proxyVars, (value, key) => {
console.log('%s: %s', key, g(value))
})

console.log()
console.log('Application Data:', p(util.getApplicationDataFolder()))
console.log('Browser Profiles:', p(util.getApplicationDataFolder('browsers')))
console.log('Binary Caches: %s', p(state.getCacheDir()))
})
.then(() => {
console.log('Learn More: %s', link('https://on.cypress.io/proxy-configuration'))
console.log()
}

const cyVars = formatCypressVariables()

return util.getOsVersionAsync().then((osVersion) => {
console.log('Cypress Version: %s', g(util.pkgVersion()))
console.log('System Platform: %s (%s)', g(os.platform()), g(osVersion))
console.log('System Memory: %s free %s', g(prettyBytes(os.totalmem())), g(prettyBytes(os.freemem())))
if (_.isEmpty(cyVars)) {
console.log('Environment Variables: none detected')
} else {
console.log('Environment Variables:')
_.forEach(cyVars, (value, key) => {
console.log('%s: %s', key, g(value))
})
})
}

console.log()
console.log('Application Data:', p(util.getApplicationDataFolder()))
console.log('Browser Profiles:', p(util.getApplicationDataFolder('browsers')))
console.log('Binary Caches: %s', p(state.getCacheDir()))

console.log()

const osVersion = await util.getOsVersionAsync()
const buildInfo = util.pkgBuildInfo()
const isStable = buildInfo && buildInfo.stable

console.log('Cypress Version: %s', g(util.pkgVersion()), isStable ? g('(stable)') : red('(pre-release)'))
console.log('System Platform: %s (%s)', g(os.platform()), g(osVersion))
console.log('System Memory: %s free %s', g(prettyBytes(os.totalmem())), g(prettyBytes(os.freemem())))

if (!buildInfo) {
console.log()
console.log('This is the', red('development'), '(un-built) Cypress CLI.')
} else if (!isStable) {
console.log()
console.log('This is a', red('pre-release'), 'build of Cypress.')
console.log('Build info:')
console.log(' Commit SHA:', g(buildInfo.commitSha))
console.log(' Commit Branch:', g(buildInfo.commitBranch))
console.log(' Commit Date:', g(buildInfo.commitDate))
}
}

module.exports = methods
9 changes: 8 additions & 1 deletion cli/lib/exec/versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,15 @@ const getVersions = () => {
return versions
})
.then((binaryVersions) => {
const buildInfo = util.pkgBuildInfo()

let packageVersion = util.pkgVersion()

if (!buildInfo) packageVersion += ' (development)'
else if (!buildInfo.stable) packageVersion += ' (pre-release)'

const versions = {
package: util.pkgVersion(),
package: packageVersion,
binary: binaryVersions.binary || 'not installed',
electronVersion: binaryVersions.electronVersion || 'not found',
electronNodeVersion: binaryVersions.electronNodeVersion || 'not found',
Expand Down
Loading

3 comments on commit 3c28617

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 3c28617 Mar 4, 2022

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.5.2/linux-x64/develop-3c286177cc57e699062162d9db9ba12a562e2ccf/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 3c28617 Mar 4, 2022

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.5.2/darwin-x64/develop-3c286177cc57e699062162d9db9ba12a562e2ccf/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 3c28617 Mar 4, 2022

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.5.2/win32-x64/develop-3c286177cc57e699062162d9db9ba12a562e2ccf/cypress.tgz

Please sign in to comment.