-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: move CI builds from travis-ci.org to GitHub actions (#137)
- Loading branch information
Viktor Lukashov
authored
Jul 6, 2021
1 parent
83a3eff
commit a017878
Showing
3 changed files
with
103 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: Unit Tests | ||
|
||
# all pull requests | ||
on: pull_request | ||
|
||
jobs: | ||
unit-tests-p2: | ||
name: Polymer 2 on the CI agent | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Node 12.x | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 12.x | ||
|
||
- name: Check out the source code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install global npm dependencies | ||
# bower is needed to run 'bower install' | ||
# polymer-cli is needed to run the lint step | ||
# web-component-tester is needed to run the test step | ||
run: "npm install --quiet --no-progress --global bower polymer-cli web-component-tester" | ||
|
||
- name: Install project npm dependencies | ||
run: "npm install --quiet --no-progress" | ||
|
||
- name: Install project Bower dependencies | ||
run: "bower install --quiet" | ||
|
||
- name: Run automated magi-cli checks | ||
run: "npm run check" | ||
|
||
- name: Run a linter | ||
run: "npm run lint" | ||
|
||
# the full set of environments is tested with Polymer 3 below | ||
- name: Run unit tests locally (in the VM instance running this job) | ||
run: "xvfb-run -s '-screen 0 1024x768x24' wct" | ||
|
||
unit-tests-p3: | ||
name: Polymer 3 on SauceLabs | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up Node 12.x | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 12.x | ||
|
||
- name: Check out the (Polymer 2) source code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install global npm dependencies | ||
# magi-cli, bower and polymer-modulizer are needed to run the Polymer 3 conversion step | ||
# web-component-tester is needed to run the test step | ||
run: "npm install --quiet --no-progress --global bower magi-cli web-component-tester polymer-modulizer" | ||
|
||
- name: Convert the source code to Polymer 3 | ||
run: | | ||
git config --local user.email "github-actions[bot]@users.noreply.github.com" | ||
git config --local user.name "github-actions[bot]" | ||
magi p3-convert --out . --import-style=name | ||
# Using yarn instead of npm here to check that the dependency tree does not have two | ||
# versions of the same component. With P2 / Bower that is checked automatically, but | ||
# with P3 / npm it is not. | ||
- name: Install project npm dependencies | ||
run: "yarn install --flat" | ||
|
||
# workaround for running tests on Android on SauceLabs (see wct.conf.js) | ||
- name: Add 'localhost-for-saucelabs' to /etc/hosts | ||
run: echo "127.0.0.1 localhost-for-saucelabs" | sudo tee -a /etc/hosts | ||
|
||
- name: Run unit tests on SauceLabs | ||
run: "wct --npm --env saucelabs" | ||
env: | ||
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} | ||
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,38 @@ | ||
var envIndex = process.argv.indexOf('--env') + 1; | ||
var env = envIndex ? process.argv[envIndex] : undefined; | ||
|
||
// workaround for Android 7+ blocking all HTTP traffic | ||
// see https://wiki.saucelabs.com/display/DOCS/Known+Issues | ||
// add it to your own local `/etc/hosts` to run SauceLabs tests locally | ||
var tunneledLocalhost = 'localhost-for-saucelabs'; | ||
|
||
module.exports = { | ||
registerHooks: function(context) { | ||
const saucelabsPlatformsMobile = [ | ||
'iOS Simulator/[email protected]', | ||
'iOS Simulator/[email protected]' | ||
]; | ||
|
||
const saucelabsPlatformsMicrosoft = [ | ||
const testBrowsers = [ | ||
{ | ||
deviceName: 'Android GoogleAPI Emulator', | ||
platformName: 'Android', | ||
platformVersion: '11.0', | ||
browserName: 'Chrome', | ||
}, | ||
'iOS Simulator/[email protected]', // should be 9.x, but SauceLabs does not provide that | ||
'macOS 11/safari@latest', | ||
'Windows 10/microsoftedge@latest', | ||
'Windows 10/microsoftedge@18', | ||
'Windows 10/internet explorer@11' | ||
]; | ||
|
||
const saucelabsPlatformsDesktop = [ | ||
'macOS 10.13/safari@latest' | ||
]; | ||
|
||
const saucelabsPlatforms = [ | ||
...saucelabsPlatformsMobile, | ||
...saucelabsPlatformsMicrosoft, | ||
...saucelabsPlatformsDesktop | ||
]; | ||
|
||
const cronPlatforms = [ | ||
'iOS Simulator/[email protected]', | ||
'iOS Simulator/[email protected]', | ||
'Windows 10/internet explorer@11', | ||
'Windows 10/chrome@latest', | ||
'Windows 10/firefox@latest' | ||
'Windows 10/firefox@latest', | ||
'Windows 10/firefox@78', // latest ESR as of 2021-06-30 | ||
]; | ||
|
||
if (env === 'saucelabs') { | ||
context.options.plugins.sauce.browsers = saucelabsPlatforms; | ||
} else if (env === 'saucelabs-cron') { | ||
context.options.plugins.sauce.browsers = cronPlatforms; | ||
context.options.webserver = context.options.webserver || {}; | ||
context.options.webserver.hostname = tunneledLocalhost; | ||
context.options.plugins.sauce.tunnelOptions = { | ||
tunnelDomains: tunneledLocalhost | ||
}; | ||
|
||
context.options.plugins.sauce.browsers = testBrowsers; | ||
} | ||
} | ||
}; |