Skip to content

Commit

Permalink
[test] Disable browserstack for PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Aug 30, 2021
1 parent 51968be commit e42efab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
version: 2.1

parameters:
browserstack-force:
description: Whether to force browserstack usage. We have limited resources on browserstack so the pipeline might decide to skip browserstack if this parameter isn't set to true.
type: boolean
default: false
react-dist-tag:
description: The dist-tag of react to be used
type: string
Expand All @@ -24,6 +28,7 @@ defaults: &defaults
# Keep in sync with "Save playwright cache"
PLAYWRIGHT_BROWSERS_PATH: /tmp/pw-browsers
# expose it globally otherwise we have to thread it from each job to the install command
BROWSERSTACK_FORCE: << pipeline.parameters.browserstack-force >>
REACT_DIST_TAG: << parameters.react-dist-tag >>
TEST_GATE: << parameters.test-gate >>
working_directory: /tmp/material-ui
Expand Down
8 changes: 7 additions & 1 deletion test/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const path = require('path');
const webpack = require('webpack');

const CI = Boolean(process.env.CI);
const isPR = Boolean(process.env.CIRCLE_PR_NUMBER);

let build = `material-ui local ${new Date().toISOString()}`;

Expand All @@ -15,6 +16,11 @@ if (process.env.CIRCLECI) {
}

const browserStack = {
// |commits in PRs| >> |Merged commits|.
// Since we have limited ressources on browserstack we often time out on PRs.
// However, browserstack rarely fails with a true-positive so we use it as a stop gap for release not merge.
// But always enable it locally since people usually have to explicitly have to expose their browserstack access key anyway.
enabled: !CI || !isPR || process.env.BROWSERSTACK_FORCE === 'true',
username: process.env.BROWSERSTACK_USERNAME,
accessKey: process.env.BROWSERSTACK_ACCESS_KEY,
build,
Expand Down Expand Up @@ -153,7 +159,7 @@ module.exports = function setKarmaConfig(config) {

let newConfig = baseConfig;

if (browserStack.accessKey) {
if (browserStack.enabled && browserStack.accessKey) {
newConfig = {
...baseConfig,
browserStack,
Expand Down

0 comments on commit e42efab

Please sign in to comment.