chore(ci): move over to CircleCi config
This commit gets rid of all references to Travis and, belatedly, Jenkins. Now all CI is done on CircleCI and releases are run locally. The CI no longer updates the docs and code.angularjs.org for jobs that are not on the `master` branch. During releases, the docs and code should be uploaded manually.
This commit is contained in:
@@ -0,0 +1,380 @@
|
||||
# Configuration file for https://circleci.com/gh/angular/angular
|
||||
|
||||
# Note: YAML anchors allow an object to be re-used, reducing duplication.
|
||||
# The ampersand declares an alias for an object, then later the `<<: *name`
|
||||
# syntax dereferences it.
|
||||
# See http://blog.daemonl.com/2016/02/yaml.html
|
||||
# To validate changes, use an online parser, eg.
|
||||
# http://yaml-online-parser.appspot.com/
|
||||
|
||||
# CircleCI configuration version
|
||||
# Version 2.1 allows for extra config reuse features
|
||||
# https://circleci.com/docs/2.0/reusing-config/#getting-started-with-config-reuse
|
||||
version: 2.1
|
||||
|
||||
# Workspace initially persisted by the `setup` job, and then enhanced by `build-npm-packages` and
|
||||
# `build-ivy-npm-packages`.
|
||||
# https://circleci.com/docs/2.0/workflows/#using-workspaces-to-share-data-among-jobs
|
||||
# https://circleci.com/blog/deep-diving-into-circleci-workspaces/
|
||||
var_workspace_location: &workspace_location ~/
|
||||
|
||||
# Filter to run a job on builds for pull requests only.
|
||||
var_only_on_pull_requests: &only_on_pull_requests
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- /pull\/\d+/
|
||||
|
||||
# Filter to skip a job on builds for pull requests.
|
||||
var_skip_on_pull_requests: &skip_on_pull_requests
|
||||
filters:
|
||||
branches:
|
||||
ignore:
|
||||
- /pull\/\d+/
|
||||
|
||||
# Filter to run a job on builds for the master branch only.
|
||||
var_only_on_master: &only_on_master
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
# Executor Definitions
|
||||
# https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-executors
|
||||
# **NOTE 1**: Pin to exact images using an ID (SHA). See https://circleci.com/docs/2.0/circleci-images/#using-a-docker-image-id-to-pin-an-image-to-a-fixed-version.
|
||||
# (Using the tag in not necessary when pinning by ID, but include it anyway for documentation purposes.)
|
||||
# **NOTE 2**: If you change the version of the docker images, also change the `cache_key` suffix.
|
||||
# **NOTE 3**: If you change the version of the `*-browsers` docker image, make sure the
|
||||
# `--versions.chrome` arg in `integration/bazel-schematics/test.sh` specifies a
|
||||
# ChromeDriver version that is compatible with the Chrome version in the image.
|
||||
executors:
|
||||
default-executor:
|
||||
parameters:
|
||||
resource_class:
|
||||
type: string
|
||||
default: medium
|
||||
docker:
|
||||
- image: circleci/node:12.16.3
|
||||
resource_class: << parameters.resource_class >>
|
||||
working_directory: ~/ng
|
||||
cloud-sdk:
|
||||
description: The docker container to use when running gcp-gcs commands
|
||||
docker:
|
||||
- image: google/cloud-sdk:alpine
|
||||
|
||||
|
||||
# Command Definitions
|
||||
# https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-commands
|
||||
commands:
|
||||
custom_attach_workspace:
|
||||
description: Attach workspace at a predefined location
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: *workspace_location
|
||||
|
||||
# Install shared libs used by Chrome.
|
||||
install_chrome_libs:
|
||||
description: Install shared Chrome libs
|
||||
steps:
|
||||
- run:
|
||||
name: Install shared Chrome libs
|
||||
command: |
|
||||
sudo apt-get update
|
||||
# Install GTK+ graphical user interface (libgtk-3-0), advanced linux sound architecture (libasound2)
|
||||
# and network security service libraries (libnss3) & X11 Screen Saver extension library (libssx1)
|
||||
# which are dependendies of chrome & needed for karma & protractor headless chrome tests.
|
||||
# This is a very small install which takes around 7s in comparing to using the full
|
||||
# circleci/node:x.x.x-browsers image.
|
||||
sudo apt-get -y install libgtk-3-0 libasound2 libnss3 libxss1
|
||||
|
||||
install_java:
|
||||
description: Install java
|
||||
steps:
|
||||
- run:
|
||||
name: Install java
|
||||
command: |
|
||||
sudo apt-get update
|
||||
# Install java runtime
|
||||
sudo apt-get install default-jre
|
||||
|
||||
# Initializes the CI environment by setting up common environment variables.
|
||||
init_environment:
|
||||
description: Initializing environment (setting up variables)
|
||||
steps:
|
||||
- run:
|
||||
name: Set up environment
|
||||
environment:
|
||||
CIRCLE_GIT_BASE_REVISION: << pipeline.git.base_revision >>
|
||||
CIRCLE_GIT_REVISION: << pipeline.git.revision >>
|
||||
command: ./.circleci/env.sh
|
||||
- run:
|
||||
# Configure git as the CircleCI `checkout` command does.
|
||||
# This is needed because we only checkout on the setup job.
|
||||
# Add GitHub to known hosts
|
||||
name: Configure git
|
||||
command: |
|
||||
mkdir -p ~/.ssh
|
||||
echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==' >> ~/.ssh/known_hosts
|
||||
git config --global url."ssh://git@github.com".insteadOf "https://github.com" || true
|
||||
git config --global gc.auto 0 || true
|
||||
- install_java
|
||||
|
||||
init_saucelabs_environment:
|
||||
description: Sets up a domain that resolves to the local host.
|
||||
steps:
|
||||
- run:
|
||||
name: Preparing environment for running tests on Saucelabs.
|
||||
command: |
|
||||
# For SauceLabs jobs, we set up a domain which resolves to the machine which launched
|
||||
# the tunnel. We do this because devices are sometimes not able to properly resolve
|
||||
# `localhost` or `127.0.0.1` through the SauceLabs tunnel. Using a domain that does not
|
||||
# resolve to anything on SauceLabs VMs ensures that such requests are always resolved
|
||||
# through the tunnel, and resolve to the actual tunnel host machine (i.e. the CircleCI VM).
|
||||
# More context can be found in: https://github.com/angular/angular/pull/35171.
|
||||
setPublicVar SAUCE_LOCALHOST_ALIAS_DOMAIN "angular-ci.local"
|
||||
setSecretVar SAUCE_ACCESS_KEY $(echo $SAUCE_ACCESS_KEY | rev)
|
||||
- run:
|
||||
# Sets up a local domain in the machine's host file that resolves to the local
|
||||
# host. This domain is helpful in Saucelabs tests where devices are not able to
|
||||
# properly resolve `localhost` or `127.0.0.1` through the sauce-connect tunnel.
|
||||
name: Setting up alias domain for local host.
|
||||
command: echo "127.0.0.1 $SAUCE_LOCALHOST_ALIAS_DOMAIN" | sudo tee -a /etc/hosts
|
||||
|
||||
start_saucelabs:
|
||||
steps:
|
||||
- run:
|
||||
name: Starting Saucelabs tunnel service
|
||||
command: ./lib/saucelabs/sauce-service.sh start-ready-wait
|
||||
|
||||
stop_saucelabs:
|
||||
steps:
|
||||
- run:
|
||||
name: Stopping Saucelabs tunnel service
|
||||
command: ./lib/saucelabs/sauce-service.sh stop
|
||||
|
||||
|
||||
run_e2e_tests:
|
||||
parameters:
|
||||
specs:
|
||||
type: string
|
||||
steps:
|
||||
- custom_attach_workspace
|
||||
- init_environment
|
||||
- init_saucelabs_environment
|
||||
- start_saucelabs
|
||||
- run:
|
||||
command: yarn grunt test:circleci-protractor --specs="<< parameters.specs >>"
|
||||
no_output_timeout: 30m
|
||||
- stop_saucelabs
|
||||
|
||||
run_e2e_tests_jquery:
|
||||
parameters:
|
||||
specs:
|
||||
type: string
|
||||
steps:
|
||||
- custom_attach_workspace
|
||||
- init_environment
|
||||
- init_saucelabs_environment
|
||||
- start_saucelabs
|
||||
- run:
|
||||
environment:
|
||||
USE_JQUERY: 1
|
||||
command: yarn grunt test:circleci-protractor --specs="<< parameters.specs >>"
|
||||
no_output_timeout: 30m
|
||||
- stop_saucelabs
|
||||
|
||||
# Job definitions
|
||||
# Jobs can include parameters that are passed in the workflow job invocation.
|
||||
# https://circleci.com/docs/2.0/reusing-config/#authoring-parameterized-jobs
|
||||
jobs:
|
||||
setup:
|
||||
executor: default-executor
|
||||
steps:
|
||||
- checkout
|
||||
- init_environment
|
||||
- run:
|
||||
name: Running Yarn install
|
||||
command: yarn install --frozen-lockfile --non-interactive
|
||||
# Yarn's requests sometimes take more than 10mins to complete.
|
||||
no_output_timeout: 45m
|
||||
- run: yarn grunt package
|
||||
# Persist any changes at this point to be reused by further jobs.
|
||||
# **NOTE**: To add new content to the workspace, always persist on the same root.
|
||||
- persist_to_workspace:
|
||||
root: *workspace_location
|
||||
paths:
|
||||
- ./ng
|
||||
|
||||
lint:
|
||||
executor: default-executor
|
||||
steps:
|
||||
- custom_attach_workspace
|
||||
- init_environment
|
||||
- run: yarn -s grunt ci-checks
|
||||
- run: yarn commitplease "${CI_COMMIT_RANGE/.../..}"
|
||||
- run: yarn grunt validate-angular-files
|
||||
|
||||
unit-test:
|
||||
executor:
|
||||
name: default-executor
|
||||
steps:
|
||||
- custom_attach_workspace
|
||||
- init_environment
|
||||
- init_saucelabs_environment
|
||||
- run: yarn grunt test:promises-aplus
|
||||
- run:
|
||||
command: yarn grunt test:jqlite --browsers="$BROWSERS" --reporters=spec
|
||||
no_output_timeout: 10m
|
||||
- run:
|
||||
command: yarn grunt test:modules --browsers="$BROWSERS" --reporters=spec
|
||||
no_output_timeout: 10m
|
||||
- run:
|
||||
command: yarn grunt test:docs --browsers="$BROWSERS" --reporters=spec
|
||||
no_output_timeout: 10m
|
||||
|
||||
unit-test-jquery:
|
||||
executor:
|
||||
name: default-executor
|
||||
steps:
|
||||
- custom_attach_workspace
|
||||
- init_environment
|
||||
- init_saucelabs_environment
|
||||
- run:
|
||||
command: yarn grunt test:jquery --browsers="$BROWSERS" --reporters=spec
|
||||
no_output_timeout: 10m
|
||||
- run:
|
||||
command: yarn grunt test:jquery-2.2 --browsers="$BROWSERS" --reporters=spec
|
||||
no_output_timeout: 10m
|
||||
- run:
|
||||
command: yarn grunt test:jquery-2.1 --browsers="$BROWSERS" --reporters=spec
|
||||
no_output_timeout: 10m
|
||||
|
||||
e2e-test-1:
|
||||
executor:
|
||||
name: default-executor
|
||||
steps:
|
||||
- run_e2e_tests:
|
||||
specs: test/e2e/tests/**/*.js
|
||||
|
||||
e2e-test-2a:
|
||||
executor:
|
||||
name: default-executor
|
||||
steps:
|
||||
- run_e2e_tests:
|
||||
specs: build/docs/ptore2e/example-ng*/**/default_test.js
|
||||
|
||||
e2e-test-2b:
|
||||
executor:
|
||||
name: default-executor
|
||||
steps:
|
||||
- run_e2e_tests:
|
||||
specs: "build/docs/ptore2e/!(example-ng*)/**/default_test.js"
|
||||
|
||||
e2e-test-jquery-1:
|
||||
executor:
|
||||
name: default-executor
|
||||
steps:
|
||||
- run_e2e_tests_jquery:
|
||||
specs: test/e2e/tests/**/*.js
|
||||
|
||||
e2e-test-jquery-2a:
|
||||
executor:
|
||||
name: default-executor
|
||||
steps:
|
||||
- run_e2e_tests_jquery:
|
||||
specs: build/docs/ptore2e/example-ng*/**/jquery_test.js
|
||||
|
||||
e2e-test-jquery-2b:
|
||||
executor:
|
||||
name: default-executor
|
||||
steps:
|
||||
- run_e2e_tests_jquery:
|
||||
specs: build/docs/ptore2e/!(example-ng*)/**/jquery_test.js
|
||||
|
||||
deploy-docs:
|
||||
executor:
|
||||
name: default-executor
|
||||
steps:
|
||||
- custom_attach_workspace
|
||||
- init_environment
|
||||
- run: yarn grunt prepareDeploy
|
||||
# Install dependencies for Firebase functions to prevent parsing errors during deployment
|
||||
# See https://github.com/angular/angular.js/pull/16453
|
||||
- run: yarn -cwd $PROJECT_ROOT/scripts/docs.angularjs.org-firebase/functions
|
||||
- run: yarn firebase deploy --token "$FIREBASE_TOKEN" --only hosting
|
||||
|
||||
deploy-code:
|
||||
executor:
|
||||
name: default-executor
|
||||
steps:
|
||||
- run:
|
||||
name: Authenticate and configure Docker
|
||||
command: |
|
||||
echo $GCLOUD_SERVICE_KEY | gcloud auth activate-service-account --key-file=-
|
||||
gcloud --quiet config set project ${GOOGLE_PROJECT_ID}
|
||||
- run:
|
||||
name: Sync files to code.angularjs.org
|
||||
command: |
|
||||
gsutil -m rsync $PROJECT_ROOT/deploy/code gs://code-angularjs-org-338b8.appspot.com
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
default_workflow:
|
||||
jobs:
|
||||
- setup
|
||||
- lint:
|
||||
requires:
|
||||
- setup
|
||||
- unit-test:
|
||||
requires:
|
||||
- setup
|
||||
- unit-test-jquery:
|
||||
requires:
|
||||
- setup
|
||||
- e2e-test-1:
|
||||
requires:
|
||||
- setup
|
||||
- e2e-test-2a:
|
||||
requires:
|
||||
- setup
|
||||
- e2e-test-2b:
|
||||
requires:
|
||||
- setup
|
||||
- e2e-test-jquery-1:
|
||||
requires:
|
||||
- setup
|
||||
- e2e-test-jquery-2a:
|
||||
requires:
|
||||
- setup
|
||||
- e2e-test-jquery-2b:
|
||||
requires:
|
||||
- setup
|
||||
- deploy-docs:
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- latest
|
||||
requires:
|
||||
- unit-test
|
||||
- unit-test-jquery
|
||||
- e2e-test-1
|
||||
- e2e-test-2a
|
||||
- e2e-test-2b
|
||||
- e2e-test-jquery-1
|
||||
- e2e-test-jquery-2a
|
||||
- e2e-test-jquery-2b
|
||||
- deploy-code:
|
||||
filters:
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- latest
|
||||
requires:
|
||||
- unit-test
|
||||
- unit-test-jquery
|
||||
- e2e-test-1
|
||||
- e2e-test-2a
|
||||
- e2e-test-2b
|
||||
- e2e-test-jquery-1
|
||||
- e2e-test-jquery-2a
|
||||
- e2e-test-jquery-2b
|
||||
@@ -0,0 +1,73 @@
|
||||
####################################################################################################
|
||||
# Helpers for defining environment variables for CircleCI.
|
||||
#
|
||||
# In CircleCI, each step runs in a new shell. The way to share ENV variables across steps is to
|
||||
# export them from `$BASH_ENV`, which is automatically sourced at the beginning of every step (for
|
||||
# the default `bash` shell).
|
||||
#
|
||||
# See also https://circleci.com/docs/2.0/env-vars/#using-bash_env-to-set-environment-variables.
|
||||
####################################################################################################
|
||||
|
||||
# Set and print an environment variable.
|
||||
#
|
||||
# Use this function for setting environment variables that are public, i.e. it is OK for them to be
|
||||
# visible to anyone through the CI logs.
|
||||
#
|
||||
# Usage: `setPublicVar <name> <value>`
|
||||
function setPublicVar() {
|
||||
setSecretVar $1 "$2";
|
||||
echo "$1=$2";
|
||||
}
|
||||
|
||||
# Set (without printing) an environment variable.
|
||||
#
|
||||
# Use this function for setting environment variables that are secret, i.e. should not be visible to
|
||||
# everyone through the CI logs.
|
||||
#
|
||||
# Usage: `setSecretVar <name> <value>`
|
||||
function setSecretVar() {
|
||||
# WARNING: Secrets (e.g. passwords, access tokens) should NOT be printed.
|
||||
# (Keep original shell options to restore at the end.)
|
||||
local -r originalShellOptions=$(set +o);
|
||||
set +x -eu -o pipefail;
|
||||
|
||||
echo "export $1=\"${2:-}\";" >> $BASH_ENV;
|
||||
|
||||
# Restore original shell options.
|
||||
eval "$originalShellOptions";
|
||||
}
|
||||
|
||||
|
||||
# Create a function to set an environment variable, when called.
|
||||
#
|
||||
# Use this function for creating setter for public environment variables that require expensive or
|
||||
# time-consuming computaions and may not be needed. When needed, you can call this function to set
|
||||
# the environment variable (which will be available through `$BASH_ENV` from that point onwards).
|
||||
#
|
||||
# Arguments:
|
||||
# - `<name>`: The name of the environment variable. The generated setter function will be
|
||||
# `setPublicVar_<name>`.
|
||||
# - `<code>`: The code to run to compute the value for the variable. Since this code should be
|
||||
# executed lazily, it must be properly escaped. For example:
|
||||
# ```sh
|
||||
# # DO NOT do this:
|
||||
# createPublicVarSetter MY_VAR "$(whoami)"; # `whoami` will be evaluated eagerly
|
||||
#
|
||||
# # DO this isntead:
|
||||
# createPublicVarSetter MY_VAR "\$(whoami)"; # `whoami` will NOT be evaluated eagerly
|
||||
# ```
|
||||
#
|
||||
# Usage: `createPublicVarSetter <name> <code>`
|
||||
#
|
||||
# Example:
|
||||
# ```sh
|
||||
# createPublicVarSetter MY_VAR 'echo "FOO"';
|
||||
# echo $MY_VAR; # Not defined
|
||||
#
|
||||
# setPublicVar_MY_VAR;
|
||||
# source $BASH_ENV;
|
||||
# echo $MY_VAR; # FOO
|
||||
# ```
|
||||
function createPublicVarSetter() {
|
||||
echo "setPublicVar_$1() { setPublicVar $1 \"$2\"; }" >> $BASH_ENV;
|
||||
}
|
||||
Executable
+68
@@ -0,0 +1,68 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Variables
|
||||
readonly projectDir=$(realpath "$(dirname ${BASH_SOURCE[0]})/..")
|
||||
readonly envHelpersPath="$projectDir/.circleci/env-helpers.inc.sh";
|
||||
|
||||
# Load helpers and make them available everywhere (through `$BASH_ENV`).
|
||||
source $envHelpersPath;
|
||||
echo "source $envHelpersPath;" >> $BASH_ENV;
|
||||
|
||||
####################################################################################################
|
||||
# Define PUBLIC environment variables for CircleCI.
|
||||
####################################################################################################
|
||||
# See https://circleci.com/docs/2.0/env-vars/#built-in-environment-variables for more info.
|
||||
####################################################################################################
|
||||
setPublicVar CI "$CI"
|
||||
setPublicVar PROJECT_ROOT "$projectDir";
|
||||
# This is the branch being built; e.g. `pull/12345` for PR builds.
|
||||
setPublicVar CI_BRANCH "$CIRCLE_BRANCH";
|
||||
setPublicVar CI_BUILD_URL "$CIRCLE_BUILD_URL";
|
||||
setPublicVar CI_COMMIT "$CIRCLE_SHA1";
|
||||
# `CI_COMMIT_RANGE` is only used on push builds (a.k.a. non-PR, non-scheduled builds and rerun
|
||||
# workflows of such builds).
|
||||
setPublicVar CI_GIT_BASE_REVISION "${CIRCLE_GIT_BASE_REVISION}";
|
||||
setPublicVar CI_GIT_REVISION "${CIRCLE_GIT_REVISION}";
|
||||
setPublicVar CI_COMMIT_RANGE "$CIRCLE_GIT_BASE_REVISION..$CIRCLE_GIT_REVISION";
|
||||
setPublicVar CI_PULL_REQUEST "${CIRCLE_PR_NUMBER:-false}";
|
||||
setPublicVar CI_REPO_NAME "$CIRCLE_PROJECT_REPONAME";
|
||||
setPublicVar CI_REPO_OWNER "$CIRCLE_PROJECT_USERNAME";
|
||||
setPublicVar CI_PR_REPONAME "$CIRCLE_PR_REPONAME";
|
||||
setPublicVar CI_PR_USERNAME "$CIRCLE_PR_USERNAME";
|
||||
|
||||
|
||||
####################################################################################################
|
||||
# Define SauceLabs environment variables for CircleCI.
|
||||
####################################################################################################
|
||||
setPublicVar BROWSER_PROVIDER "saucelabs"
|
||||
|
||||
# The currently latest-1 version of desktop Safari on Saucelabs (v12.0) is unstable and disconnects
|
||||
# consistently. The latest version (v12.1) works fine.
|
||||
# TODO: Add `SL_Safari-1` back, once it no longer corresponds to v12.0.
|
||||
setPublicVar BROWSERS "SL_Chrome,SL_Chrome-1,\
|
||||
SL_Firefox,SL_Firefox-1,\
|
||||
SL_Safari,\
|
||||
SL_iOS,SL_iOS-1,\
|
||||
SL_IE_9,SL_IE_10,SL_IE_11,\
|
||||
SL_EDGE,SL_EDGE-1"
|
||||
|
||||
setPublicVar SAUCE_LOG_FILE /tmp/angular/sauce-connect.log
|
||||
setPublicVar SAUCE_READY_FILE /tmp/angular/sauce-connect-ready-file.lock
|
||||
setPublicVar SAUCE_PID_FILE /tmp/angular/sauce-connect-pid-file.lock
|
||||
setPublicVar SAUCE_TUNNEL_IDENTIFIER "angularjs-framework-${CIRCLE_BUILD_NUM}-${CIRCLE_NODE_INDEX}"
|
||||
# Amount of seconds we wait for sauceconnect to establish a tunnel instance. In order to not
|
||||
# acquire CircleCI instances for too long if sauceconnect failed, we need a connect timeout.
|
||||
setPublicVar SAUCE_READY_FILE_TIMEOUT 120
|
||||
|
||||
####################################################################################################
|
||||
# Define additional environment variables
|
||||
####################################################################################################
|
||||
setPublicVar DIST_TAG $( jq ".distTag" "package.json" | tr -d "\"[:space:]" )
|
||||
|
||||
####################################################################################################
|
||||
####################################################################################################
|
||||
## Source `$BASH_ENV` to make the variables available immediately. ##
|
||||
## ***NOTE: This must remain the the last action in this script*** ##
|
||||
####################################################################################################
|
||||
####################################################################################################
|
||||
source $BASH_ENV;
|
||||
@@ -23,3 +23,5 @@ npm-debug.log
|
||||
.vscode
|
||||
*.log
|
||||
*.stackdump
|
||||
scripts/docs.angularjs.org-firebase/functions/content
|
||||
/firebase.json
|
||||
|
||||
-104
@@ -1,104 +0,0 @@
|
||||
language: node_js
|
||||
sudo: false
|
||||
node_js:
|
||||
- '12'
|
||||
|
||||
cache:
|
||||
yarn: true
|
||||
|
||||
branches:
|
||||
except:
|
||||
- "/^g3_.*$/"
|
||||
|
||||
env:
|
||||
matrix:
|
||||
- JOB=ci-checks
|
||||
- JOB=unit-core BROWSER_PROVIDER=saucelabs
|
||||
- JOB=unit-jquery BROWSER_PROVIDER=saucelabs
|
||||
- JOB=unit-modules BROWSER_PROVIDER=saucelabs
|
||||
- JOB=docs-app BROWSER_PROVIDER=saucelabs
|
||||
- JOB=e2e TEST_TARGET=jqlite BROWSER_PROVIDER=saucelabs
|
||||
- JOB=e2e TEST_TARGET=jquery BROWSER_PROVIDER=saucelabs
|
||||
global:
|
||||
- SAUCE_USERNAME=angular-ci
|
||||
- SAUCE_ACCESS_KEY=9b988f434ff8-fbca-8aa4-4ae3-35442987
|
||||
- LOGS_DIR=/tmp/angular-build/logs
|
||||
- BROWSER_PROVIDER_READY_FILE=/tmp/browsersprovider-tunnel-ready
|
||||
- secure: oTBjhnOKhs0qDSKTf7fE4f6DYiNDPycvB7qfSF5QRIbJK/LK/J4UtFwetXuXj79HhUZG9qnoT+5e7lPaiaMlpsIKn9ann7ffqFWN1E8TMtpJF+AGigx3djYElwfgf5nEnFUFhwjFzvbfpZNnxVGgX5YbIZpe/WUbHkP4ffU0Wks=
|
||||
|
||||
before_install:
|
||||
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.21.1
|
||||
- export PATH="$HOME/.yarn/bin:$PATH"
|
||||
|
||||
before_script:
|
||||
- du -sh ./node_modules || true
|
||||
- "./scripts/travis/before_build.sh"
|
||||
script:
|
||||
- "./scripts/travis/build.sh"
|
||||
|
||||
after_script:
|
||||
- "./scripts/travis/tear_down_browser_provider.sh"
|
||||
- "./scripts/travis/print_logs.sh"
|
||||
|
||||
notifications:
|
||||
webhooks:
|
||||
urls:
|
||||
- https://webhooks.gitter.im/e/d2120f3f2bb39a4531b2
|
||||
- http://104.197.9.155:8484/hubot/travis/activity #hubot-server
|
||||
on_success: always # options: [always|never|change] default: always
|
||||
on_failure: always # options: [always|never|change] default: always
|
||||
on_start: always # default: false
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- stage: deploy
|
||||
# Don't deploy from PRs. Only deploy from our default branches, or if commit is tagged.
|
||||
# This is a Travis-specific boolean language: https://docs.travis-ci.com/user/conditional-builds-stages-jobs#Specifying-conditions
|
||||
# The deployment logic for pushed branches is further defined in scripts\travis\build.sh
|
||||
if: type != pull_request and (branch =~ ^(v1\.\d+\.x|master)$ or tag IS present)
|
||||
env:
|
||||
- JOB=deploy
|
||||
before_script: skip
|
||||
script:
|
||||
# Export the variables into the current process
|
||||
- . ./scripts/travis/build.sh
|
||||
- "echo DEPLOY_DOCS: $DEPLOY_DOCS, DEPLOY_CODE: $DEPLOY_CODE"
|
||||
after_script: skip
|
||||
# Work around the 10min Travis timeout so the code.angularjs firebase+gcs code deploy can complete
|
||||
# Only run the keep_alive once (before_deploy is run for each provider)
|
||||
before_deploy: |
|
||||
if ! [ "$BEFORE_DEPLOY_RUN" ]; then
|
||||
export BEFORE_DEPLOY_RUN=1;
|
||||
|
||||
function keep_alive() {
|
||||
while true; do
|
||||
echo -en "\a"
|
||||
sleep 10
|
||||
done
|
||||
}
|
||||
keep_alive &
|
||||
fi
|
||||
deploy:
|
||||
- provider: firebase
|
||||
# the upload folder for firebase is configured in /firebase.json
|
||||
skip_cleanup: true
|
||||
project: docs-angularjs-org-9p2
|
||||
token:
|
||||
secure: $FIREBASE_TOKEN
|
||||
on:
|
||||
repo: angular/angular.js
|
||||
all_branches: true
|
||||
condition: "$DEPLOY_DOCS == true"
|
||||
- provider: gcs
|
||||
skip_cleanup: true
|
||||
access_key_id: GOOGLDB7W2J3LFHICF3R
|
||||
secret_access_key:
|
||||
secure: tHIFdSq55qkyZf9zT/3+VkhUrTvOTMuswxXU3KyWaBrSieZqG0UnUDyNm+n3lSfX95zEl/+rJAWbfvhVSxZi13ndOtvRF+MdI1cvow2JynP0aDSiPffEvVrZOmihD6mt2SlMfhskr5FTduQ69kZG6DfLcve1PPDaIwnbOv3phb8=
|
||||
bucket: code-angularjs-org-338b8.appspot.com
|
||||
local-dir: deploy/code
|
||||
detect_encoding: true # detects gzip compression
|
||||
on:
|
||||
repo: angular/angular.js
|
||||
all_branches: true
|
||||
condition: "$DEPLOY_CODE == true"
|
||||
|
||||
+4
-4
@@ -125,8 +125,8 @@ Before you submit your pull request consider the following guidelines:
|
||||
* Follow our [Coding Rules][developers.rules].
|
||||
* If the changes affect public APIs, change or add relevant [documentation][developers.documentation].
|
||||
* Run the AngularJS [unit][developers.tests-unit] and [E2E test][developers.tests-e2e] suites, and ensure that all tests
|
||||
pass. It is generally sufficient to run the tests only on Chrome, as our Travis integration will
|
||||
run the tests on all supported browsers.
|
||||
pass. It is generally sufficient to run the tests only on Chrome, as our continous integration test will
|
||||
run the tests on additional browsers.
|
||||
* Run `yarn grunt eslint` to check that you have followed the automatically enforced coding rules
|
||||
* Commit your changes using a descriptive commit message that follows our
|
||||
[commit message conventions][developers.commits]. Adherence to the
|
||||
@@ -151,9 +151,9 @@ Before you submit your pull request consider the following guidelines:
|
||||
```
|
||||
|
||||
* In GitHub, send a pull request to `angular.js:master`. This will trigger the check of the
|
||||
[Contributor License Agreement](#cla) and the Travis integration.
|
||||
[Contributor License Agreement](#cla) and the continuous integration tests.
|
||||
|
||||
* If you find that the Travis integration has failed, look into the logs on Travis to find out
|
||||
* If you find that the continous integration tests have failed, look into the logs to find out
|
||||
if your changes caused test failures, the commit message was malformed etc. If you find that the
|
||||
tests failed or times out for unrelated reasons, you can ping a team member so that the build can be
|
||||
restarted.
|
||||
|
||||
+1
-1
@@ -428,7 +428,7 @@ if it is enclosed in <pre>...</pre> tags and the code lines themselv
|
||||
It is possible to embed examples in the documentation along with appropriate e2e tests. These
|
||||
examples and scenarios will be converted to runnable code within the documentation. So it is
|
||||
important that they work correctly. To ensure this, all these e2e scenarios are run as part of the
|
||||
automated Travis tests.
|
||||
continous integration tests.
|
||||
|
||||
If you are adding an example with an e2e test, you should [run the test locally](#e2e-tests) first
|
||||
to ensure it passes. You can change `it(...)` to `fit(...)` to run only your test,
|
||||
|
||||
+9
-17
@@ -14,7 +14,7 @@ var semver = require('semver');
|
||||
var exec = require('shelljs').exec;
|
||||
var pkg = require(__dirname + '/package.json');
|
||||
|
||||
var docsScriptFolder = 'scripts/docs.angularjs.org-firebase';
|
||||
var docsScriptFolder = util.docsScriptFolder;
|
||||
|
||||
// Node.js version checks
|
||||
if (!semver.satisfies(process.version, pkg.engines.node)) {
|
||||
@@ -45,7 +45,7 @@ if (!match) {
|
||||
}
|
||||
|
||||
// Ensure Node.js dependencies have been installed
|
||||
if (!process.env.TRAVIS && !process.env.JENKINS_HOME) {
|
||||
if (!process.env.CI) {
|
||||
var yarnOutput = exec('yarn install');
|
||||
if (yarnOutput.code !== 0) {
|
||||
throw new Error('Yarn install failed: ' + yarnOutput.stderr);
|
||||
@@ -109,16 +109,14 @@ module.exports = function(grunt) {
|
||||
},
|
||||
testserver: {
|
||||
options: {
|
||||
// We use end2end task (which does not start the webserver)
|
||||
// and start the webserver as a separate process (in travis_build.sh)
|
||||
// to avoid https://github.com/joyent/libuv/issues/826
|
||||
// We start the webserver as a separate process from the E2E tests
|
||||
port: 8000,
|
||||
hostname: '0.0.0.0',
|
||||
middleware: function(connect, options) {
|
||||
var base = Array.isArray(options.base) ? options.base[options.base.length - 1] : options.base;
|
||||
return [
|
||||
function(req, resp, next) {
|
||||
// cache get requests to speed up tests on travis
|
||||
// cache GET requests to speed up tests
|
||||
if (req.method === 'GET') {
|
||||
resp.setHeader('Cache-control', 'public, max-age=3600');
|
||||
}
|
||||
@@ -160,8 +158,7 @@ module.exports = function(grunt) {
|
||||
|
||||
protractor: {
|
||||
normal: 'protractor-conf.js',
|
||||
travis: 'protractor-travis-conf.js',
|
||||
jenkins: 'protractor-jenkins-conf.js'
|
||||
circleci: 'protractor-circleci-conf.js'
|
||||
},
|
||||
|
||||
|
||||
@@ -498,14 +495,9 @@ module.exports = function(grunt) {
|
||||
'connect:testserver',
|
||||
'protractor:normal'
|
||||
]);
|
||||
grunt.registerTask('test:travis-protractor', 'Run the end to end tests with Protractor for Travis CI builds', [
|
||||
grunt.registerTask('test:circleci-protractor', 'Run the end to end tests with Protractor for CircleCI builds', [
|
||||
'connect:testserver',
|
||||
'protractor:travis'
|
||||
]);
|
||||
grunt.registerTask('test:ci-protractor', 'Run the end to end tests with Protractor for Jenkins CI builds', [
|
||||
'webdriver',
|
||||
'connect:testserver',
|
||||
'protractor:jenkins'
|
||||
'protractor:circleci'
|
||||
]);
|
||||
grunt.registerTask('test:e2e', 'Alias for test:protractor', ['test:protractor']);
|
||||
grunt.registerTask('test:promises-aplus',[
|
||||
@@ -538,7 +530,7 @@ module.exports = function(grunt) {
|
||||
'package',
|
||||
'compress:deployFirebaseCode',
|
||||
'copy:deployFirebaseCode',
|
||||
'firebaseDocsJsonForTravis',
|
||||
'firebaseDocsJsonForCI',
|
||||
'copy:deployFirebaseDocs'
|
||||
]);
|
||||
grunt.registerTask('default', ['package']);
|
||||
@@ -546,7 +538,7 @@ module.exports = function(grunt) {
|
||||
|
||||
|
||||
function reportOrFail(message) {
|
||||
if (process.env.TRAVIS || process.env.JENKINS_HOME) {
|
||||
if (process.env.CI) {
|
||||
throw new Error(message);
|
||||
} else {
|
||||
console.log('===============================================================================');
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
AngularJS [](https://travis-ci.org/angular/angular.js)
|
||||
AngularJS [](https://circleci.com/gh/angular/workflows/angular.js/tree/master)
|
||||
=========
|
||||
|
||||
AngularJS lets you write client-side web applications as if you had a smarter browser. It lets you
|
||||
|
||||
+4
-4
@@ -36,7 +36,7 @@ Usually this will be the commit containing the release notes, but it may also be
|
||||
## Run "release" script
|
||||
|
||||
```bash
|
||||
scripts/jenkins/release.sh --git-push-dryrun=false --commit-sha=8822a4f --version-number=1.7.6 --version-name=gravity-manipulation
|
||||
scripts/release/release.sh --git-push-dryrun=false --commit-sha=8822a4f --version-number=1.7.6 --version-name=gravity-manipulation
|
||||
```
|
||||
|
||||
1) The SHA is of the commit to release (could be in the past).
|
||||
@@ -67,10 +67,10 @@ If we want to make our files available, we need submit our CLs before this time
|
||||
This is the version used to compute what version to link to in the CDN. If you update this too early then the CDN lookup fails and you end up with 'null, for the version, which breaks the docs.
|
||||
|
||||
|
||||
## Verify angularjs.org download modal has latest version (updates via Travis job)
|
||||
## Verify angularjs.org download modal has latest version (updates via CI job)
|
||||
|
||||
The versions in the modal are updated (based on the versions available on CDN) as part of the Travis deploy stage: https://github.com/angular/angularjs.org/blob/a4d25c5abcd39e8ce19d31cb1c78073d13c4c974/.travis.yml#L26
|
||||
(You may need to explicitly trigger the Travis job. e.g. re-running the last job.)
|
||||
The versions in the modal are updated (based on the versions available on CDN) as part of the CI deploy stage.
|
||||
(You may need to explicitly trigger the CI job. e.g. re-running the last `deploy` job.)
|
||||
|
||||
|
||||
## Announce the release (via official Google accounts)
|
||||
|
||||
@@ -17,9 +17,8 @@ attributes and tags. Read this document if you are planning on deploying your An
|
||||
on IE.
|
||||
|
||||
The project currently supports and will attempt to fix bugs for IE9 and above. The continuous
|
||||
integration server runs all the tests against IE9, IE10, and IE11. See
|
||||
[Travis CI](https://travis-ci.org/angular/angular.js) and
|
||||
[ci.angularjs.org](https://ci.angularjs.org).
|
||||
integration server runs all unit tests against IE9, IE10, and IE11. See
|
||||
[CircleCI](https://circleci.com/gh/angular/workflows/angular.js/tree/master).
|
||||
|
||||
We do not run tests on IE8 and below. A subset of the AngularJS functionality may work on these
|
||||
browsers, but it is up to you to test and decide whether it works for your particular app.
|
||||
|
||||
+3
-36
@@ -169,42 +169,9 @@ module.exports = function(config, specificOptions) {
|
||||
});
|
||||
|
||||
|
||||
if (process.env.TRAVIS) {
|
||||
var buildLabel = 'TRAVIS #' + process.env.TRAVIS_BUILD_NUMBER + ' (' + process.env.TRAVIS_BUILD_ID + ')';
|
||||
|
||||
// Karma (with socket.io 1.x) buffers by 50 and 50 tests can take a long time on IEs;-)
|
||||
config.browserNoActivityTimeout = 120000;
|
||||
|
||||
config.browserStack.build = buildLabel;
|
||||
config.browserStack.startTunnel = false;
|
||||
config.browserStack.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER;
|
||||
|
||||
config.sauceLabs.build = buildLabel;
|
||||
config.sauceLabs.startConnect = false;
|
||||
config.sauceLabs.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER;
|
||||
config.sauceLabs.recordScreenshots = true;
|
||||
|
||||
// Try 'websocket' for a faster transmission first. Fallback to 'polling' if necessary.
|
||||
config.transports = ['websocket', 'polling'];
|
||||
|
||||
// Debug logging into a file, that we print out at the end of the build.
|
||||
config.loggers.push({
|
||||
type: 'file',
|
||||
filename: process.env.LOGS_DIR + '/' + (specificOptions.logFile || 'karma.log')
|
||||
});
|
||||
|
||||
if (process.env.BROWSER_PROVIDER === 'saucelabs' || !process.env.BROWSER_PROVIDER) {
|
||||
// Allocating a browser can take pretty long (eg. if we are out of capacity and need to wait
|
||||
// for another build to finish) and so the `captureTimeout` typically kills
|
||||
// an in-queue-pending request, which makes no sense.
|
||||
config.captureTimeout = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Terrible hack to workaround inflexibility of log4js:
|
||||
// - ignore web-server's 404 warnings,
|
||||
// - ignore DEBUG logs (on Travis), we log them into a file instead.
|
||||
// - ignore DEBUG logs (on CI), we log them into a file instead.
|
||||
var IGNORED_404 = [
|
||||
'/favicon.ico',
|
||||
'/%7B%7BtestUrl%7D%7D',
|
||||
@@ -230,8 +197,8 @@ module.exports = function(config, specificOptions) {
|
||||
return;
|
||||
}
|
||||
|
||||
// on Travis, ignore DEBUG statements
|
||||
if (process.env.TRAVIS && log.level.levelStr === config.LOG_DEBUG) {
|
||||
// on CI, ignore DEBUG statements
|
||||
if (process.env.CI && log.level.levelStr === config.LOG_DEBUG) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
var http = require('http');
|
||||
var BrowserStackTunnel = require('browserstacktunnel-wrapper');
|
||||
|
||||
var HOSTNAME = 'localhost';
|
||||
var PORTS = [9876, 8000];
|
||||
var ACCESS_KEY = process.env.BROWSER_STACK_ACCESS_KEY;
|
||||
var READY_FILE = process.env.BROWSER_PROVIDER_READY_FILE;
|
||||
var TUNNEL_IDENTIFIER = process.env.TRAVIS_JOB_NUMBER;
|
||||
|
||||
// We need to start fake servers, otherwise the tunnel does not start.
|
||||
var fakeServers = [];
|
||||
var hosts = [];
|
||||
|
||||
PORTS.forEach(function(port) {
|
||||
fakeServers.push(http.createServer(function() {}).listen(port));
|
||||
hosts.push({
|
||||
name: HOSTNAME,
|
||||
port: port,
|
||||
sslFlag: 0
|
||||
});
|
||||
});
|
||||
|
||||
var tunnel = new BrowserStackTunnel({
|
||||
key: ACCESS_KEY,
|
||||
localIdentifier: TUNNEL_IDENTIFIER,
|
||||
hosts: hosts
|
||||
});
|
||||
|
||||
console.log('Starting tunnel on ports', PORTS.join(', '));
|
||||
tunnel.start(function(error) {
|
||||
if (error) {
|
||||
console.error('Can not establish the tunnel', error);
|
||||
} else {
|
||||
console.log('Tunnel established.');
|
||||
fakeServers.forEach(function(server) {
|
||||
server.close();
|
||||
});
|
||||
|
||||
if (READY_FILE) {
|
||||
fs.writeFile(READY_FILE, '');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
tunnel.on('error', function(error) {
|
||||
console.error(error);
|
||||
});
|
||||
@@ -1,3 +0,0 @@
|
||||
export BROWSER_STACK_ACCESS_KEY=`echo $BROWSER_STACK_ACCESS_KEY | rev`
|
||||
|
||||
node ./lib/browserstack/start_tunnel.js &
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e -o pipefail
|
||||
|
||||
|
||||
echo "Shutting down Browserstack tunnel"
|
||||
echo "TODO: implement me"
|
||||
exit 1
|
||||
@@ -63,8 +63,8 @@ module.exports = function(grunt) {
|
||||
util.collectErrors();
|
||||
});
|
||||
|
||||
grunt.registerTask('firebaseDocsJsonForTravis', function() {
|
||||
util.firebaseDocsJsonForTravis();
|
||||
grunt.registerTask('firebaseDocsJsonForCI', function() {
|
||||
util.firebaseDocsJsonForCI();
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
+7
-6
@@ -7,6 +7,7 @@ var spawn = require('npm-run').spawn;
|
||||
|
||||
var CSP_CSS_HEADER = '/* Include this file in your html if you are using the CSP mode. */\n\n';
|
||||
|
||||
const docsScriptFolder = 'scripts/docs.angularjs.org-firebase';
|
||||
|
||||
module.exports = {
|
||||
|
||||
@@ -32,8 +33,8 @@ module.exports = {
|
||||
|
||||
|
||||
updateWebdriver: function(done) {
|
||||
if (process.env.TRAVIS) {
|
||||
// Skip the webdriver-manager update on Travis, since the browsers will
|
||||
if (process.env.CI) {
|
||||
// Skip the webdriver-manager update on CI, since the browsers will
|
||||
// be provided remotely.
|
||||
done();
|
||||
return;
|
||||
@@ -302,11 +303,11 @@ module.exports = {
|
||||
};
|
||||
},
|
||||
|
||||
// Our Firebase projects are in subfolders, but Travis expects them in the root,
|
||||
// so we need to modify the upload folder path and copy the file into the root
|
||||
firebaseDocsJsonForTravis: function() {
|
||||
var docsScriptFolder = 'scripts/docs.angularjs.org-firebase';
|
||||
docsScriptFolder,
|
||||
|
||||
// Our Firebase projects are in subfolders, but the firebase tool expects them in the root,
|
||||
// so we need to modify the upload folder path and copy the file into the root
|
||||
firebaseDocsJsonForCI: function() {
|
||||
var fileName = docsScriptFolder + '/firebase.json';
|
||||
var json = grunt.file.readJSON(fileName);
|
||||
|
||||
|
||||
Executable
+459
@@ -0,0 +1,459 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -u -e -o pipefail
|
||||
|
||||
####################################################################################################
|
||||
# Some helper funtions
|
||||
|
||||
@echo() {
|
||||
echo "# $*"
|
||||
}
|
||||
|
||||
@warn() {
|
||||
@echo "Warning: $*" >&2
|
||||
}
|
||||
|
||||
@fail() {
|
||||
@echo "Error! $*" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
@remove() {
|
||||
local f="$1"
|
||||
if [[ -f ${f} ]]; then
|
||||
@echo "Removing ${f}"
|
||||
rm -f "${f}" || @fail "Can not delete ${f} file"
|
||||
fi
|
||||
}
|
||||
|
||||
@kill() {
|
||||
for p in $1; do
|
||||
if kill -0 ${p} >/dev/null 2>&1; then
|
||||
kill ${p}
|
||||
sleep 2
|
||||
if kill -0 ${p} >/dev/null 2>&1; then
|
||||
kill -9 ${p}
|
||||
sleep 2
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
@wait_for() {
|
||||
local m="$1"
|
||||
local f="$2"
|
||||
if [[ ! -f "${f}" ]]; then
|
||||
printf "# ${m} (${f})"
|
||||
while [[ ! -f "${f}" ]]; do
|
||||
printf "."
|
||||
sleep 0.5
|
||||
done
|
||||
printf "\n"
|
||||
fi
|
||||
}
|
||||
|
||||
####################################################################################################
|
||||
# Sauce service functions
|
||||
|
||||
readonly SCRIPT_DIR=$(cd $(dirname $0); pwd)
|
||||
readonly TMP_DIR="/tmp/angular/sauce-service"
|
||||
mkdir -p ${TMP_DIR}
|
||||
|
||||
# Location for the saucelabs log file.
|
||||
readonly SAUCE_LOG_FILE="${TMP_DIR}/sauce-connect.log"
|
||||
|
||||
# Location for the saucelabs ready to connection process id lock file.
|
||||
readonly SAUCE_PID_FILE="${TMP_DIR}/sauce-connect.pid"
|
||||
|
||||
# Location for the saucelabs ready to connect lock file.
|
||||
readonly SAUCE_READY_FILE="${TMP_DIR}/sauce-connect.lock"
|
||||
|
||||
# Location for the saucelabs params file for use by test runner.
|
||||
readonly SAUCE_PARAMS_JSON_FILE="${TMP_DIR}/sauce-connect-params.json"
|
||||
|
||||
# Amount of seconds we wait for sauceconnect to establish a tunnel instance. In order to not
|
||||
# acquire CircleCI instances for too long if sauceconnect fails, we need a connect timeout.
|
||||
readonly SAUCE_READY_FILE_TIMEOUT=120
|
||||
|
||||
readonly SERVICE_LOCK_FILE="${TMP_DIR}/service.lock"
|
||||
readonly SERVICE_START_FILE="${TMP_DIR}/service.start"
|
||||
readonly SERVICE_PID_FILE="${TMP_DIR}/service.pid"
|
||||
readonly SERVICE_LOG_FILE="${TMP_DIR}/service.log"
|
||||
|
||||
service-setup-command() {
|
||||
if [[ -z "${SAUCE_USERNAME:-}" ]]; then
|
||||
@fail "SAUCE_USERNAME environment variable required"
|
||||
fi
|
||||
|
||||
if [[ -z "${SAUCE_ACCESS_KEY:-}" ]]; then
|
||||
@fail "SAUCE_ACCESS_KEY environment variable required"
|
||||
fi
|
||||
|
||||
if [[ -z "${SAUCE_TUNNEL_IDENTIFIER:-}" ]]; then
|
||||
@fail "SAUCE_TUNNEL_IDENTIFIER environment variable required"
|
||||
fi
|
||||
|
||||
local unameOut="$(uname -s)"
|
||||
case "${unameOut}" in
|
||||
Linux*) local machine=linux ;;
|
||||
Darwin*) local machine=darwin ;;
|
||||
CYGWIN*) local machine=windows ;;
|
||||
MINGW*) local machine=windows ;;
|
||||
MSYS_NT*) local machine=windows ;;
|
||||
*) local machine=linux
|
||||
printf "\nUnrecongized uname '${unameOut}'; defaulting to use node for linux.\n" >&2
|
||||
printf "Please file an issue to https://github.com/bazelbuild/rules_nodejs/issues if \n" >&2
|
||||
printf "you would like to add your platform to the supported rules_nodejs node platforms.\n\n" >&2
|
||||
;;
|
||||
esac
|
||||
|
||||
case "${machine}" in
|
||||
# Path to sauce connect executable
|
||||
linux)
|
||||
if [[ -z "${BUILD_WORKSPACE_DIRECTORY:-}" ]]; then
|
||||
# Started manually
|
||||
SAUCE_CONNECT="${SCRIPT_DIR}/../../node_modules/sauce-connect/bin/sc"
|
||||
else
|
||||
# Started via `bazel run`
|
||||
SAUCE_CONNECT="${BUILD_WORKSPACE_DIRECTORY}/node_modules/sauce-connect/bin/sc"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if [[ -z "${SAUCE_CONNECT:-}" ]]; then
|
||||
@fail "SAUCE_CONNECT environment variable is required on non-linux environments"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [[ ! -f ${SAUCE_CONNECT} ]]; then
|
||||
@fail "sc binary not found at ${SAUCE_CONNECT}"
|
||||
fi
|
||||
|
||||
echo "{ \"SAUCE_USERNAME\": \"${SAUCE_USERNAME}\", \"SAUCE_ACCESS_KEY\": \"${SAUCE_ACCESS_KEY}\", \"SAUCE_TUNNEL_IDENTIFIER\": \"${SAUCE_TUNNEL_IDENTIFIER}\", \"SAUCE_LOCALHOST_ALIAS_DOMAIN\": \"${SAUCE_LOCALHOST_ALIAS_DOMAIN:-}\" }" > ${SAUCE_PARAMS_JSON_FILE}
|
||||
|
||||
# Command arguments that will be passed to sauce-connect.
|
||||
# By default we disable SSL bumping for all requests. This is because SSL bumping is
|
||||
# not needed for our test setup and in order to perform the SSL bumping, Saucelabs
|
||||
# intercepts all HTTP requests in the tunnel VM and modifies them. This can cause
|
||||
# flakiness as it makes all requests dependent on the SSL bumping middleware.
|
||||
# See: https://wiki.saucelabs.com/display/DOCS/Troubleshooting+Sauce+Connect#TroubleshootingSauceConnect-DisablingSSLBumping
|
||||
local sauce_args=(
|
||||
"--no-ssl-bump-domains all"
|
||||
"--logfile ${SAUCE_LOG_FILE}"
|
||||
"--pidfile ${SAUCE_PID_FILE}"
|
||||
"--readyfile ${SAUCE_READY_FILE}"
|
||||
"--tunnel-identifier ${SAUCE_TUNNEL_IDENTIFIER}"
|
||||
"--user ${SAUCE_USERNAME}"
|
||||
# Don't add the --api-key here so we don't echo it out in service-pre-start
|
||||
)
|
||||
|
||||
if [[ -n "${SAUCE_LOCALHOST_ALIAS_DOMAIN:-}" ]]; then
|
||||
# Ensures that requests to the localhost alias domain are always resolved through the tunnel.
|
||||
# This environment variable is usually configured on CI, and refers to a domain that has been
|
||||
# locally configured in the current machine's hosts file (e.g. `/etc/hosts`). The domain should
|
||||
# resolve to the current machine in Saucelabs VMs, so we need to ensure that it is resolved
|
||||
# through the tunnel we going to create.
|
||||
sauce_args+=("--tunnel-domains ${SAUCE_LOCALHOST_ALIAS_DOMAIN}")
|
||||
fi
|
||||
|
||||
@echo "Sauce connect will be started with:"
|
||||
echo " ${SAUCE_CONNECT} ${sauce_args[@]}"
|
||||
SERVICE_COMMAND="${SAUCE_CONNECT} ${sauce_args[@]} --api-key ${SAUCE_ACCESS_KEY}"
|
||||
}
|
||||
|
||||
# Called by pre-start & post-stop
|
||||
service-cleanup() {
|
||||
if [[ -f "${SAUCE_PID_FILE}" ]]; then
|
||||
local p=$(cat "${SAUCE_PID_FILE}")
|
||||
@echo "Stopping Sauce Connect (pid $p)..."
|
||||
@kill $p
|
||||
fi
|
||||
@remove "${SAUCE_PID_FILE}"
|
||||
@remove "${SAUCE_READY_FILE}"
|
||||
@remove "${SAUCE_PARAMS_JSON_FILE}"
|
||||
}
|
||||
|
||||
# Called before service is setup
|
||||
service-pre-setup() {
|
||||
service-cleanup
|
||||
}
|
||||
|
||||
# Called after service is setup
|
||||
service-post-setup() {
|
||||
@echo " sauce params : ${SAUCE_PARAMS_JSON_FILE}"
|
||||
}
|
||||
|
||||
# Called before service is started
|
||||
service-pre-start() {
|
||||
return
|
||||
}
|
||||
|
||||
# Called after service is started
|
||||
service-post-start() {
|
||||
if [[ ! -f "${SAUCE_PID_FILE}" ]]; then
|
||||
printf "# Waiting for Sauce Connect Proxy process (${SAUCE_PID_FILE})"
|
||||
while [[ ! -f "${SAUCE_PID_FILE}" ]]; do
|
||||
if ! @serviceStatus >/dev/null 2>&1; then
|
||||
printf "\n"
|
||||
@serviceStop
|
||||
@echo "Service failed to start!"
|
||||
service-failed-setup
|
||||
exit 1
|
||||
fi
|
||||
printf "."
|
||||
sleep 0.5
|
||||
done
|
||||
printf "\n"
|
||||
fi
|
||||
@echo "Sauce Connect Proxy started (pid $(cat "${SAUCE_PID_FILE}"))"
|
||||
}
|
||||
|
||||
# Called if service fails to start
|
||||
service-failed-setup() {
|
||||
if [[ -f "${SERVICE_LOG_FILE}" ]]; then
|
||||
@echo "tail ${SERVICE_LOG_FILE}:"
|
||||
echo "--------------------------------------------------------------------------------"
|
||||
tail "${SERVICE_LOG_FILE}"
|
||||
echo "--------------------------------------------------------------------------------"
|
||||
echo "^^^^^ ${SERVICE_LOG_FILE} ^^^^^"
|
||||
fi
|
||||
}
|
||||
|
||||
# Called by ready-wait action
|
||||
service-ready-wait() {
|
||||
if [[ ! -f "${SAUCE_PID_FILE}" ]]; then
|
||||
@fail "Sauce Connect not running"
|
||||
fi
|
||||
if [[ ! -f "${SAUCE_READY_FILE}" ]]; then
|
||||
# Wait for saucelabs tunnel to connect
|
||||
printf "# Waiting for saucelabs tunnel to connect (${SAUCE_READY_FILE})"
|
||||
counter=0
|
||||
while [[ ! -f "${SAUCE_READY_FILE}" ]]; do
|
||||
counter=$((counter + 1))
|
||||
|
||||
# Counter needs to be multiplied by two because the while loop only sleeps a half second.
|
||||
# This has been made in favor of better progress logging (printing dots every half second)
|
||||
if [ $counter -gt $[${SAUCE_READY_FILE_TIMEOUT} * 2] ]; then
|
||||
@echo "Timed out after ${SAUCE_READY_FILE_TIMEOUT} seconds waiting for tunnel ready file."
|
||||
if [[ -f "${SAUCE_LOG_FILE}" ]]; then
|
||||
echo "================================================================================"
|
||||
echo "${SAUCE_LOG_FILE}:"
|
||||
cat "${SAUCE_LOG_FILE}"
|
||||
fi
|
||||
exit 5
|
||||
fi
|
||||
|
||||
printf "."
|
||||
sleep 0.5
|
||||
done
|
||||
printf "\n"
|
||||
@echo "Saucelabs tunnel connected"
|
||||
else
|
||||
@echo "Saucelabs tunnel already connected"
|
||||
fi
|
||||
}
|
||||
|
||||
# Called before service is stopped
|
||||
service-pre-stop() {
|
||||
return
|
||||
}
|
||||
|
||||
# Called after service is stopped
|
||||
service-post-stop() {
|
||||
service-cleanup
|
||||
}
|
||||
|
||||
####################################################################################################
|
||||
# Generic service functions
|
||||
# This uses functions setup above but nothing below should be specific to saucelabs
|
||||
|
||||
@serviceLock() {
|
||||
# Check is Lock File exists, if not create it and set trap on exit
|
||||
printf "# Waiting for service action lock (${SERVICE_LOCK_FILE})"
|
||||
while true; do
|
||||
if { set -C; 2>/dev/null >"${SERVICE_LOCK_FILE}"; }; then
|
||||
trap "rm -f \"${SERVICE_LOCK_FILE}\"" EXIT
|
||||
printf "\n"
|
||||
break
|
||||
fi
|
||||
printf "."
|
||||
sleep 0.5
|
||||
done
|
||||
@echo "Acquired service action lock"
|
||||
}
|
||||
|
||||
@serviceStatus() {
|
||||
if [ -f "${SERVICE_PID_FILE}" ] && [ ! -z "$(cat "${SERVICE_PID_FILE}")" ]; then
|
||||
local p=$(cat "${SERVICE_PID_FILE}")
|
||||
|
||||
if kill -0 $p >/dev/null 2>&1; then
|
||||
@echo "Service is running (pid $p)"
|
||||
return 0
|
||||
else
|
||||
@echo "Service is not running (process PID $p not exists)"
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
@echo "Service is not running"
|
||||
return 2
|
||||
fi
|
||||
}
|
||||
|
||||
@serviceSetup() {
|
||||
if @serviceStatus >/dev/null 2>&1; then
|
||||
@echo "Service already running (pid $(cat "${SERVICE_PID_FILE}"))"
|
||||
return 0
|
||||
fi
|
||||
|
||||
@echo "Setting up service..."
|
||||
@remove "${SERVICE_PID_FILE}"
|
||||
@remove "${SERVICE_START_FILE}"
|
||||
touch "${SERVICE_LOG_FILE}" >/dev/null 2>&1 || @fail "Can not create ${SERVICE_LOG_FILE} file"
|
||||
@echo " service pid : ${SERVICE_PID_FILE}"
|
||||
@echo " service logs : ${SERVICE_LOG_FILE}"
|
||||
service-pre-setup
|
||||
service-setup-command
|
||||
|
||||
(
|
||||
(
|
||||
if [[ -z "${SERVICE_COMMAND:-}" ]]; then
|
||||
@fail "No SERVICE_COMMAND is set"
|
||||
fi
|
||||
@wait_for "Waiting for start file" "${SERVICE_START_FILE}"
|
||||
${SERVICE_COMMAND}
|
||||
) >>"${SERVICE_LOG_FILE}" 2>&1
|
||||
) &
|
||||
echo $! >"${SERVICE_PID_FILE}"
|
||||
|
||||
if @serviceStatus >/dev/null 2>&1; then
|
||||
@echo "Service setup (pid $(cat "${SERVICE_PID_FILE}"))"
|
||||
service-post-setup
|
||||
else
|
||||
@echo "Error setting up Service!"
|
||||
service-failed-setup
|
||||
exit 1
|
||||
fi
|
||||
|
||||
return $?
|
||||
}
|
||||
|
||||
@serviceStart() {
|
||||
if @serviceStatus >/dev/null 2>&1; then
|
||||
@echo "Service already setup (pid $(cat "${SERVICE_PID_FILE}"))"
|
||||
else
|
||||
@serviceSetup
|
||||
fi
|
||||
if [[ -f "${SERVICE_START_FILE}" ]]; then
|
||||
@echo "Service already started"
|
||||
else
|
||||
@echo "Starting service..."
|
||||
service-pre-start
|
||||
touch "${SERVICE_START_FILE}" >/dev/null 2>&1 || @err "Can not create ${SERVICE_START_FILE} file"
|
||||
service-post-start
|
||||
@echo "Service started"
|
||||
fi
|
||||
}
|
||||
|
||||
@serviceStop() {
|
||||
if @serviceStatus >/dev/null 2>&1; then
|
||||
touch "${SERVICE_PID_FILE}" >/dev/null 2>&1 || @fail "Can not touch ${SERVICE_PID_FILE} file"
|
||||
|
||||
service-pre-stop
|
||||
@echo "Stopping sevice (pid $(cat "${SERVICE_PID_FILE}"))..."
|
||||
@kill $(cat "${SERVICE_PID_FILE}")
|
||||
|
||||
if @serviceStatus >/dev/null 2>&1; then
|
||||
@fail "Error stopping Service! Service already running with PID $(cat "${SERVICE_PID_FILE}")"
|
||||
else
|
||||
@echo "Service stopped"
|
||||
@remove "${SERVICE_PID_FILE}"
|
||||
@remove "${SERVICE_START_FILE}"
|
||||
service-post-stop
|
||||
fi
|
||||
|
||||
return 0
|
||||
else
|
||||
@warn "Service is not running"
|
||||
@remove "${SERVICE_PID_FILE}"
|
||||
@remove "${SERVICE_START_FILE}"
|
||||
service-post-stop
|
||||
fi
|
||||
}
|
||||
|
||||
@serviceStartReadyWait() {
|
||||
@serviceStart
|
||||
@serviceReadyWait
|
||||
}
|
||||
|
||||
@serviceReadyWait() {
|
||||
service-ready-wait
|
||||
}
|
||||
|
||||
@serviceRestart() {
|
||||
@serviceStop
|
||||
@serviceStart
|
||||
}
|
||||
|
||||
@serviceTail() {
|
||||
@echo "tail ${SERVICE_LOG_FILE}:"
|
||||
tail -f "${SERVICE_LOG_FILE}"
|
||||
}
|
||||
|
||||
@serviceLog() {
|
||||
@echo "cat ${SERVICE_LOG_FILE}:"
|
||||
echo "--------------------------------------------------------------------------------"
|
||||
cat "${SERVICE_LOG_FILE}"
|
||||
echo "--------------------------------------------------------------------------------"
|
||||
echo "^^^^^ ${SERVICE_LOG_FILE} ^^^^^"
|
||||
}
|
||||
|
||||
case "${1:-}" in
|
||||
setup)
|
||||
@serviceLock
|
||||
@serviceSetup
|
||||
;;
|
||||
start)
|
||||
@serviceLock
|
||||
@serviceStart
|
||||
;;
|
||||
start-ready-wait)
|
||||
@serviceLock
|
||||
@serviceStartReadyWait
|
||||
;;
|
||||
ready-wait)
|
||||
@serviceLock
|
||||
@serviceReadyWait
|
||||
;;
|
||||
stop)
|
||||
@serviceLock
|
||||
@serviceStop
|
||||
;;
|
||||
restart)
|
||||
@serviceLock
|
||||
@serviceRestart
|
||||
;;
|
||||
status)
|
||||
@serviceLock
|
||||
@serviceStatus
|
||||
;;
|
||||
run)
|
||||
(
|
||||
service-setup-command
|
||||
if [[ -z "${SERVICE_COMMAND:-}" ]]; then
|
||||
@fail "No SERVICE_COMMAND is set"
|
||||
fi
|
||||
${SERVICE_COMMAND}
|
||||
)
|
||||
;;
|
||||
log)
|
||||
@serviceLog
|
||||
;;
|
||||
tail)
|
||||
@serviceTail
|
||||
;;
|
||||
*)
|
||||
@echo "Actions: [setup|start|start-read-wait|ready-wait|stop|restart|status|run|tail]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -1,47 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Setup and start Sauce Connect for your TravisCI build
|
||||
# This script requires your .travis.yml to include the following two private env variables:
|
||||
# SAUCE_USERNAME
|
||||
# SAUCE_ACCESS_KEY
|
||||
# Follow the steps at https://saucelabs.com/opensource/travis to set that up.
|
||||
#
|
||||
# Curl and run this script as part of your .travis.yml before_script section:
|
||||
# before_script:
|
||||
# - curl https://gist.github.com/santiycr/5139565/raw/sauce_connect_setup.sh | bash
|
||||
SC_VERSION="4.5.4"
|
||||
CONNECT_URL="https://saucelabs.com/downloads/sc-$SC_VERSION-linux.tar.gz"
|
||||
CONNECT_DIR="/tmp/sauce-connect-$RANDOM"
|
||||
CONNECT_DOWNLOAD="sc-$SC_VERSION-linux.tar.gz"
|
||||
|
||||
# We don't want to create a log file because sauceconnect always logs in verbose mode. This seems
|
||||
# to be overwhelming Travis and causing flakes when we are cat-ing the log in "print_logs.sh"
|
||||
CONNECT_LOG="/dev/null"
|
||||
|
||||
# Get Connect and start it
|
||||
mkdir -p $CONNECT_DIR
|
||||
cd $CONNECT_DIR
|
||||
curl $CONNECT_URL -o $CONNECT_DOWNLOAD 2> /dev/null 1> /dev/null
|
||||
mkdir sauce-connect
|
||||
tar --extract --file=$CONNECT_DOWNLOAD --strip-components=1 --directory=sauce-connect > /dev/null
|
||||
rm $CONNECT_DOWNLOAD
|
||||
|
||||
SAUCE_ACCESS_KEY=`echo $SAUCE_ACCESS_KEY | rev`
|
||||
|
||||
|
||||
ARGS=""
|
||||
|
||||
# Set tunnel-id only on Travis, to make local testing easier.
|
||||
if [ ! -z "$TRAVIS_JOB_NUMBER" ]; then
|
||||
ARGS="$ARGS --tunnel-identifier $TRAVIS_JOB_NUMBER"
|
||||
fi
|
||||
if [ ! -z "$BROWSER_PROVIDER_READY_FILE" ]; then
|
||||
ARGS="$ARGS --readyfile $BROWSER_PROVIDER_READY_FILE"
|
||||
fi
|
||||
|
||||
|
||||
echo "Starting Sauce Connect in the background"
|
||||
sauce-connect/bin/sc -u $SAUCE_USERNAME -k $SAUCE_ACCESS_KEY $ARGS \
|
||||
--logfile $CONNECT_LOG &
|
||||
@@ -1,16 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e -o pipefail
|
||||
|
||||
|
||||
echo "Shutting down Sauce Connect tunnel"
|
||||
|
||||
killall sc
|
||||
|
||||
while [[ -n `ps -ef | grep "sauce-connect-" | grep -v "grep"` ]]; do
|
||||
printf "."
|
||||
sleep .5
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "Sauce Connect tunnel has been shut down"
|
||||
@@ -65,7 +65,7 @@ var getCodeName = function(tagName) {
|
||||
|
||||
|
||||
/**
|
||||
* Compute a build segment for the version, from the Jenkins build number and current commit SHA
|
||||
* Compute a build segment for the version, from the CI build number and current commit SHA
|
||||
* @return {String} The build segment of the version
|
||||
*/
|
||||
function getBuild() {
|
||||
@@ -189,7 +189,7 @@ var getSnapshotVersion = function() {
|
||||
// We need to clone to ensure that we are not modifying another version
|
||||
version = semver(version.raw);
|
||||
|
||||
var jenkinsBuild = process.env.TRAVIS_BUILD_NUMBER || process.env.BUILD_NUMBER;
|
||||
var ciBuild = process.env.CIRCLE_BUILD_NUM || process.env.BUILD_NUMBER;
|
||||
if (!version.prerelease || !version.prerelease.length) {
|
||||
// last release was a non beta release. Increment the patch level to
|
||||
// indicate the next release that we will be doing.
|
||||
@@ -203,7 +203,7 @@ var getSnapshotVersion = function() {
|
||||
// as this is bigger than 1.3.0-beta.2 according to semver
|
||||
version.patch++;
|
||||
}
|
||||
version.prerelease = jenkinsBuild ? ['build', jenkinsBuild] : ['local'];
|
||||
version.prerelease = ciBuild ? ['build', ciBuild] : ['local'];
|
||||
version.build = getBuild();
|
||||
version.codeName = 'snapshot';
|
||||
version.isSnapshot = true;
|
||||
|
||||
+6
-1
@@ -88,6 +88,7 @@
|
||||
"q-io": "^1.10.9",
|
||||
"qq": "^0.3.5",
|
||||
"rewire": "~2.1.0",
|
||||
"sauce-connect": "https://saucelabs.com/downloads/sc-4.5.1-linux.tar.gz",
|
||||
"sax": "^1.1.1",
|
||||
"selenium-webdriver": "^4.0.0-alpha.1",
|
||||
"semver": "^5.4.1",
|
||||
@@ -98,7 +99,11 @@
|
||||
"sorted-object": "^1.0.0",
|
||||
"stringmap": "^0.2.2"
|
||||
},
|
||||
"dependencies": {},
|
||||
"dependencies": {
|
||||
"firebase": "^7.14.4",
|
||||
"firebase-tools": "^8.3.0",
|
||||
"node-glob": "^1.2.0"
|
||||
},
|
||||
"resolutions": {
|
||||
"//1": "`natives@1.1.0` does not work with Node.js 10.x on Windows 10",
|
||||
"//2": "(E.g. see https://github.com/gulpjs/gulp/issues/2162 and https://github.com/nodejs/node/issues/25132.)",
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
'use strict';
|
||||
|
||||
var config = require('./protractor-shared-conf').config;
|
||||
|
||||
|
||||
// Using SauceLabs.
|
||||
config.capabilities = undefined;
|
||||
config.sauceUser = process.env.SAUCE_USERNAME;
|
||||
config.sauceKey = process.env.SAUCE_ACCESS_KEY;
|
||||
config.multiCapabilities = [
|
||||
capabilitiesForSauceLabs({
|
||||
browserName: 'chrome',
|
||||
platform: 'OS X 10.14',
|
||||
version: '81'
|
||||
}),
|
||||
capabilitiesForSauceLabs({
|
||||
browserName: 'firefox',
|
||||
platform: 'OS X 10.14',
|
||||
version: '76'
|
||||
})
|
||||
];
|
||||
|
||||
|
||||
config.allScriptsTimeout = 30000;
|
||||
config.getPageTimeout = 30000;
|
||||
|
||||
exports.config = config;
|
||||
|
||||
|
||||
function capabilitiesForSauceLabs(capabilities) {
|
||||
return {
|
||||
'tunnel-identifier': process.env.SAUCE_TUNNEL_IDENTIFIER,
|
||||
|
||||
'name': 'AngularJS E2E',
|
||||
'build': `${process.env.CIRCLE_BUILD_NUM}-${process.env.CIRCLE_NODE_INDEX}`,
|
||||
|
||||
'browserName': capabilities.browserName,
|
||||
'platform': capabilities.platform,
|
||||
'version': capabilities.version,
|
||||
'elementScrollBehavior': 1,
|
||||
// Allow e2e test sessions to run for a maximum of 40 minutes, instead of the default 30 minutes.
|
||||
'maxDuration': 2400
|
||||
};
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
exports.config = {
|
||||
allScriptsTimeout: 11000,
|
||||
|
||||
specs: [
|
||||
'test/e2e/tests/**/*.js',
|
||||
'build/docs/ptore2e/**/*.js',
|
||||
'docs/app/e2e/*.scenario.js'
|
||||
],
|
||||
|
||||
capabilities: {
|
||||
'browserName': 'chrome'
|
||||
},
|
||||
|
||||
baseUrl: 'http://localhost:8000/',
|
||||
|
||||
framework: 'jasmine2',
|
||||
|
||||
onPrepare: function() {
|
||||
/* global angular: false, browser: false, jasmine: false */
|
||||
|
||||
// Disable animations so e2e tests run more quickly
|
||||
var disableNgAnimate = function() {
|
||||
angular.module('disableNgAnimate', []).run(['$animate', function($animate) {
|
||||
$animate.enabled(false);
|
||||
}]);
|
||||
};
|
||||
|
||||
browser.addMockModule('disableNgAnimate', disableNgAnimate);
|
||||
|
||||
var reporters = require('jasmine-reporters');
|
||||
jasmine.getEnv().addReporter(new reporters.JUnitXmlReporter({
|
||||
savePath: 'test_out/docs-e2e-' + exports.config.capabilities.browserName + '-'
|
||||
}));
|
||||
},
|
||||
|
||||
jasmineNodeOpts: {
|
||||
defaultTimeoutInterval: 30000,
|
||||
showColors: false
|
||||
}
|
||||
};
|
||||
@@ -1,87 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var config = require('./protractor-shared-conf').config;
|
||||
|
||||
if (process.env.BROWSER_PROVIDER === 'browserstack') {
|
||||
// Using BrowserStack.
|
||||
config.seleniumAddress = 'http://hub.browserstack.com/wd/hub';
|
||||
config.multiCapabilities = [
|
||||
capabilitiesForBrowserStack({
|
||||
browserName: 'chrome',
|
||||
platform: 'MAC',
|
||||
version: '49'
|
||||
}),
|
||||
capabilitiesForBrowserStack({
|
||||
browserName: 'firefox',
|
||||
version: '47'
|
||||
}),
|
||||
capabilitiesForBrowserStack({
|
||||
browserName: 'safari',
|
||||
platform: 'MAC',
|
||||
version: '9'
|
||||
})
|
||||
];
|
||||
} else {
|
||||
// Using SauceLabs.
|
||||
config.sauceUser = process.env.SAUCE_USERNAME;
|
||||
config.sauceKey = process.env.SAUCE_ACCESS_KEY;
|
||||
config.multiCapabilities = [
|
||||
capabilitiesForSauceLabs({
|
||||
browserName: 'chrome',
|
||||
platform: 'OS X 10.14',
|
||||
version: '81'
|
||||
}),
|
||||
capabilitiesForSauceLabs({
|
||||
browserName: 'firefox',
|
||||
platform: 'OS X 10.14',
|
||||
version: '76'
|
||||
}),
|
||||
capabilitiesForSauceLabs({
|
||||
browserName: 'safari',
|
||||
platform: 'OS X 10.14',
|
||||
version: '12'
|
||||
})
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
config.allScriptsTimeout = 30000;
|
||||
config.getPageTimeout = 30000;
|
||||
|
||||
exports.config = config;
|
||||
|
||||
|
||||
function capabilitiesForBrowserStack(capabilities) {
|
||||
return {
|
||||
'browserstack.user': process.env.BROWSER_STACK_USERNAME,
|
||||
'browserstack.key': process.env.BROWSER_STACK_ACCESS_KEY,
|
||||
'browserstack.local': 'true',
|
||||
'browserstack.debug': 'true',
|
||||
'browserstack.tunnelIdentifier': process.env.TRAVIS_JOB_NUMBER,
|
||||
'tunnelIdentifier': process.env.TRAVIS_JOB_NUMBER,
|
||||
|
||||
'name': 'AngularJS E2E',
|
||||
'build': process.env.TRAVIS_BUILD_NUMBER,
|
||||
|
||||
'browserName': capabilities.browserName,
|
||||
'platform': capabilities.platform,
|
||||
'version': capabilities.version,
|
||||
'elementScrollBehavior': 1
|
||||
};
|
||||
}
|
||||
|
||||
function capabilitiesForSauceLabs(capabilities) {
|
||||
return {
|
||||
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
|
||||
|
||||
'name': 'AngularJS E2E',
|
||||
'build': process.env.TRAVIS_BUILD_NUMBER,
|
||||
|
||||
'browserName': capabilities.browserName,
|
||||
'platform': capabilities.platform,
|
||||
'version': capabilities.version,
|
||||
'elementScrollBehavior': 1,
|
||||
// Allow e2e test sessions to run for a maximum of 35 minutes, instead of the default 30 minutes.
|
||||
'maxDuration': 2100
|
||||
};
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Tags a release
|
||||
# so that travis can do the actual release.
|
||||
|
||||
echo "#################################"
|
||||
echo "## Tag angular.js for a release #"
|
||||
|
||||
@@ -9,7 +9,7 @@ in functions/index.js that serves the docs from the Firebase Google Cloud Storag
|
||||
functions/index.js also contains a rule that deletes outdated build zip files
|
||||
from the snapshot and snapshot-stable folders when new zip files are uploaded.
|
||||
|
||||
The deployment to the Google Cloud Storage bucket happens automatically via Travis. See the travis.yml
|
||||
file in the repository root.
|
||||
The deployment to the Google Cloud Storage bucket happens automatically via CI.
|
||||
See the .circleci/config.yml file in the repository root.
|
||||
|
||||
See /readme.firebase.docs.md for the firebase deployment to docs.angularjs.org
|
||||
@@ -63,7 +63,7 @@ function _update_code() {
|
||||
|
||||
function publish {
|
||||
# publish updates the code.angularjs.org Github repository
|
||||
# the deployment to Firebase happens via Travis
|
||||
# the deployment to Firebase happens via CI
|
||||
_update_code
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -3,12 +3,13 @@ Firebase for docs.angularjs.org
|
||||
|
||||
# Continuous integration
|
||||
|
||||
The docs are deployed to Google Firebase hosting via Travis deployment config, which expects
|
||||
firebase.json in the repository root, which is done by a Grunt task (firebaseDocsJsonForTravis)
|
||||
that modifies the paths in the firebase.json and copies it into the repository root.
|
||||
The docs are deployed to Google Firebase hosting via a CI deployment config, which expects
|
||||
firebase.json to be in the repository root, which is done by a Grunt task
|
||||
(`firebaseDocsJsonForCI` which is included in `prepareDeploy`).
|
||||
The `firebaseDocsJsonForCI` task modifies the paths in the `firebase.json` and copies it to the
|
||||
repository root.
|
||||
|
||||
See travis.yml for the complete deployment config, and scripts/travis/build.sh for the full deployment
|
||||
build steps.
|
||||
See .circleci/config.yml for the complete deployment config and build steps.
|
||||
|
||||
# Serving locally:
|
||||
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "#################################"
|
||||
echo "#### Jenkins Build ############"
|
||||
echo "#################################"
|
||||
|
||||
source scripts/jenkins/init-node.sh
|
||||
|
||||
# Enable tracing and exit on first failure
|
||||
set -xe
|
||||
|
||||
# This is the default set of browsers to use on the CI server unless overridden via env variable
|
||||
if [[ -z "$BROWSERS" ]]
|
||||
then
|
||||
BROWSERS="Chrome"
|
||||
fi
|
||||
|
||||
# CLEAN #
|
||||
rm -f angular.min.js.gzip.size
|
||||
rm -f angular.js.size
|
||||
|
||||
|
||||
# BUILD #
|
||||
yarn grunt ci-checks package --no-color
|
||||
|
||||
mkdir -p test_out
|
||||
|
||||
# UNIT TESTS #
|
||||
yarn grunt test:unit --browsers="$BROWSERS" --reporters=dots,junit --no-colors --no-color
|
||||
|
||||
# END TO END TESTS #
|
||||
yarn grunt test:ci-protractor
|
||||
|
||||
# DOCS APP TESTS #
|
||||
yarn grunt test:docs --browsers="$BROWSERS" --reporters=dots,junit --no-colors --no-color
|
||||
|
||||
# Promises/A+ TESTS #
|
||||
yarn grunt test:promises-aplus --no-color
|
||||
|
||||
|
||||
# CHECK SIZE #
|
||||
gzip -c < build/angular.min.js > build/angular.min.js.gzip
|
||||
echo "YVALUE=`ls -l build/angular.min.js | cut -d" " -f 8`" > angular.min.js.size
|
||||
echo "YVALUE=`ls -l build/angular.min.js.gzip | cut -d" " -f 8`" > angular.min.js.gzip.size
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Install nvm for this shell
|
||||
source ~/.nvm/nvm.sh
|
||||
|
||||
# Use version of node.js found in .nvmrc
|
||||
nvm install
|
||||
|
||||
# clean out and install yarn
|
||||
rm -rf ~/.yarn
|
||||
curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.21.1
|
||||
export PATH="$HOME/.yarn/bin:$PATH"
|
||||
|
||||
# Ensure that we have the local dependencies installed
|
||||
yarn install
|
||||
|
||||
echo testing grunt version
|
||||
yarn grunt --version
|
||||
@@ -1,38 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "#################################"
|
||||
echo "#### Update master ##############"
|
||||
echo "#################################"
|
||||
|
||||
ARG_DEFS=()
|
||||
|
||||
function init {
|
||||
if [[ ! $VERBOSE ]]; then
|
||||
VERBOSE=false
|
||||
fi
|
||||
VERBOSE_ARG="--verbose=$VERBOSE"
|
||||
}
|
||||
|
||||
function build {
|
||||
cd ../..
|
||||
scripts/jenkins/build.sh
|
||||
cd $SCRIPT_DIR
|
||||
}
|
||||
|
||||
function phase {
|
||||
ACTION_ARG="--action=$1"
|
||||
../code.angularjs.org/publish.sh $ACTION_ARG $VERBOSE_ARG
|
||||
../bower/publish.sh $ACTION_ARG $VERBOSE_ARG
|
||||
}
|
||||
|
||||
function run {
|
||||
build
|
||||
|
||||
# First prepare all scripts (build, test, commit, tag, ...),
|
||||
# so we are sure everything is all right
|
||||
phase prepare
|
||||
# only then publish to github
|
||||
phase publish
|
||||
}
|
||||
|
||||
source $(dirname $0)/../utils.inc
|
||||
Executable → Regular
+1
-2
@@ -36,7 +36,6 @@ function init {
|
||||
|
||||
function build {
|
||||
cd ../..
|
||||
source scripts/jenkins/init-node.sh
|
||||
yarn grunt ci-checks package --no-color
|
||||
|
||||
cd $SCRIPT_DIR
|
||||
@@ -65,4 +64,4 @@ function run {
|
||||
phase publish
|
||||
}
|
||||
|
||||
source $(dirname $0)/../utils.inc
|
||||
source $(dirname $0)/../utils.inc
|
||||
Executable → Regular
+1
-1
@@ -38,4 +38,4 @@ function run {
|
||||
phase publish
|
||||
}
|
||||
|
||||
source $(dirname $0)/../utils.inc
|
||||
source $(dirname $0)/../utils.inc
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
mkdir -p "$LOGS_DIR"
|
||||
|
||||
if [ "$JOB" != "ci-checks" ]; then
|
||||
echo "start_browser_provider"
|
||||
./scripts/travis/start_browser_provider.sh
|
||||
fi
|
||||
|
||||
# ci-checks and unit tests do not run against the packaged code
|
||||
if [[ "$JOB" != "ci-checks" ]] && [[ "$JOB" != unit-* ]]; then
|
||||
yarn grunt package
|
||||
fi
|
||||
|
||||
# unit runs the docs tests too which need a built version of the code
|
||||
if [[ "$JOB" = unit-* ]]; then
|
||||
yarn grunt validate-angular-files
|
||||
yarn grunt build
|
||||
fi
|
||||
|
||||
# check this after the package, because at this point the browser_provider
|
||||
# has probably arrived
|
||||
if [ "$JOB" != "ci-checks" ]; then
|
||||
echo "wait_for_browser_provider"
|
||||
./scripts/travis/wait_for_browser_provider.sh
|
||||
fi
|
||||
@@ -1,114 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
readonly THIS_DIR=$(cd $(dirname ${BASH_SOURCE[0]}); pwd)
|
||||
readonly ROOT_DIR="$THIS_DIR/../.."
|
||||
|
||||
export BROWSER_STACK_ACCESS_KEY
|
||||
export SAUCE_ACCESS_KEY
|
||||
|
||||
BROWSER_STACK_ACCESS_KEY=$(echo "$BROWSER_STACK_ACCESS_KEY" | rev)
|
||||
SAUCE_ACCESS_KEY=$(echo "$SAUCE_ACCESS_KEY" | rev)
|
||||
|
||||
# The currently latest-1 version of desktop Safari on Saucelabs (v12.0) is unstable and disconnects
|
||||
# consistently. The latest version (v12.1) works fine.
|
||||
# TODO: Add `SL_Safari-1` back, once it no longer corresponds to v12.0.
|
||||
BROWSERS="SL_Chrome,SL_Chrome-1,\
|
||||
SL_Firefox,SL_Firefox-1,\
|
||||
SL_Safari,\
|
||||
SL_iOS,SL_iOS-1,\
|
||||
SL_IE_9,SL_IE_10,SL_IE_11,\
|
||||
SL_EDGE,SL_EDGE-1"
|
||||
|
||||
case "$JOB" in
|
||||
"ci-checks")
|
||||
grunt ci-checks
|
||||
|
||||
if [[ $TRAVIS_PULL_REQUEST != 'false' ]]; then
|
||||
# validate commit messages of all commits in the PR
|
||||
# convert commit range to 2 dots, as commitplease uses `git log`.
|
||||
# See https://github.com/travis-ci/travis-ci/issues/4596 for more info
|
||||
echo "Validate commit messages in PR:"
|
||||
yarn run commitplease "${TRAVIS_COMMIT_RANGE/.../..}"
|
||||
fi
|
||||
;;
|
||||
"unit-core")
|
||||
grunt test:promises-aplus
|
||||
grunt test:jqlite --browsers="$BROWSERS" --reporters=spec
|
||||
;;
|
||||
"unit-jquery")
|
||||
grunt test:jquery --browsers="$BROWSERS" --reporters=spec
|
||||
grunt test:jquery-2.2 --browsers="$BROWSERS" --reporters=spec
|
||||
grunt test:jquery-2.1 --browsers="$BROWSERS" --reporters=spec
|
||||
;;
|
||||
"unit-modules")
|
||||
grunt test:modules --browsers="$BROWSERS" --reporters=spec
|
||||
;;
|
||||
"docs-app")
|
||||
grunt tests:docs --browsers="$BROWSERS" --reporters=spec
|
||||
grunt test:travis-protractor --specs="docs/app/e2e/**/*.scenario.js"
|
||||
;;
|
||||
"e2e")
|
||||
if [[ $TEST_TARGET == jquery* ]]; then
|
||||
export USE_JQUERY=1
|
||||
fi
|
||||
|
||||
if [[ "$TEST_TARGET" == jquery* ]]; then
|
||||
TARGET_SPECS="build/docs/ptore2e/**/jquery_test.js"
|
||||
else
|
||||
TARGET_SPECS="build/docs/ptore2e/**/default_test.js"
|
||||
fi
|
||||
|
||||
TARGET_SPECS="test/e2e/tests/**/*.js,$TARGET_SPECS"
|
||||
grunt test:travis-protractor --specs="$TARGET_SPECS"
|
||||
;;
|
||||
"deploy")
|
||||
export DEPLOY_DOCS
|
||||
export DEPLOY_CODE
|
||||
|
||||
DIST_TAG=$( jq ".distTag" "package.json" | tr -d "\"[:space:]" )
|
||||
|
||||
# upload docs if the branch distTag from package.json is "latest" (i.e. stable branch)
|
||||
if [[ "$DIST_TAG" == latest ]]; then
|
||||
DEPLOY_DOCS=true
|
||||
else
|
||||
DEPLOY_DOCS=false
|
||||
fi
|
||||
|
||||
# upload the build (code + docs) if ...
|
||||
# the commit is tagged
|
||||
# - or the branch is "master"
|
||||
# - or the branch distTag from package.json is "latest" (i.e. stable branch)
|
||||
if [[ "$TRAVIS_TAG" != '' || "$TRAVIS_BRANCH" == master || "$DIST_TAG" == latest ]]; then
|
||||
DEPLOY_CODE=true
|
||||
else
|
||||
DEPLOY_CODE=false
|
||||
fi
|
||||
|
||||
if [[ "$DEPLOY_DOCS" == true || "$DEPLOY_CODE" == true ]]; then
|
||||
grunt prepareDeploy
|
||||
|
||||
if [[ "$DEPLOY_DOCS" == true ]]; then
|
||||
# Install npm dependencies for Firebase functions.
|
||||
(
|
||||
cd "$ROOT_DIR/scripts/docs.angularjs.org-firebase/functions"
|
||||
npm install
|
||||
)
|
||||
fi
|
||||
else
|
||||
echo "Skipping deployment build because conditions have not been met."
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Unknown job type. Please set JOB to one of\
|
||||
'ci-checks',\
|
||||
'unit-core',\
|
||||
'unit-jquery',\
|
||||
'unit-modules',\
|
||||
'docs-app',\
|
||||
'e2e',\
|
||||
or\
|
||||
'deploy'."
|
||||
;;
|
||||
esac
|
||||
@@ -1,11 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
LOG_FILES=$LOGS_DIR/*
|
||||
|
||||
for FILE in $LOG_FILES; do
|
||||
echo -e "\n\n\n"
|
||||
echo "================================================================================"
|
||||
echo " $FILE"
|
||||
echo "================================================================================"
|
||||
cat $FILE || true
|
||||
done
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Has to be run from project root directory.
|
||||
|
||||
|
||||
if [ "$BROWSER_PROVIDER" == "browserstack" ]; then
|
||||
echo "Using BrowserStack"
|
||||
elif [ "$BROWSER_PROVIDER" == "saucelabs" ]; then
|
||||
echo "Using SauceLabs"
|
||||
else
|
||||
echo "Invalid BROWSER_PROVIDER. Please set env var BROWSER_PROVIDER to 'saucelabs' or 'browserstack'."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
./lib/${BROWSER_PROVIDER}/start_tunnel.sh
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Has to be run from project root directory.
|
||||
|
||||
./lib/${BROWSER_PROVIDER}/teardown_tunnel.sh
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
# Wait for Connect to be ready before exiting
|
||||
# Time out if we wait for more than 2 minutes, so that we can print logs.
|
||||
let "counter=0"
|
||||
|
||||
while [ ! -f $BROWSER_PROVIDER_READY_FILE ]; do
|
||||
let "counter++"
|
||||
if [ $counter -gt 240 ]; then
|
||||
echo "Timed out after 2 minutes waiting for browser provider ready file"
|
||||
# We must manually print logs here because travis will not run
|
||||
# after_script commands if the failure occurs before the script
|
||||
# phase.
|
||||
./scripts/travis/print_logs.sh
|
||||
exit 5
|
||||
fi
|
||||
sleep .5
|
||||
done
|
||||
Reference in New Issue
Block a user