Skip to content

Commit

Permalink
chore: use the circle browsers image to install needed browsers inste…
Browse files Browse the repository at this point in the history
…ad of sourcing them from the internal cypress docker images.
  • Loading branch information
AtofStryker committed Jan 27, 2025
1 parent e06c846 commit 0bd33ab
Showing 1 changed file with 122 additions and 32 deletions.
154 changes: 122 additions & 32 deletions .circleci/workflows.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
version: 2.1

orbs:
browser-tools: circleci/browser-tools@1.5.0

defaults: &defaults
parallelism: 1
working_directory: ~/cypress
Expand Down Expand Up @@ -32,7 +35,7 @@ mainBuildFilters: &mainBuildFilters
- 'update-v8-snapshot-cache-on-develop'
- 'chore/update_vue_test_utils'
- 'publish-binary'
- 'chore/fix_windows_kitchensink'
- 'chore/browser_spike'

# 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 @@ -44,7 +47,7 @@ macWorkflowFilters: &darwin-workflow-filters
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
- equal: [ 'chore/update_vue_test_utils', << pipeline.git.branch >> ]
- equal: [ 'cacie/fix-hook-test-stack-analysis', << pipeline.git.branch >> ]
- equal: [ 'chore/browser_spike', << pipeline.git.branch >> ]
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
Expand All @@ -56,7 +59,7 @@ linuxArm64WorkflowFilters: &linux-arm64-workflow-filters
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
- equal: [ 'chore/update_binary_branch', << pipeline.git.branch >> ]
- equal: [ 'cacie/fix-hook-test-stack-analysis', << pipeline.git.branch >> ]
- equal: [ 'chore/browser_spike', << pipeline.git.branch >> ]
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
Expand All @@ -80,7 +83,7 @@ windowsWorkflowFilters: &windows-workflow-filters
# use the following branch as well to ensure that v8 snapshot cache updates are fully tested
- equal: [ 'update-v8-snapshot-cache-on-develop', << pipeline.git.branch >> ]
- equal: [ 'ryanm/chore/electron-33-upgrade', << pipeline.git.branch >> ]
- equal: [ 'chore/fix_windows_kitchensink', << pipeline.git.branch >> ]
- equal: [ 'chore/browser_spike', << pipeline.git.branch >> ]
- matches:
pattern: /^release\/\d+\.\d+\.\d+$/
value: << pipeline.git.branch >>
Expand All @@ -89,7 +92,7 @@ executors:
# the Docker image with Cypress dependencies and Chrome browser
cy-doc:
docker:
- image: cypress/browsers-internal:node20.18.1-bullseye-chrome131-ff133
- image: cypress/base-internal:20.18.1-bullseye-downstream
# by default, we use "medium" to balance performance + CI costs. bump or reduce on a per-job basis if needed.
resource_class: medium
environment:
Expand All @@ -98,7 +101,7 @@ executors:

kitchensink-executor:
docker:
- image: cypress/browsers-internal:node20.18.1-bullseye-chrome131-ff133
- image: cypress/base-internal:20.18.1-bullseye-downstream
# by default, we use "medium" to balance performance + CI costs. bump or reduce on a per-job basis if needed.
resource_class: medium
environment:
Expand All @@ -108,7 +111,7 @@ executors:
# Docker image with non-root "node" user
non-root-docker-user:
docker:
- image: cypress/browsers-internal:node20.18.1-bullseye-chrome131-ff133
- image: cypress/base-internal:20.18.1-bullseye-downstream
user: node
environment:
PLATFORM: linux
Expand Down Expand Up @@ -156,7 +159,7 @@ commands:
name: Set environment variable to determine whether or not to persist artifacts
command: |
echo "Setting SHOULD_PERSIST_ARTIFACTS variable"
echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "chore/update_vue_test_utils" && "$CIRCLE_BRANCH" != chore/fix_windows_kitchensink ]]; then
echo 'if ! [[ "$CIRCLE_BRANCH" != "develop" && "$CIRCLE_BRANCH" != "release/"* && "$CIRCLE_BRANCH" != "chore/browser_spike" && "$CIRCLE_BRANCH" != cacie/fix-hook-test-stack-analysis ]]; then
export SHOULD_PERSIST_ARTIFACTS=true
fi' >> "$BASH_ENV"
# You must run `setup_should_persist_artifacts` command and be using bash before running this command
Expand Down Expand Up @@ -513,27 +516,69 @@ commands:
source ./scripts/ensure-node.sh
yarn check-node-version
install-chrome:
description: Install Google Chrome
install-browsers:
description: Install Google Chrome or Firefox
parameters:
channel:
description: browser channel to install
executor:
description: The executor in use. Only used if Windows for workaround purposes
type: executor
default: cy-doc
install-chrome:
description: whether or not to install google chrome
type: boolean
default: false
google-chrome-channel:
description: Google Chrome channel to install
type: string
# can be stable, beta, dev, or canary
default: stable
google-chrome-version:
description: Google Chrome version to install
type: string
version:
description: browser version to install
# latest can also be used here
default: 131.0.6778.108
install-firefox:
description: whether or not to install firefox
type: boolean
default: false
firefox-version:
description: Firefox version to install
type: string
# latest can also be used here
default: 134.0.2
steps:
- run:
name: Install Google Chrome (<<parameters.channel>>)
command: |
echo "Installing Chrome (<<parameters.channel>>) v<<parameters.version>>"
wget -O /usr/src/google-chrome-<<parameters.channel>>_<<parameters.version>>_amd64.deb "http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-<<parameters.channel>>/google-chrome-<<parameters.channel>>_<<parameters.version>>-1_amd64.deb" && \
dpkg -i /usr/src/google-chrome-<<parameters.channel>>_<<parameters.version>>_amd64.deb ; \
apt-get install -f -y && \
rm -f /usr/src/google-chrome-<<parameters.channel>>_<<parameters.version>>_amd64.deb
which google-chrome-<<parameters.channel>> || (printf "\n\033[0;31mChrome was not successfully downloaded - bailing\033[0m\n\n" && exit 1)
echo "Location of Google Chrome Installation: `which google-chrome-<<parameters.channel>>`"
echo "Google Chrome Version: `google-chrome-<<parameters.channel>> --version`"
- when:
condition:
not:
equal: [ *windows-executor, << parameters.executor >> ]
# see https://circleci.com/developer/orbs/orb/circleci/browser-tool
steps:
- when:
condition:
equal: [ true, << parameters.install-firefox >> ]
steps:
- browser-tools/install-firefox:
# https://download-installer.cdn.mozilla.net/pub/firefox/releases/
version: << parameters.firefox-version >>
- when:
condition:
equal: [ true, << parameters.install-chrome >> ]
steps:
- browser-tools/install-chrome:
# https://www.ubuntuupdates.org/package/google_chrome/stable/main/base/google-chrome-stable
channel: << parameters.google-chrome-channel >>
chrome-version: << parameters.google-chrome-version >>
- when:
condition:
equal: [ 'beta', << parameters.google-chrome-channel>> ]
steps:
- run:
# When the beta is downloaded with this orb,
# google-chrome-beta is linked in addition to google-chrome,
# which we do not expect and errors out when running Cypress
name: remove linked google-chrome binary
command: |
rm /usr/bin/google-chrome
# This code builds better-sqlite3 on Debian 10 (Buster). This is necessary because Debian 10 has the oldest glibc version (2.28) that we support.
#
Expand Down Expand Up @@ -576,7 +621,7 @@ commands:
install-chrome-channel:
description: chrome channel to install
type: string
default: ''
default: 'stable'
inject-document-domain:
description: run subset of tests with injectDocumentDomain config enabled
type: boolean
Expand All @@ -585,11 +630,25 @@ commands:
steps:
- restore_cached_workspace
- when:
condition: <<parameters.install-chrome-channel>>
condition:
equal: [ chrome, << parameters.browser >> ]
steps:
- install-browsers:
install-chrome: true
- when:
condition:
equal: [ chrome:beta, << parameters.browser >> ]
steps:
- install-browsers:
install-chrome: true
google-chrome-channel: << parameters.install-chrome-channel >>
google-chrome-version: latest
- when:
condition:
equal: [ firefox, << parameters.browser >> ]
steps:
- install-chrome:
channel: <<parameters.install-chrome-channel>>
version: $(node ./scripts/get-browser-version.js chrome:<<parameters.install-chrome-channel>>)
- install-browsers:
install-firefox: true
- when:
condition:
equal: [ webkit, << parameters.browser >> ]
Expand Down Expand Up @@ -685,6 +744,10 @@ commands:
- run:
name: reinstall dependencies to work around cache issue (Windows only)
command: rm -rf node_modules && yarn
- install-browsers:
install-chrome: true
install-firefox: true
executor: << parameters.executor >>
- windows-install-chrome:
browser: <<parameters.browser>>
- run:
Expand Down Expand Up @@ -758,6 +821,9 @@ commands:
equal: [ webkit, << parameters.browser >> ]
steps:
- install-webkit-deps
- install-browsers:
install-chrome: true
install-firefox: true
- run:
name: Run system tests
environment:
Expand Down Expand Up @@ -934,6 +1000,8 @@ commands:
# force installing the freshly built binary
command: |
CYPRESS_INSTALL_BINARY=~/cypress/cypress.zip npm i --legacy-peer-deps ~/cypress/cypress.tgz && [[ -f yarn.lock ]] && yarn
- install-browsers:
install-chrome: true
- run:
name: Print Cypress version
working_directory: /tmp/<<parameters.repo>>
Expand Down Expand Up @@ -1026,6 +1094,10 @@ commands:
description: Server start command for repo
type: string
default: "npm start --if-present"
executor:
description: The executor in use. Only used if Windows for workaround purposes
type: executor
default: cy-doc
steps:
- run:
name: Install yarn if not already installed
Expand Down Expand Up @@ -1119,7 +1191,10 @@ commands:
command: |
npm i -g wait-on
npx wait-on <<parameters.wait-on>> --timeout 120000
- install-browsers:
install-chrome: true
install-firefox: true
executor: << parameters.executor >>
- windows-install-chrome:
browser: <<parameters.browser>>
- when:
Expand Down Expand Up @@ -1666,6 +1741,9 @@ jobs:
parallelism: 1
steps:
- restore_cached_workspace
- install-browsers:
install-chrome: true
executor: << parameters.executor >>
- when:
condition:
# several snapshots fails for windows due to paths.
Expand Down Expand Up @@ -1774,6 +1852,8 @@ jobs:
parallelism: 1
steps:
- restore_cached_workspace
- install-browsers:
install-chrome: true
- run: yarn test-integration --scope=@packages/server
- verify-mocha-results:
expectedResultCount: 1
Expand All @@ -1785,6 +1865,9 @@ jobs:
<<: *defaults
steps:
- restore_cached_workspace
- install-browsers:
install-chrome: true
install-firefox: true
- run:
command: yarn workspace @packages/server test-performance
- verify-mocha-results:
Expand Down Expand Up @@ -1853,7 +1936,7 @@ jobs:
parallelism: 1
working_directory: ~/cypress
docker:
- image: cypress/browsers-internal:node20.18.1-bullseye-chrome131-ff133
- image: cypress/base-internal:20.18.1-bullseye-downstream
environment:
# needed to inform the bootstrap-docker-container.sh script to link the binary in the system-test project directory
REPO_DIR: /root/cypress
Expand Down Expand Up @@ -2126,6 +2209,8 @@ jobs:
steps:
- restore_cached_workspace
- restore_cached_system_tests_deps
- install-browsers:
install-chrome: true
- run:
command: |
CYPRESS_CONFIG_ENV=production \
Expand All @@ -2148,6 +2233,8 @@ jobs:
steps:
- restore_cached_workspace
- restore_cached_system_tests_deps
- install-browsers:
install-chrome: true
- run:
command: |
CYPRESS_CONFIG_ENV=production \
Expand Down Expand Up @@ -2258,6 +2345,8 @@ jobs:
steps:
- restore_cached_workspace
- restore_cached_system_tests_deps
- install-browsers:
install-chrome: true
- run:
command: yarn cypress:run
working_directory: npm/puppeteer
Expand Down Expand Up @@ -2731,6 +2820,7 @@ jobs:
- test-binary-against-repo:
repo: cypress-example-kitchensink
browser: chrome
executor: << parameters.executor >>

test-binary-against-todomvc-firefox:
<<: *defaults
Expand Down

5 comments on commit 0bd33ab

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 0bd33ab Jan 27, 2025

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 build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/14.0.1/linux-x64/chore/browser_spike-0bd33abbf110218bc1c2bff93ad0badc2536bd11/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 0bd33ab Jan 27, 2025

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 arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/14.0.1/linux-arm64/chore/browser_spike-0bd33abbf110218bc1c2bff93ad0badc2536bd11/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 0bd33ab Jan 27, 2025

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 arm64 version of the Test Runner.

Learn more about this pre-release build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/14.0.1/darwin-arm64/chore/browser_spike-0bd33abbf110218bc1c2bff93ad0badc2536bd11/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 0bd33ab Jan 27, 2025

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 build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/14.0.1/win32-x64/chore/browser_spike-0bd33abbf110218bc1c2bff93ad0badc2536bd11/cypress.tgz

@cypress-bot
Copy link
Contributor

@cypress-bot cypress-bot bot commented on 0bd33ab Jan 27, 2025

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 build at https://on.cypress.io/advanced-installation#Install-pre-release-version

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/14.0.1/darwin-x64/chore/browser_spike-0bd33abbf110218bc1c2bff93ad0badc2536bd11/cypress.tgz

Please sign in to comment.