Migrate our tests to use github actions (#4614) (#4626)

This commit is contained in:
alschmiedt
2021-02-09 12:57:27 -08:00
committed by GitHub
parent edd475f37b
commit 791ce2b7fb
6 changed files with 54 additions and 39 deletions

41
.github/workflows/build.yml vendored Normal file
View File

@@ -0,0 +1,41 @@
# This workflow will do a clean install, start the selenium server, and run
# all of our tests.
name: Node.js CI
on: push
jobs:
build:
# TODO (#2114): re-enable osx build.
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 12.x, 14.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Npm Install
run: npm install
- name: Linux Test Setup
if: runner.os == 'Linux'
run: source ./tests/scripts/setup_linux_env.sh
- name: MacOS Test Setup
if: runner.os == 'macOS'
run: source ./tests/scripts/setup_osx_env.sh
- name: Run
run: npm run test:run
env:
CI: true

View File

@@ -1,25 +0,0 @@
language: node_js
os: linux
dist: xenial
node_js:
- 10
- 12
- 14
addons:
chrome: stable
firefox: latest
# TODO (#2114): re-enable osx build.
# - os: osx
# node_js: stable
# osx_image: xcode8.3
# addons:
# firefox: latest
env:
- TRAVIS_CI=true
before_script:
- export DISPLAY=:99.0
- if [ "${TRAVIS_OS_NAME}" == "linux" ]; then ( tests/scripts/setup_linux_env.sh ) fi
- if [ "${TRAVIS_OS_NAME}" == "osx" ]; then ( tests/scripts/setup_osx_env.sh ) fi
- sleep 2
script:
- npm run test:run

View File

@@ -44,8 +44,8 @@ async function runGeneratorsInBrowser() {
},
path: '/wd/hub'
};
// Run in headless mode on Travis.
if (process.env.TRAVIS_CI) {
// Run in headless mode on Github Actions.
if (process.env.CI) {
options.capabilities['moz:firefoxOptions'] = {
args: ['-headless']
};

View File

@@ -24,8 +24,8 @@ async function runMochaTestsInBrowser() {
},
path: '/wd/hub'
};
// Run in headless mode on Travis.
if (process.env.TRAVIS_CI) {
// Run in headless mode on Github Actions.
if (process.env.CI) {
options.capabilities['goog:chromeOptions'] = {
args: ['--headless', '--no-sandbox', '--disable-dev-shm-usage']
};

View File

@@ -1,18 +1,17 @@
#!/bin/bash
if [ ! -z $TRAVIS ]; then echo "Executing run_all_tests.sh from $(pwd)"; fi
if [ ! -z $CI ]; then echo "Executing run_all_tests.sh from $(pwd)"; fi
# ANSI colors
BOLD_GREEN='\033[1;32m'
BOLD_RED='\033[1;31m'
ANSI_RESET='\033[0m'
travis_fold () {
gh_actions_fold () {
local startOrEnd=$1 # Either "start" or "end"
local id=$2 # The fold id. No spaces.
if [ ! -z $TRAVIS ]; then
echo "travis_fold:$startOrEnd:$id"
if [ ! -z $CI ]; then
echo "::$startOrEnd::"
fi
}
@@ -37,10 +36,10 @@ run_test_command () {
echo "======================================="
echo "== $test_id"
travis_fold start $test_id
gh_actions_fold group
$command
local test_result=$?
travis_fold end $test_id
gh_actions_fold endgroup
if [ $test_result -eq 0 ]; then
echo -e "${BOLD_GREEN}SUCCESS:${ANSI_RESET} ${test_id}"
else

View File

@@ -1,8 +1,8 @@
#!/bin/bash
if [ "${TRAVIS_OS_NAME}" == "linux" ]
if [ "${RUNNER_OS}" == "Linux" ]
then
export CHROME_BIN="/usr/bin/google-chrome"
sh -e /etc/init.d/xvfb start &
Xvfb :99 &
export DISPLAY=:99 &
npm run test:prepare > /dev/null &
fi