File tree 5 files changed +56
-29
lines changed
5 files changed +56
-29
lines changed Original file line number Diff line number Diff line change
1
+ name : Test
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - " **"
7
+ pull_request :
8
+ branches :
9
+ - " **"
10
+
11
+ env :
12
+ SAUCE_USERNAME : ${{secrets.SAUCE_USERNAME}}
13
+ SAUCE_ACCESS_KEY : ${{secrets.SAUCE_ACCESS_KEY}}
14
+
15
+ jobs :
16
+ test :
17
+ runs-on : ubuntu-latest
18
+ steps :
19
+ - name : Checkout
20
+ uses : actions/checkout@v2
21
+ - name : Setup node
22
+ uses : actions/setup-node@v2-beta
23
+ with :
24
+ node-version : ' 14'
25
+ check-latest : true
26
+ - name : node_modules cache
27
+ id : node_modules_cache
28
+ uses : actions/cache@v2
29
+ with :
30
+ path : ./node_modules
31
+ key : ${{ runner.os }}-14-node_modules-${{ hashFiles('package-lock.json') }}
32
+ restore-keys : |
33
+ ${{ runner.os }}-14-node_modules-
34
+ - name : NPM install
35
+ if : steps.node_modules_cache.outputs.cache-hit != 'true'
36
+ run : npm ci
37
+ - name : Build & run tests
38
+ run : |
39
+ ./buildtools/sauce_connect.sh &
40
+ npm test -- --saucelabs
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 23
23
# Can take up to two arguments:
24
24
# --saucelabs: Use SauceLabs instead of phantomJS.
25
25
# --tunnelIdentifier=<tunnelId>: when using SauceLabs, specify the tunnel
26
- # identifier. Otherwise, uses the environment variable TRAVIS_JOB_NUMBER .
26
+ # identifier. Otherwise, uses the environment variable GITHUB_RUN_ID .
27
27
#
28
28
# Prefer to use the `npm test` command as explained below.
29
29
#
45
45
# This will start the HTTP Server locally, and connect through SauceConnect
46
46
# to SauceLabs remote browsers instances.
47
47
#
48
- # Travis will run `npm test -- --saucelabs`.
48
+ # Github Actions will run `npm test -- --saucelabs`.
49
49
50
50
cd " $( dirname $( dirname " $0 " ) ) "
51
51
BIN_PATH=" ./node_modules/.bin"
@@ -71,8 +71,8 @@ trap killServer EXIT
71
71
# If --saucelabs option is passed, forward it to the protractor command adding
72
72
# the second argument that is required for local SauceLabs test run.
73
73
if [[ $1 = " --saucelabs" ]]; then
74
- # Enable saucelabs tests only when running locally or when Travis enviroment vars are accessible.
75
- if [[ ( " $TRAVIS " = true && " $TRAVIS_SECURE_ENV_VARS " = true ) || ( -z " $TRAVIS " ) ]]; then
74
+ # Enable saucelabs tests only when running locally or when CI enviroment vars are accessible.
75
+ if [[ (( ! - z " $SAUCE_USERNAME ") && ( ! - z " $SAUCE_ACCESS_KEY " )) || ( -z " $CI " ) ]]; then
76
76
seleniumStarted=false
77
77
sleep 2
78
78
echo " Using SauceLabs."
Original file line number Diff line number Diff line change 17
17
# Download and install SauceConnect under Linux 64-bit. To be used when testing
18
18
# with SauceLabs locally. See the instructions in protractor.conf.js file.
19
19
#
20
- # It should not be used on Travis. Travis already handles SauceConnect.
21
- #
22
20
# Script copied from the Closure Library repository:
23
21
# https://github.com/google/closure-library/blob/master/scripts/ci/sauce_connect.sh
24
22
#
25
23
26
24
# Setup and start Sauce Connect locally.
27
- CONNECT_URL=" https://saucelabs.com/downloads/sc-4.4.1 -linux.tar.gz"
25
+ CONNECT_URL=" https://saucelabs.com/downloads/sc-4.6.5 -linux.tar.gz"
28
26
CONNECT_DIR=" /tmp/sauce-connect-$RANDOM "
29
27
CONNECT_DOWNLOAD=" sc-latest-linux.tar.gz"
30
28
@@ -46,8 +44,13 @@ function removeFiles() {
46
44
47
45
trap removeFiles EXIT
48
46
49
- # This will be used by Protractor to connect to SauceConnect.
50
- TUNNEL_IDENTIFIER=" tunnelId-$RANDOM "
47
+ # This will be used by Protractor to connect to SauceConnect
48
+ if [[(! -z " $GITHUB_RUN_ID " )]]; then
49
+ TUNNEL_IDENTIFIER=" $GITHUB_RUN_ID "
50
+ else
51
+ TUNNEL_IDENTIFIER=" tunnelId-$RANDOM "
52
+ fi
53
+
51
54
echo " "
52
55
echo " ========================================================================="
53
56
echo " Tunnel Identifier to pass to Protractor:"
Original file line number Diff line number Diff line change 36
36
* This will start the HTTP Server locally, and connect through SauceConnect
37
37
* to SauceLabs remote browsers instances.
38
38
*
39
- * Travis will run `npm test -- --saucelabs`.
39
+ * Github will run `npm test -- --saucelabs`.
40
40
*/
41
41
42
42
// Common configuration.
@@ -60,10 +60,10 @@ config = {
60
60
var arguments = process . argv . slice ( 3 ) ;
61
61
62
62
// Default options: run tests locally (saucelabs false) and use the env variable
63
- // TRAVIS_JOB_NUMBER to get the tunnel identifier, when using saucelabs.
63
+ // GITHUB_RUN_ID to get the tunnel identifier, when using saucelabs.
64
64
var options = {
65
65
saucelabs : false ,
66
- tunnelIdentifier : process . env . TRAVIS_JOB_NUMBER
66
+ tunnelIdentifier : process . env . GITHUB_RUN_ID
67
67
} ;
68
68
69
69
for ( var i = 0 ; i < arguments . length ; i ++ ) {
@@ -77,7 +77,7 @@ for (var i = 0; i < arguments.length; i++) {
77
77
78
78
if ( options . saucelabs ) {
79
79
if ( ! options . tunnelIdentifier ) {
80
- throw 'No tunnel identifier given! Either the TRAVIS_JOB_NUMBER is not ' +
80
+ throw 'No tunnel identifier given! Either the GITHUB_RUN_ID is not ' +
81
81
'set, or you haven\'t passed the --tunnelIdentifier=xxx argument.' ;
82
82
}
83
83
// SauceLabs configuration.
You can’t perform that action at this time.
0 commit comments