Skip to content
This repository was archived by the owner on Apr 24, 2024. It is now read-only.

Commit 3c28617

Browse files
authored
fix: use unique install cache folders for betas (cypress-io#20296)
1 parent 2e62bbb commit 3c28617

28 files changed

+618
-528
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
exports['prepare-release-artifacts runs expected commands 1'] = `
2+
$ node ./scripts/prepare-release-artifacts.js --dry-run --sha 57d0a85108fad6f77b39db88b8a7d8a3bfdb51a2 --version 1.2.3
3+
🏗 Running \`move-binaries\`...
4+
🏗 Dry run, not executing: node ./scripts/binary.js move-binaries --sha 57d0a85108fad6f77b39db88b8a7d8a3bfdb51a2 --version 1.2.3
5+
🏗 Running \`create-stable-npm-package\`...
6+
🏗 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
7+
8+
`
-165 KB
Binary file not shown.

circle.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ mainBuildFilters: &mainBuildFilters
2929
only:
3030
- develop
3131
- 10.0-release
32-
- fix-release-scripts
32+
- fix-beta-build-caching
3333

3434
# usually we don't build Mac app - it takes a long time
3535
# but sometimes we want to really confirm we are doing the right thing
@@ -38,7 +38,7 @@ macWorkflowFilters: &mac-workflow-filters
3838
when:
3939
or:
4040
- equal: [ develop, << pipeline.git.branch >> ]
41-
- equal: [ faster-mac-builds, << pipeline.git.branch >> ]
41+
- equal: [ fix-beta-build-caching, << pipeline.git.branch >> ]
4242
- matches:
4343
pattern: "-release$"
4444
value: << pipeline.git.branch >>
@@ -48,7 +48,7 @@ windowsWorkflowFilters: &windows-workflow-filters
4848
or:
4949
- equal: [ master, << pipeline.git.branch >> ]
5050
- equal: [ develop, << pipeline.git.branch >> ]
51-
- equal: [ fix-next-version-in-test-repos, << pipeline.git.branch >> ]
51+
- equal: [ fix-beta-build-caching, << pipeline.git.branch >> ]
5252
- matches:
5353
pattern: "-release$"
5454
value: << pipeline.git.branch >>
@@ -1633,7 +1633,7 @@ jobs:
16331633
- run:
16341634
name: Check current branch to persist artifacts
16351635
command: |
1636-
if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "fix-release-scripts" ]]; then
1636+
if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "fix-beta-build-caching" ]]; then
16371637
echo "Not uploading artifacts or posting install comment for this branch."
16381638
circleci-agent step halt
16391639
fi

cli/__snapshots__/build_spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ exports['package.json build outputs expected properties 1'] = {
22
"name": "test",
33
"engines": "test engines",
44
"version": "x.y.z",
5+
"buildInfo": "replaced by normalizePackageJson",
56
"description": "Cypress.io end to end testing tool",
67
"homepage": "https://github.com/cypress-io/cypress",
78
"license": "MIT",

cli/__snapshots__/download_spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ https://download.cypress.io/desktop/0.20.2?platform=OS&arch=ARCH
4343

4444
exports['desktop url from template'] = `
4545
https://download.cypress.io/desktop/0.20.2/darwin-x64/cypress.zip
46-
`
46+
`

cli/__snapshots__/info_spec.js

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Application Data: /user/app/data/path
77
Browser Profiles: /user/app/data/path/to/browsers
88
Binary Caches: /user/path/to/binary/cache
99
10-
Cypress Version: 0.0.0-development
10+
Cypress Version: 0.0.0-development (stable)
1111
System Platform: linux (Foo-OsVersion)
1212
System Memory: 1.2 GB free 400 MB
1313
@@ -29,7 +29,7 @@ Application Data: /user/app/data/path
2929
Browser Profiles: /user/app/data/path/to/browsers
3030
Binary Caches: /user/path/to/binary/cache
3131
32-
Cypress Version: 0.0.0-development
32+
Cypress Version: 0.0.0-development (stable)
3333
System Platform: linux (Foo-OsVersion)
3434
System Memory: 1.2 GB free 400 MB
3535
@@ -48,8 +48,46 @@ Application Data: /user/app/data/path
4848
Browser Profiles: /user/app/data/path/to/browsers
4949
Binary Caches: /user/path/to/binary/cache
5050
51-
Cypress Version: 0.0.0-development
51+
Cypress Version: 0.0.0-development (stable)
5252
System Platform: linux (Foo-OsVersion)
5353
System Memory: 1.2 GB free 400 MB
5454
5555
`
56+
57+
exports['logs additional info about pre-releases'] = `
58+
59+
Proxy Settings: none detected
60+
Environment Variables: none detected
61+
62+
Application Data: /user/app/data/path
63+
Browser Profiles: /user/app/data/path/to/browsers
64+
Binary Caches: /user/path/to/binary/cache
65+
66+
Cypress Version: 0.0.0-development (pre-release)
67+
System Platform: linux (Foo-OsVersion)
68+
System Memory: 1.2 GB free 400 MB
69+
70+
This is a pre-release build of Cypress.
71+
Build info:
72+
Commit SHA: abc123
73+
Commit Branch: someBranchName
74+
Commit Date: 2022-02-02Txx:xx:xx.000Z
75+
76+
`
77+
78+
exports['logs additional info about development'] = `
79+
80+
Proxy Settings: none detected
81+
Environment Variables: none detected
82+
83+
Application Data: /user/app/data/path
84+
Browser Profiles: /user/app/data/path/to/browsers
85+
Binary Caches: /user/path/to/binary/cache
86+
87+
Cypress Version: 0.0.0-development (pre-release)
88+
System Platform: linux (Foo-OsVersion)
89+
System Memory: 1.2 GB free 400 MB
90+
91+
This is the development (un-built) Cypress CLI.
92+
93+
`

cli/__snapshots__/install_spec.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,4 +256,40 @@ https://on.cypress.io/guides/getting-started/installing-cypress#system-requireme
256256
257257
Platform: win32-ia32
258258
259+
`
260+
261+
exports['/lib/tasks/install .start non-stable builds logs a warning about installing a pre-release 1'] = `
262+
⚠ Warning: You are installing a pre-release build of Cypress.
263+
264+
Bugs may be present which do not exist in production builds.
265+
266+
This build was created from:
267+
* Commit SHA: abc123
268+
* Commit Branch: aBranchName
269+
* Commit Timestamp: 1996-11-27Txx:xx:xx.000Z
270+
271+
Installing Cypress (version: https://cdn.cypress.io/beta/binary/0.0.0-development/darwin-x64/aBranchName-abc123/cypress.zip)
272+
273+
274+
⠋ Downloaded Cypress
275+
✔ Downloaded Cypress
276+
✔ Downloaded Cypress
277+
⠋ Unzipped Cypress
278+
✔ Downloaded Cypress
279+
✔ Unzipped Cypress
280+
✔ Downloaded Cypress
281+
✔ Unzipped Cypress
282+
⠋ Finished Installation /cache/Cypress/1.2.3
283+
✔ Downloaded Cypress
284+
✔ Unzipped Cypress
285+
✔ Finished Installation /cache/Cypress/1.2.3
286+
✔ Downloaded Cypress
287+
✔ Unzipped Cypress
288+
✔ Finished Installation /cache/Cypress/1.2.3
289+
290+
You can now open Cypress by running: node_modules/.bin/cypress open
291+
292+
https://on.cypress.io/installing-cypress
293+
294+
259295
`

cli/lib/exec/info.js

Lines changed: 53 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const _ = require('lodash')
1111
const g = chalk.green
1212
// color for paths
1313
const p = chalk.cyan
14+
const red = chalk.red
1415
// urls
1516
const link = chalk.blue.underline
1617

@@ -43,56 +44,66 @@ const formatCypressVariables = () => {
4344
return maskSensitiveVariables(vars)
4445
}
4546

46-
methods.start = (options = {}) => {
47+
methods.start = async (options = {}) => {
4748
const args = ['--mode=info']
4849

49-
return spawn.start(args, {
50+
await spawn.start(args, {
5051
dev: options.dev,
5152
})
52-
.then(() => {
53-
console.log()
54-
const proxyVars = methods.findProxyEnvironmentVariables()
55-
56-
if (_.isEmpty(proxyVars)) {
57-
console.log('Proxy Settings: none detected')
58-
} else {
59-
console.log('Proxy Settings:')
60-
_.forEach(proxyVars, (value, key) => {
61-
console.log('%s: %s', key, g(value))
62-
})
63-
64-
console.log()
65-
console.log('Learn More: %s', link('https://on.cypress.io/proxy-configuration'))
66-
console.log()
67-
}
68-
})
69-
.then(() => {
70-
const cyVars = formatCypressVariables()
71-
72-
if (_.isEmpty(cyVars)) {
73-
console.log('Environment Variables: none detected')
74-
} else {
75-
console.log('Environment Variables:')
76-
_.forEach(cyVars, (value, key) => {
77-
console.log('%s: %s', key, g(value))
78-
})
79-
}
80-
})
81-
.then(() => {
53+
54+
console.log()
55+
const proxyVars = methods.findProxyEnvironmentVariables()
56+
57+
if (_.isEmpty(proxyVars)) {
58+
console.log('Proxy Settings: none detected')
59+
} else {
60+
console.log('Proxy Settings:')
61+
_.forEach(proxyVars, (value, key) => {
62+
console.log('%s: %s', key, g(value))
63+
})
64+
8265
console.log()
83-
console.log('Application Data:', p(util.getApplicationDataFolder()))
84-
console.log('Browser Profiles:', p(util.getApplicationDataFolder('browsers')))
85-
console.log('Binary Caches: %s', p(state.getCacheDir()))
86-
})
87-
.then(() => {
66+
console.log('Learn More: %s', link('https://on.cypress.io/proxy-configuration'))
8867
console.log()
68+
}
69+
70+
const cyVars = formatCypressVariables()
8971

90-
return util.getOsVersionAsync().then((osVersion) => {
91-
console.log('Cypress Version: %s', g(util.pkgVersion()))
92-
console.log('System Platform: %s (%s)', g(os.platform()), g(osVersion))
93-
console.log('System Memory: %s free %s', g(prettyBytes(os.totalmem())), g(prettyBytes(os.freemem())))
72+
if (_.isEmpty(cyVars)) {
73+
console.log('Environment Variables: none detected')
74+
} else {
75+
console.log('Environment Variables:')
76+
_.forEach(cyVars, (value, key) => {
77+
console.log('%s: %s', key, g(value))
9478
})
95-
})
79+
}
80+
81+
console.log()
82+
console.log('Application Data:', p(util.getApplicationDataFolder()))
83+
console.log('Browser Profiles:', p(util.getApplicationDataFolder('browsers')))
84+
console.log('Binary Caches: %s', p(state.getCacheDir()))
85+
86+
console.log()
87+
88+
const osVersion = await util.getOsVersionAsync()
89+
const buildInfo = util.pkgBuildInfo()
90+
const isStable = buildInfo && buildInfo.stable
91+
92+
console.log('Cypress Version: %s', g(util.pkgVersion()), isStable ? g('(stable)') : red('(pre-release)'))
93+
console.log('System Platform: %s (%s)', g(os.platform()), g(osVersion))
94+
console.log('System Memory: %s free %s', g(prettyBytes(os.totalmem())), g(prettyBytes(os.freemem())))
95+
96+
if (!buildInfo) {
97+
console.log()
98+
console.log('This is the', red('development'), '(un-built) Cypress CLI.')
99+
} else if (!isStable) {
100+
console.log()
101+
console.log('This is a', red('pre-release'), 'build of Cypress.')
102+
console.log('Build info:')
103+
console.log(' Commit SHA:', g(buildInfo.commitSha))
104+
console.log(' Commit Branch:', g(buildInfo.commitBranch))
105+
console.log(' Commit Date:', g(buildInfo.commitDate))
106+
}
96107
}
97108

98109
module.exports = methods

cli/lib/exec/versions.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,15 @@ const getVersions = () => {
4141
return versions
4242
})
4343
.then((binaryVersions) => {
44+
const buildInfo = util.pkgBuildInfo()
45+
46+
let packageVersion = util.pkgVersion()
47+
48+
if (!buildInfo) packageVersion += ' (development)'
49+
else if (!buildInfo.stable) packageVersion += ' (pre-release)'
50+
4451
const versions = {
45-
package: util.pkgVersion(),
52+
package: packageVersion,
4653
binary: binaryVersions.binary || 'not installed',
4754
electronVersion: binaryVersions.electronVersion || 'not found',
4855
electronNodeVersion: binaryVersions.electronNodeVersion || 'not found',

0 commit comments

Comments
 (0)