Skip to content

Commit 025fc2e

Browse files
committed
run browser tests on GHA
- removes travis config
1 parent b1f26e2 commit 025fc2e

File tree

3 files changed

+38
-75
lines changed

3 files changed

+38
-75
lines changed

.github/workflows/mocha.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,3 +198,29 @@ jobs:
198198
uses: coverallsapp/github-action@master
199199
with:
200200
github-token: '${{ secrets.GITHUB_TOKEN }}'
201+
test-browser:
202+
# TODO: configure to retain build artifacts in `.karma/` dir
203+
name: 'Browser Tests'
204+
needs: smoke
205+
runs-on: ubuntu-latest
206+
steps:
207+
- uses: actions/setup-node@v1
208+
with:
209+
node-version: 14
210+
- uses: actions/checkout@v2
211+
- name: 'Cache node_modules'
212+
uses: actions/cache@v2
213+
with:
214+
path: '~/.npm'
215+
# this key is different than above, since we are running scripts
216+
# (builds, postinstall lifecycle hooks, etc.)
217+
key: "ubuntu-latest-node-full-v14-${{ hashFiles('**/package-lock.json') }}"
218+
restore-keys: |
219+
ubuntu-latest-node-full-v14-
220+
- name: Install Dependencies
221+
run: npm ci
222+
- name: Run Browser Tests
223+
run: npm start test.browser
224+
env:
225+
SAUCE_USERNAME: '${{secrets.SAUCE_USERNAME}}'
226+
SAUCE_ACCESS_KEY: '${{secrets.SAUCE_ACCESS_KEY}}'

.travis.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

karma.conf.js

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -86,35 +86,27 @@ module.exports = config => {
8686
// configuration for CI mode
8787
if (env.CI) {
8888
console.error('CI mode enabled');
89-
if (env.TRAVIS) {
90-
console.error('Travis-CI detected');
91-
bundleDirPath = path.join(BASE_BUNDLE_DIR_PATH, env.TRAVIS_BUILD_ID);
92-
if (env.SAUCE_USERNAME && env.SAUCE_ACCESS_KEY) {
93-
// correlate build/tunnel with Travis
94-
sauceConfig = {
95-
build: `TRAVIS #${env.TRAVIS_BUILD_NUMBER} (${env.TRAVIS_BUILD_ID})`,
96-
tunnelIdentifier: env.TRAVIS_JOB_NUMBER,
97-
startConnect: false
98-
};
99-
console.error('Configured SauceLabs');
100-
} else {
101-
console.error('No SauceLabs credentials present');
102-
}
103-
} else if (env.APPVEYOR) {
104-
throw new Error('no browser tests should run on AppVeyor!');
89+
if (env.GITHUB_RUN_ID) {
90+
console.error('Github Actions detected');
91+
bundleDirPath = path.join(
92+
BASE_BUNDLE_DIR_PATH,
93+
`github-${env.GITHUB_RUN_ID}_${env.GITHUB_RUN_NUMBER}`
94+
);
95+
sauceConfig = {};
10596
} else {
10697
console.error(`Local environment (${hostname}) detected`);
10798
// don't need to run sauce from Windows CI b/c travis does it.
10899
if (env.SAUCE_USERNAME || env.SAUCE_ACCESS_KEY) {
109100
const id = `${hostname} (${Date.now()})`;
110101
sauceConfig = {
111102
build: id,
112-
tunnelIdentifier: id,
113-
startConnect: true
103+
tunnelIdentifier: id
114104
};
115105
console.error('Configured SauceLabs');
116106
} else {
117-
console.error('No SauceLabs credentials present');
107+
console.error(
108+
'No SauceLabs credentials present; set SAUCE_USERNAME and SAUCE_ACCESS_KEY env vars'
109+
);
118110
}
119111
}
120112
}
@@ -199,16 +191,7 @@ const addSauceTests = (cfg, sauceLabs) => {
199191
...cfg.customLaunchers,
200192
...customLaunchers
201193
},
202-
sauceLabs: {
203-
...sauceLabs,
204-
public: 'public',
205-
connectOptions: {
206-
connectRetries: 2,
207-
connectRetryTimeout: 30000,
208-
detached: sauceLabs.startConnect,
209-
tunnelIdentifier: sauceLabs.tunnelIdentifier
210-
}
211-
},
194+
sauceLabs,
212195
concurrency: Infinity,
213196
retryLimit: 1,
214197
captureTimeout: 120000,

0 commit comments

Comments
 (0)