Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: build Cypress for darwin-arm64 #20686

Merged
merged 63 commits into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
d54a39d
chore: add m1 mac ci workflow
flotwig Mar 18, 2022
b234246
add arch to platform key
flotwig Mar 18, 2022
99ac8cc
actually add a workflow
flotwig Mar 18, 2022
9aaddf8
unify defaultsParameters
flotwig Mar 18, 2022
0807421
pass resource_class properly
flotwig Mar 18, 2022
6d42218
try which
flotwig Jun 7, 2022
ee18309
Merge remote-tracking branch 'origin/develop' into use-m1-runners
flotwig Jun 7, 2022
70de8c1
chore: skip windows canary check
flotwig Jun 8, 2022
7b65d37
restore sleep 2
flotwig Jun 8, 2022
c43f033
fix
flotwig Jun 8, 2022
3fda6bf
Merge branch 'develop' into use-m1-runners
flotwig Jun 8, 2022
335af84
update resource class
flotwig Jun 7, 2022
e901cd6
sync known_hosts for nvm install
flotwig Jun 8, 2022
0f1c451
bump nvm version
flotwig Jun 8, 2022
7737120
Merge branch 'rm-windows-key-scanning' into use-m1-runners
flotwig Jun 8, 2022
63501e9
canaries :/
flotwig Jun 8, 2022
9718d38
ctrl+f add darwin-arm64
flotwig Jun 8, 2022
e4edc25
rename darwin x64 jobs to darwin-x64
flotwig Jun 8, 2022
70c4348
just call it darwin everywhere
flotwig Jun 8, 2022
935da85
debug
flotwig Jun 8, 2022
40bc79c
skip platform weirdness
flotwig Jun 8, 2022
5d364fc
set PLATFORM: darwin
flotwig Jun 8, 2022
71fff61
improve error message
flotwig Jun 8, 2022
9b2e30a
set max-buffer in build-prod step to avoid lerna buffer err
flotwig Jun 8, 2022
78b1b52
patch out buflen check
flotwig Jun 8, 2022
96b4b34
also set max buf in build.ts
flotwig Jun 8, 2022
870b238
hugely bump buffer
flotwig Jun 8, 2022
dd8eaee
less debug
flotwig Jun 8, 2022
1731577
Revert "hugely bump buffer"
flotwig Jun 8, 2022
ea79bec
Revert "also set max buf in build.ts"
flotwig Jun 8, 2022
eb4896c
Revert "patch out buflen check"
flotwig Jun 8, 2022
4de9111
Revert "set max-buffer in build-prod step to avoid lerna buffer err"
flotwig Jun 8, 2022
e10855d
add darwin-arm64 support to cli
flotwig Jun 8, 2022
cd875be
xcode-select
flotwig Jun 8, 2022
beeb0f9
fix syntax error
flotwig Jun 8, 2022
c07a071
syntax error
flotwig Jun 8, 2022
e038c34
update buildDir for mac-arm64
flotwig Jun 9, 2022
f1a0d6c
debug
flotwig Jun 9, 2022
43b6bed
add SKIP_NOTARIZATION
flotwig Jun 9, 2022
86991e1
update comment code
flotwig Jun 9, 2022
82e4644
remove no-op
flotwig Jun 9, 2022
dcc2fe1
Merge remote-tracking branch 'origin/develop' into use-m1-runners
flotwig Jun 9, 2022
82a1ced
update snapshots
flotwig Jun 9, 2022
e81a96d
cli updates
flotwig Jun 9, 2022
36b30d6
fix platforminfo
flotwig Jun 9, 2022
174dd5b
update cli tests
flotwig Jun 10, 2022
86ae243
add missing yarn.lock
flotwig Jun 10, 2022
fcfcf30
add checkDownloads
flotwig Jun 10, 2022
e622be8
remove unneeded --platform
flotwig Jun 10, 2022
c2e8cdb
back to type
flotwig Jun 10, 2022
ab0f1ba
downgrade nvm
flotwig Jun 10, 2022
5116083
Revert "downgrade nvm"
flotwig Jun 10, 2022
db77337
Merge remote-tracking branch 'origin/develop' into use-m1-runners
flotwig Jun 10, 2022
6bcbbf0
return of the load-nvm.sh
flotwig Jun 10, 2022
0ae48dc
fix script
flotwig Jun 10, 2022
51ffd7f
ensure-node
flotwig Jun 10, 2022
45c6051
printf
flotwig Jun 11, 2022
8099750
cleanup
flotwig Jun 11, 2022
777b5d1
add fse.remove
flotwig Jun 11, 2022
035ce7c
Delete yarn.lock
flotwig Jun 13, 2022
e676179
Merge branch 'develop' into use-m1-runners
flotwig Jun 13, 2022
6d1187a
address review feedback
flotwig Jun 14, 2022
ff55e6c
Merge remote-tracking branch 'origin/develop' into use-m1-runners
flotwig Jun 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions __snapshots__/upload-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ exports['test runner manifest'] = {
"darwin-x64": {
"url": "https://cdn.cypress.io/desktop/3.3.0/darwin-x64/cypress.zip"
},
"darwin-arm64": {
"url": "https://cdn.cypress.io/desktop/3.3.0/darwin-arm64/cypress.zip"
},
"linux-x64": {
"url": "https://cdn.cypress.io/desktop/3.3.0/linux-x64/cypress.zip"
},
Expand Down
4 changes: 4 additions & 0 deletions __snapshots__/util-upload-spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
exports['upload util isValidPlatformArch checks given strings second 1'] = {
"name": "second",
"behavior": [
{
"given": "darwin-arm64",
"expect": true
},
{
"given": "darwin-x64",
"expect": true
Expand Down
145 changes: 91 additions & 54 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,36 +28,37 @@ mainBuildFilters: &mainBuildFilters
branches:
only:
- develop
- fix-unit-tests-release

# uncomment & add to the branch conditions below to disable the main linux
# flow if we don't want to test it for a certain branch
linuxWorkflowExcludeFilters: &linux-workflow-exclude-filters
unless:
or:
- false
# - equal: [ 'tgriesser/chore/fix-windows-build', << pipeline.git.branch >> ]
- 10.0-release
- use-m1-runners

# 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
# so just add your branch to the list here to build and test on Mac
macWorkflowFilters: &mac-workflow-filters
macWorkflowFilters: &darwin-workflow-filters
when:
or:
- equal: [ develop, << pipeline.git.branch >> ]
- equal: [ 'fix-unit-tests-release', << pipeline.git.branch >> ]
- equal: [ use-m1-runners, << pipeline.git.branch >> ]
- matches:
pattern: "-release$"
value: << pipeline.git.branch >>

# uncomment & add to the branch conditions below to disable the main linux
# flow if we don't want to test it for a certain branch
linuxWorkflowExcludeFilters: &linux-workflow-exclude-filters
unless:
or:
- false
# - equal: [ 'tgriesser/chore/fix-windows-build', << pipeline.git.branch >> ]

# windows is slow in CI, so we only run a certain set of tests on each commit
# add your branch to this list to run the full Windows build on your PR
fullWindowsWorkflowFilters: &full-windows-workflow-filters
filters:
branches:
only:
- develop
- 'fix-unit-tests-release'
- 'use-m1-runners'
- '*-release'
- 'win*'

Expand Down Expand Up @@ -88,7 +89,7 @@ executors:
xcode: "13.0.0"
resource_class: macos.x86.medium.gen2
environment:
PLATFORM: mac
PLATFORM: darwin

# executor to run on Windows - based off of the windows-orb default executor since it is
# not customizable enough to align with our existing setup.
Expand All @@ -102,13 +103,18 @@ executors:
environment:
PLATFORM: windows

darwin-arm64:
machine: true
environment:
PLATFORM: darwin

commands:
verify_should_persist_artifacts:
steps:
- run:
name: Check current branch to persist artifacts
command: |
if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "fix-unit-tests-release" ]]; then
if [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "use-m1-runners" ]]; then
echo "Not uploading artifacts or posting install comment for this branch."
circleci-agent step halt
fi
Expand Down Expand Up @@ -188,7 +194,7 @@ commands:
command: node scripts/circle-cache.js --action cacheKey > circle_cache_key
- run:
name: Generate platform key
command: echo $PLATFORM > platform_key
command: node ./scripts/get-platform-key.js > platform_key
- restore_cache:
name: Restore cache state, to check for known modules cache existence
key: v{{ .Environment.CACHE_VERSION }}-{{ checksum "platform_key" }}-node-modules-cache-{{ checksum "circle_cache_key" }}
Expand All @@ -214,7 +220,7 @@ commands:
command: ./system-tests/scripts/cache-key.sh > system_tests_cache_key
- run:
name: Generate platform key
command: echo $PLATFORM > platform_key
command: node ./scripts/get-platform-key.js > platform_key
- restore_cache:
name: Restore system tests node_modules cache
keys:
Expand All @@ -228,7 +234,7 @@ commands:
command: ./system-tests/scripts/cache-key.sh > system_tests_cache_key
- run:
name: Generate platform key
command: echo $PLATFORM > platform_key
command: node ./scripts/get-platform-key.js > platform_key
- restore_cache:
name: Restore cache state, to check for known modules cache existence
keys:
Expand Down Expand Up @@ -276,7 +282,7 @@ commands:
command: node scripts/circle-cache.js --action cacheKey > circle_cache_key
- run:
name: Generate platform key
command: echo $PLATFORM > platform_key
command: node ./scripts/get-platform-key.js > platform_key
- restore_cache:
name: Restore cache state, to check for known modules cache existence
key: v{{ .Environment.CACHE_VERSION }}-{{ checksum "platform_key" }}-state-of-node-modules-cache-{{ checksum "circle_cache_key" }}
Expand Down Expand Up @@ -370,28 +376,20 @@ commands:
# https://discuss.circleci.com/t/switch-nodejs-version-on-machine-executor-solved/26675/2
description: Install Node version matching .node-version
steps:
# installing NVM will use git+ssh, so update known_hosts
- update_known_hosts
- run:
name: Install Node
command: |
node_version=$(cat .node-version)
[ -s "${HOME}/.nvm/nvm.sh" ] && \. "${HOME}/.nvm/nvm.sh" # This loads nvm
if ! type nvm > /dev/null; then
echo "Installing NVM"
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.30.0/install.sh | bash
[ -s "${HOME}/.nvm/nvm.sh" ] && \. "${HOME}/.nvm/nvm.sh" # This loads nvm
fi
echo "Installing Node $node_version"
nvm install ${node_version}
echo "Using Node $node_version"
nvm use ${node_version}
[[ $PLATFORM != 'windows' ]] && nvm alias default ${node_version} || sleep 2s
source ./scripts/ensure-node.sh
echo "Installing Yarn"
npm install yarn -g # ensure yarn is installed with the correct node engine
yarn check-node-version
- run:
name: Check Node
command: |
[ -s "${HOME}/.nvm/nvm.sh" ] && \. "${HOME}/.nvm/nvm.sh"
source ./scripts/ensure-node.sh
yarn check-node-version

install-chrome:
Expand Down Expand Up @@ -617,7 +615,7 @@ commands:
- run:
name: 'Verify Mocha Results'
command: |
[ -s "${HOME}/.nvm/nvm.sh" ] && \. "${HOME}/.nvm/nvm.sh"
source ./scripts/ensure-node.sh
yarn verify:mocha:results <<parameters.expectedResultCount>>

clone-repo-and-checkout-branch:
Expand Down Expand Up @@ -958,12 +956,12 @@ commands:
no_output_timeout: "45m"
command: |
node --version
yarn binary-build --platform $PLATFORM --version $(node ./scripts/get-next-version.js)
yarn binary-build --version $(node ./scripts/get-next-version.js)
- run:
name: Zip the binary
command: |
[[ $PLATFORM == 'linux' ]] && apt-get update && apt-get install -y zip || [[ $PLATFORM != 'linux' ]]
yarn binary-zip --platform $PLATFORM
yarn binary-zip
- store-npm-logs
- persist_to_workspace:
root: ~/
Expand Down Expand Up @@ -1039,6 +1037,15 @@ commands:
- cypress/binary-url.json
- cypress/npm-package-url.json

update_known_hosts:
description: Ensures that we have the latest Git public keys to prevent git+ssh from failing.
steps:
- run:
name: Update known_hosts with github.com keys
command: |
mkdir -p ~/.ssh
ssh-keyscan github.com >> ~/.ssh/known_hosts

jobs:
## Checks if we already have a valid cache for the node_modules_install and if it has,
## skips ahead to the build step, otherwise installs and caches the node_modules
Expand Down Expand Up @@ -1080,10 +1087,10 @@ jobs:
name: Top level packages
command: yarn list --depth=0 || true
- run:
name: Check env canaries on Mac/Linux
name: Check env canaries on Linux
command: |
# Windows CircleCI does not have a way to pull per-job env
[[ $PLATFORM != 'windows' ]] && node ./scripts/circle-env.js --check-canaries || true
# Windows/Mac M1 CircleCI does not have a way to pull per-job env
[[ $PLATFORM == 'linux' ]] && node ./scripts/circle-env.js --check-canaries || true
- build-and-persist
- store-npm-logs

Expand Down Expand Up @@ -1222,11 +1229,7 @@ jobs:
parallelism: 1
steps:
- restore_cached_workspace
- run:
name: Update known_hosts with github.com keys
command: |
mkdir -p ~/.ssh
ssh-keyscan github.com >> ~/.ssh/known_hosts
- update_known_hosts
- run: yarn test-npm-package-release-script

lint-types:
Expand Down Expand Up @@ -1793,6 +1796,11 @@ jobs:

test-kitchensink:
<<: *defaults
parameters:
<<: *defaultsParameters
resource_class:
type: string
default: medium+
steps:
- clone-repo-and-checkout-branch:
repo: cypress-example-kitchensink
Expand Down Expand Up @@ -2537,44 +2545,70 @@ linux-workflow: &linux-workflow
- create-build-artifacts
- system-tests-node-modules-install

mac-workflow: &mac-workflow
darwin-x64-workflow: &darwin-x64-workflow
jobs:
- node_modules_install:
name: darwin-node-modules-install
name: darwin-x64-node-modules-install
executor: mac
resource_class: macos.x86.medium.gen2
only-cache-for-root-user: true

- build:
name: darwin-build
name: darwin-x64-build
context: test-runner:env-canary
executor: mac
resource_class: macos.x86.medium.gen2
requires:
- darwin-node-modules-install
- darwin-x64-node-modules-install

- lint:
name: darwin-lint
name: darwin-x64-lint
executor: mac
requires:
- darwin-build
- darwin-x64-build

- create-build-artifacts:
name: darwin-create-build-artifacts
name: darwin-x64-create-build-artifacts
context:
- test-runner:sign-mac-binary
- test-runner:upload
- test-runner:commit-status-checks
executor: mac
resource_class: macos.x86.medium.gen2
requires:
- darwin-build
- darwin-x64-build

- test-kitchensink:
name: darwin-test-kitchensink
name: darwin-x64-test-kitchensink
executor: mac
requires:
- darwin-build
- darwin-x64-build

darwin-arm64-workflow: &darwin-arm64-workflow
jobs:
- node_modules_install:
name: darwin-arm64-node-modules-install
executor: darwin-arm64
resource_class: cypress-io/latest_m1
only-cache-for-root-user: true

- build:
name: darwin-arm64-build
executor: darwin-arm64
resource_class: cypress-io/latest_m1
requires:
- darwin-arm64-node-modules-install

- create-build-artifacts:
name: darwin-arm64-create-build-artifacts
context:
- test-runner:sign-mac-binary
- test-runner:upload
- test-runner:commit-status-checks
executor: darwin-arm64
resource_class: cypress-io/latest_m1
requires:
- darwin-arm64-build

windows-workflow: &windows-workflow
jobs:
Expand Down Expand Up @@ -2644,8 +2678,11 @@ workflows:
linux:
<<: *linux-workflow
<<: *linux-workflow-exclude-filters
mac:
<<: *mac-workflow
<<: *mac-workflow-filters
darwin-x64:
<<: *darwin-x64-workflow
<<: *darwin-workflow-filters
darwin-arm64:
<<: *darwin-arm64-workflow
<<: *darwin-workflow-filters
windows:
<<: *windows-workflow
12 changes: 6 additions & 6 deletions cli/__snapshots__/download_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ Otherwise, please check network connectivity and try again:

----------

URL: https://download.cypress.io/desktop?platform=OS&arch=ARCH
URL: https://download.cypress.io/desktop?platform=OS&arch=x64
404 - Not Found

----------

Platform: darwin-x64 (Foo-OsVersion)
Platform: OS-x64 (Foo-OsVersion)
Cypress Version: 1.2.3

`
Expand All @@ -42,17 +42,17 @@ 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
https://download.cypress.io/desktop/0.20.2/OS-ARCH/cypress.zip
`

exports['desktop url from template with escaped dollar sign'] = `
https://download.cypress.io/desktop/0.20.2/darwin-x64/cypress.zip
https://download.cypress.io/desktop/0.20.2/OS-ARCH/cypress.zip
`

exports['desktop url from template wrapped in quote'] = `
https://download.cypress.io/desktop/0.20.2/darwin-x64/cypress.zip
https://download.cypress.io/desktop/0.20.2/OS-ARCH/cypress.zip
`

exports['desktop url from template with escaped dollar sign wrapped in quote'] = `
https://download.cypress.io/desktop/0.20.2/darwin-x64/cypress.zip
https://download.cypress.io/desktop/0.20.2/OS-ARCH/cypress.zip
`
Loading