Skip to content

Commit

Permalink
run browser tests on GHA
Browse files Browse the repository at this point in the history
- removes travis config
  • Loading branch information
boneskull committed Nov 11, 2020
1 parent b1f26e2 commit 025fc2e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 75 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/mocha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,29 @@ jobs:
uses: coverallsapp/github-action@master
with:
github-token: '${{ secrets.GITHUB_TOKEN }}'
test-browser:
# TODO: configure to retain build artifacts in `.karma/` dir
name: 'Browser Tests'
needs: smoke
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v1
with:
node-version: 14
- uses: actions/checkout@v2
- name: 'Cache node_modules'
uses: actions/cache@v2
with:
path: '~/.npm'
# this key is different than above, since we are running scripts
# (builds, postinstall lifecycle hooks, etc.)
key: "ubuntu-latest-node-full-v14-${{ hashFiles('**/package-lock.json') }}"
restore-keys: |
ubuntu-latest-node-full-v14-
- name: Install Dependencies
run: npm ci
- name: Run Browser Tests
run: npm start test.browser
env:
SAUCE_USERNAME: '${{secrets.SAUCE_USERNAME}}'
SAUCE_ACCESS_KEY: '${{secrets.SAUCE_ACCESS_KEY}}'
46 changes: 0 additions & 46 deletions .travis.yml

This file was deleted.

41 changes: 12 additions & 29 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,35 +86,27 @@ module.exports = config => {
// configuration for CI mode
if (env.CI) {
console.error('CI mode enabled');
if (env.TRAVIS) {
console.error('Travis-CI detected');
bundleDirPath = path.join(BASE_BUNDLE_DIR_PATH, env.TRAVIS_BUILD_ID);
if (env.SAUCE_USERNAME && env.SAUCE_ACCESS_KEY) {
// correlate build/tunnel with Travis
sauceConfig = {
build: `TRAVIS #${env.TRAVIS_BUILD_NUMBER} (${env.TRAVIS_BUILD_ID})`,
tunnelIdentifier: env.TRAVIS_JOB_NUMBER,
startConnect: false
};
console.error('Configured SauceLabs');
} else {
console.error('No SauceLabs credentials present');
}
} else if (env.APPVEYOR) {
throw new Error('no browser tests should run on AppVeyor!');
if (env.GITHUB_RUN_ID) {
console.error('Github Actions detected');
bundleDirPath = path.join(
BASE_BUNDLE_DIR_PATH,
`github-${env.GITHUB_RUN_ID}_${env.GITHUB_RUN_NUMBER}`
);
sauceConfig = {};
} else {
console.error(`Local environment (${hostname}) detected`);
// don't need to run sauce from Windows CI b/c travis does it.
if (env.SAUCE_USERNAME || env.SAUCE_ACCESS_KEY) {
const id = `${hostname} (${Date.now()})`;
sauceConfig = {
build: id,
tunnelIdentifier: id,
startConnect: true
tunnelIdentifier: id
};
console.error('Configured SauceLabs');
} else {
console.error('No SauceLabs credentials present');
console.error(
'No SauceLabs credentials present; set SAUCE_USERNAME and SAUCE_ACCESS_KEY env vars'
);
}
}
}
Expand Down Expand Up @@ -199,16 +191,7 @@ const addSauceTests = (cfg, sauceLabs) => {
...cfg.customLaunchers,
...customLaunchers
},
sauceLabs: {
...sauceLabs,
public: 'public',
connectOptions: {
connectRetries: 2,
connectRetryTimeout: 30000,
detached: sauceLabs.startConnect,
tunnelIdentifier: sauceLabs.tunnelIdentifier
}
},
sauceLabs,
concurrency: Infinity,
retryLimit: 1,
captureTimeout: 120000,
Expand Down

0 comments on commit 025fc2e

Please sign in to comment.