Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1771514

Browse files
authored
Merge pull request #1271 from basecamp/flavorjones/ci-sauce-labs
ci: stabilize Sauce Labs with SC5 tunnel
2 parents 93f5270 + 04f803e commit 1771514

2 files changed

Lines changed: 69 additions & 24 deletions

File tree

.github/workflows/ci.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ on:
1111
types: [opened, synchronize]
1212
branches: [ '*' ]
1313

14+
env:
15+
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
16+
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
17+
SAUCE_REGION: us
18+
SAUCE_TUNNEL_IDENTIFIER: trix-${{ github.run_id }}
19+
1420
jobs:
1521
build:
1622
name: Browser tests
@@ -23,6 +29,15 @@ jobs:
2329
cache: "yarn"
2430
- name: Install Dependencies
2531
run: yarn install --frozen-lockfile
32+
- name: Start Sauce Connect
33+
if: ${{ env.SAUCE_ACCESS_KEY != '' }}
34+
uses: saucelabs/sauce-connect-action@v3
35+
with:
36+
username: ${{ env.SAUCE_USERNAME }}
37+
accessKey: ${{ env.SAUCE_ACCESS_KEY }}
38+
tunnelName: ${{ env.SAUCE_TUNNEL_IDENTIFIER }}
39+
region: ${{ env.SAUCE_REGION }}
40+
proxyLocalhost: allow
2641
- run: bin/ci
2742
- name: Fail when generated npm changes are not checked-in
2843
run: |
@@ -117,7 +132,3 @@ jobs:
117132
continue-on-error: ${{ matrix.experimental || false }}
118133
working-directory: "./action_text-trix"
119134
run: bin/rails test:all
120-
121-
env:
122-
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
123-
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}

karma.conf.js

Lines changed: 54 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ const config = {
1515
}
1616
},
1717

18-
hostname: "0.0.0.0",
18+
hostname: process.env.SAUCE_ACCESS_KEY ? "localhost" : "0.0.0.0",
19+
listenAddress: "0.0.0.0",
1920

2021
singleRun: true,
2122
autoWatch: false,
@@ -30,17 +31,27 @@ const config = {
3031
/* eslint camelcase: "off", */
3132

3233
if (process.env.SAUCE_ACCESS_KEY) {
34+
const sauceRegion = process.env.SAUCE_REGION || "us"
35+
const sauceConnectVersion = process.env.SAUCE_CONNECT_VERSION || "4.9.2"
36+
const sauceTunnelIdentifier = process.env.SAUCE_TUNNEL_IDENTIFIER
37+
3338
config.customLaunchers = {
3439
sl_chrome_latest: {
3540
base: "SauceLabs",
3641
browserName: "chrome",
37-
version: "latest"
42+
browserVersion: "latest",
43+
"sauce:options": {
44+
tunnelName: sauceTunnelIdentifier
45+
}
3846
},
3947
sl_chrome_latest_i8n: {
4048
base: "SauceLabs",
4149
browserName: "chrome",
42-
version: "latest",
43-
chromeOptions: {
50+
browserVersion: "latest",
51+
"sauce:options": {
52+
tunnelName: sauceTunnelIdentifier
53+
},
54+
"goog:chromeOptions": {
4455
args: [ "--lang=tr" ]
4556
}
4657
},
@@ -51,28 +62,45 @@ if (process.env.SAUCE_ACCESS_KEY) {
5162
base: "SauceLabs",
5263
browserName: "firefox",
5364
browserVersion: "latest",
65+
"sauce:options": {
66+
tunnelName: sauceTunnelIdentifier
67+
},
5468
"moz:debuggerAddress": true
5569
},
5670
sl_edge_latest: {
5771
base: "SauceLabs",
5872
browserName: "microsoftedge",
59-
platform: "Windows 10",
60-
version: "latest"
61-
},
62-
sl_android_9: {
63-
base: "SauceLabs",
64-
browserName: "chrome",
65-
platform: "android",
66-
device: "Android GoogleAPI Emulator",
67-
version: "9.0"
73+
platformName: "Windows 10",
74+
browserVersion: "latest",
75+
"sauce:options": {
76+
tunnelName: sauceTunnelIdentifier
77+
}
6878
},
69-
sl_android_latest: {
70-
base: "SauceLabs",
71-
browserName: "chrome",
72-
platform: "android",
73-
device: "Android GoogleAPI Emulator",
74-
version: "12.0"
75-
}
79+
// // Android is commented out because with the upgrade to SC5 I couldn't figure out how to get
80+
// // the Android VM to connect through the tunnel ("localhost" in the VM resolves to the VM
81+
// // itself, not the host machine). Maybe someone cleverer than me can figure this out.
82+
// sl_android_9: {
83+
// base: "SauceLabs",
84+
// browserName: "chrome",
85+
// platformName: "Android",
86+
// browserVersion: "latest",
87+
// "appium:deviceName": "Android GoogleAPI Emulator",
88+
// "appium:platformVersion": "9.0",
89+
// "sauce:options": {
90+
// tunnelName: sauceTunnelIdentifier
91+
// }
92+
// },
93+
// sl_android_latest: {
94+
// base: "SauceLabs",
95+
// browserName: "chrome",
96+
// platformName: "Android",
97+
// browserVersion: "latest",
98+
// "appium:deviceName": "Android GoogleAPI Emulator",
99+
// "appium:platformVersion": "12.0",
100+
// "sauce:options": {
101+
// tunnelName: sauceTunnelIdentifier
102+
// }
103+
// }
76104
}
77105

78106
config.browsers = Object.keys(config.customLaunchers)
@@ -85,6 +113,12 @@ if (process.env.SAUCE_ACCESS_KEY) {
85113
commandTimeout: 600,
86114
maxDuration: 900,
87115
build: buildId(),
116+
region: sauceRegion,
117+
startConnect: !sauceTunnelIdentifier,
118+
connectOptions: {
119+
scVersion: sauceConnectVersion,
120+
tunnelIdentifier: sauceTunnelIdentifier
121+
}
88122
}
89123
}
90124

0 commit comments

Comments
 (0)