├── tests ├── testdata │ ├── .gitmanaged │ ├── public │ │ └── index.html │ ├── cypress │ │ ├── e2e │ │ │ └── test.cy.js │ │ └── support │ │ │ └── e2e.js │ └── cypress.config.js └── test.bats ├── commands └── cypress │ ├── cypress-run │ └── cypress-open ├── .github ├── dependabot.yml ├── PULL_REQUEST_TEMPLATE.md ├── workflows │ └── tests.yml └── ISSUE_TEMPLATE │ ├── feature_request.yml │ └── bug_report.yml ├── docker-compose.cypress.yaml ├── install.yaml ├── README.md └── LICENSE /tests/testdata/.gitmanaged: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/testdata/public/index.html: -------------------------------------------------------------------------------- 1 | this is a test 2 | -------------------------------------------------------------------------------- /tests/testdata/cypress/e2e/test.cy.js: -------------------------------------------------------------------------------- 1 | describe('Example test', () => { 2 | it('Can read the site', () => { 3 | cy.visit('/') 4 | cy.contains('this is a test') 5 | }) 6 | }) 7 | -------------------------------------------------------------------------------- /tests/testdata/cypress.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | e2e: { 3 | baseUrl: process.env.DDEV_PRIMARY_URL, 4 | setupNodeEvents(on, config) { 5 | // implement node event listeners here 6 | }, 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /commands/cypress/cypress-run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #ddev-generated 3 | ## Description: Use Cypress in "runner" mode. 4 | ## 5 | ## Usage: cypress-run [arguments] 6 | ## Example: "ddev cypress-run --browser chrome" 7 | 8 | cypress run "$@" 9 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | updates: 4 | # Enable version updates for Docker Compose 5 | - package-ecosystem: "docker-compose" 6 | directory: "/" 7 | schedule: 8 | interval: "weekly" 9 | allow: 10 | - dependency-type: "all" 11 | -------------------------------------------------------------------------------- /commands/cypress/cypress-open: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | #ddev-generated 3 | 4 | ## Description: Open an interactive Cypress window 5 | ## https://docs.cypress.io/guides/guides/command-line#cypress-open 6 | ## Usage: cypress-open [arguments] 7 | ## Example: "ddev cypress-open --config cypress.json" 8 | 9 | cypress open --project . "$@" 10 | -------------------------------------------------------------------------------- /tests/testdata/cypress/support/e2e.js: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example support/e2e.js is processed and 3 | // loaded automatically before your test files. 4 | // 5 | // This is a great place to put global configuration and 6 | // behavior that modifies Cypress. 7 | // 8 | // You can change the location of this file or turn off 9 | // automatically serving support files with the 10 | // 'supportFile' configuration option. 11 | // 12 | // You can read more here: 13 | // https://on.cypress.io/configuration 14 | // *********************************************************** 15 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## The Issue 2 | 3 | - # 4 | 5 | 6 | 7 | ## How This PR Solves The Issue 8 | 9 | ## Manual Testing Instructions 10 | 11 | ```bash 12 | ddev add-on get https://github.com/ddev/ddev-cypress/tarball/refs/pull/REPLACE_ME_WITH_THIS_PR_NUMBER/head 13 | ddev restart 14 | ``` 15 | 16 | ## Automated Testing Overview 17 | 18 | 19 | 20 | ## Release/Deployment Notes 21 | 22 | 23 | -------------------------------------------------------------------------------- /docker-compose.cypress.yaml: -------------------------------------------------------------------------------- 1 | #ddev-generated 2 | services: 3 | cypress: 4 | image: cypress/included:15.7.0 5 | container_name: ddev-${DDEV_SITENAME}-cypress 6 | labels: 7 | com.ddev.site-name: ${DDEV_SITENAME} 8 | com.ddev.approot: ${DDEV_APPROOT} 9 | user: "${DDEV_UID}:${DDEV_GID}" 10 | networks: [default, ddev_default] 11 | 12 | tty: true 13 | 14 | environment: 15 | - CYPRESS_baseUrl=${DDEV_PRIMARY_URL} 16 | - DISPLAY 17 | - HOME=/root 18 | 19 | volumes: 20 | # Mount the project root to Cypress's project point 21 | - "${DDEV_APPROOT}:/e2e" 22 | # Mount DDEV to allow commands 23 | - ".:/mnt/ddev_config" 24 | # Allow X11 forwarding 25 | - /tmp/.X11-unix:/tmp/.X11-unix 26 | 27 | entrypoint: /bin/bash 28 | working_dir: /e2e 29 | -------------------------------------------------------------------------------- /install.yaml: -------------------------------------------------------------------------------- 1 | name: ddev-cypress 2 | 3 | ddev_version_constraint: '>= v1.24.10' 4 | 5 | pre_install_actions: 6 | - | 7 | #ddev-nodisplay 8 | #ddev-description:Remove docker-compose.cypress_extras.yaml file 9 | if [ -f docker-compose.cypress_extras.yaml ]; then 10 | if grep -q '#ddev-generated' docker-compose.cypress_extras.yaml; then 11 | rm -f docker-compose.cypress_extras.yaml 12 | else 13 | echo "Unwilling to remove '$DDEV_APPROOT/.ddev/docker-compose.cypress_extras.yaml' because it does not have #ddev-generated in it; you can manually delete it if it is safe to delete." 14 | fi 15 | fi 16 | 17 | # list of files and directories listed that are copied into project .ddev directory 18 | project_files: 19 | - docker-compose.cypress.yaml 20 | - commands/cypress/cypress-open 21 | - commands/cypress/cypress-run 22 | 23 | # List of files and directories that are copied into the global .ddev directory 24 | global_files: 25 | -------------------------------------------------------------------------------- /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: tests 2 | on: 3 | pull_request: 4 | paths-ignore: 5 | - "**.md" 6 | push: 7 | branches: [ main ] 8 | paths-ignore: 9 | - "**.md" 10 | 11 | schedule: 12 | - cron: '01 07 * * *' 13 | 14 | workflow_dispatch: 15 | inputs: 16 | debug_enabled: 17 | description: 'Debug with tmate set "debug_enabled"' 18 | required: false 19 | default: "false" 20 | 21 | permissions: 22 | actions: write 23 | 24 | jobs: 25 | tests: 26 | strategy: 27 | matrix: 28 | ddev_version: [stable, HEAD] 29 | fail-fast: false 30 | 31 | runs-on: ubuntu-latest 32 | 33 | steps: 34 | - uses: ddev/github-action-add-on-test@v2 35 | with: 36 | ddev_version: ${{ matrix.ddev_version }} 37 | token: ${{ secrets.GITHUB_TOKEN }} 38 | debug_enabled: ${{ github.event.inputs.debug_enabled }} 39 | addon_repository: ${{ env.GITHUB_REPOSITORY }} 40 | addon_ref: ${{ env.GITHUB_REF }} 41 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yml: -------------------------------------------------------------------------------- 1 | name: 🚀 Feature request 2 | description: Suggest an idea for this project. 3 | labels: [enhancement] 4 | body: 5 | - type: checkboxes 6 | attributes: 7 | label: Is there an existing issue for this? 8 | description: Please search existing issues to see if one already exists for your request. 9 | options: 10 | - label: I have searched the existing issues 11 | required: true 12 | - type: textarea 13 | attributes: 14 | label: Is your feature request related to a problem? 15 | description: Clearly and concisely describe the problem. (Ex. I'm always frustrated when...) 16 | validations: 17 | required: true 18 | - type: textarea 19 | attributes: 20 | label: Describe your solution 21 | description: Clearly and concisely describe what you want to happen. 22 | validations: 23 | required: true 24 | - type: textarea 25 | attributes: 26 | label: Describe alternatives 27 | description: Clearly and concisely describe any alternative solutions or features you've considered. 28 | validations: 29 | required: false 30 | - type: textarea 31 | attributes: 32 | label: Additional context 33 | description: Add any other context or screenshots about the feature request. 34 | validations: 35 | required: false 36 | -------------------------------------------------------------------------------- /tests/test.bats: -------------------------------------------------------------------------------- 1 | setup() { 2 | set -eu -o pipefail 3 | export DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )/.." 4 | export PROJNAME=test-cypress 5 | export TESTDIR=~/tmp/test-cypress 6 | mkdir -p $TESTDIR 7 | export DDEV_NON_INTERACTIVE=true 8 | ddev delete -Oy ${PROJNAME} >/dev/null 2>&1 || true 9 | cd "${TESTDIR}" 10 | mkdir -p "public" 11 | cp -r "${DIR}/tests/testdata/"* "${TESTDIR}" 12 | ddev config --project-name=${PROJNAME} --docroot=public 13 | } 14 | 15 | health_checks() { 16 | # ddev cypress-run --version | grep "Cypress package version" 17 | ddev cypress-run | grep "All specs passed" 18 | } 19 | 20 | teardown() { 21 | set -eu -o pipefail 22 | cd ${TESTDIR} || ( printf "unable to cd to ${TESTDIR}\n" && exit 1 ) 23 | ddev delete -Oy ${PROJNAME} >/dev/null 2>&1 24 | [ "${TESTDIR}" != "" ] && rm -rf ${TESTDIR} 25 | } 26 | 27 | @test "install from directory" { 28 | set -eu -o pipefail 29 | cd ${TESTDIR} 30 | echo "# ddev add-on get ${DIR} with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3 31 | ddev add-on get ${DIR} 32 | ddev restart 33 | health_checks 34 | } 35 | 36 | # bats test_tags=release 37 | @test "install from release" { 38 | set -eu -o pipefail 39 | cd ${TESTDIR} || ( printf "unable to cd to ${TESTDIR}\n" && exit 1 ) 40 | echo "# ddev add-on get ddev/ddev-cypress with project ${PROJNAME} in ${TESTDIR} ($(pwd))" >&3 41 | ddev add-on get ddev/ddev-cypress 42 | ddev restart >/dev/null 43 | health_checks 44 | } 45 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: 🐞 Bug report or Support Request 2 | description: Create a report to help us improve. 3 | labels: [bug] 4 | body: 5 | - type: checkboxes 6 | attributes: 7 | label: Preliminary checklist 8 | description: Please complete the following checks before submitting an issue. 9 | options: 10 | - label: I am using the latest stable version of DDEV 11 | required: true 12 | - label: I am using the latest stable version of this add-on 13 | required: true 14 | - type: textarea 15 | attributes: 16 | label: Expected Behavior 17 | description: What did you expect to happen? 18 | validations: 19 | required: true 20 | - type: textarea 21 | attributes: 22 | label: Actual Behavior 23 | description: What actually happened instead? 24 | validations: 25 | required: true 26 | - type: textarea 27 | attributes: 28 | label: Steps To Reproduce 29 | description: Specific steps to reproduce the behavior. 30 | placeholder: | 31 | 1. In this environment... 32 | 2. With this config... 33 | 3. Run `...` 34 | 4. See error... 35 | validations: 36 | required: false 37 | - type: textarea 38 | attributes: 39 | label: Anything else? 40 | description: | 41 | Links? References? Screenshots? Anything that will give us more context about your issue! 42 | 43 | 💡 Attach images or log files by clicking this area to highlight it and dragging files in. 44 | validations: 45 | required: false 46 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![add-on registry](https://img.shields.io/badge/DDEV-Add--on_Registry-blue)](https://addons.ddev.com) 2 | [![tests](https://github.com/ddev/ddev-cypress/actions/workflows/tests.yml/badge.svg)](https://github.com/ddev/ddev-cypress/actions/workflows/tests.yml) 3 | [![last commit](https://img.shields.io/github/last-commit/ddev/ddev-cypress)](https://github.com/ddev/ddev-cypress/commits) 4 | [![release](https://img.shields.io/github/v/release/ddev/ddev-cypress)](https://github.com/ddev/ddev-cypress/releases/latest) 5 | 6 | # DDEV-cypress 7 | 8 | - [Introduction](#introduction) 9 | - [Requirements](#requirements) 10 | - [Steps](#steps) 11 | - [Configure `DISPLAY`](#configure-display) 12 | - [macOS](#macos) 13 | - [Linux](#linux) 14 | - [Windows 10](#windows-10) 15 | - [Running DDEV on Win10 (not WSL)](#running-ddev-on-win10-not-wsl) 16 | - [A note about the Cypress image](#a-note-about-the-cypress-image) 17 | - [Commands](#commands) 18 | - [`cypress-open`](#cypress-open) 19 | - [`cypress-run`](#cypress-run) 20 | - [Notes](#notes) 21 | - [Troubleshooting](#troubleshooting) 22 | - ["Could not find a Cypress configuration file, exiting"](#could-not-find-a-cypress-configuration-file-exiting) 23 | - ["Unable to open X display."](#unable-to-open-x-display) 24 | 25 | ## Introduction 26 | 27 | [Cypress](https://www.cypress.io/) is a "complete end-to-end testing experience". It allows you to write JavaScript test files that automate real browsers. For more details, see the [Cypress Overview](https://docs.cypress.io/guides/overview/why-cypress) page. 28 | 29 | This recipe integrates a Cypress docker image with your DDEV project. 30 | 31 | The main benefit is integration of Chrome and Firefox browsers out of the box, providing a known static state regardless of local OS or cloud CI/CS development. It also provides X11 display support for MacOS and Windows users, whereas this usually just works in Linux. 32 | 33 | This addon: 34 | 35 | - provides Cypress without the need to install Node.js 36 | - provides Firefox and Chromium out of the box, pre-configured for Cypress 37 | - configures your project's HTTPS site a base URL 38 | - provides helper commands for running Cypress GUI or in headless mode 39 | 40 | Installing Cypress with favorite package manager works great locally. However, maintaining a consistent node and browser environments across teams, operating systems, CI/CS development pipelines and cloud development spaces can become a challenge. 41 | 42 | Browser testing using Cypress sets up Cypress for Drupal manually. For Linux users this could be easier, since X11 and Firefox are usually already present. 43 | 44 | ## Requirements 45 | 46 | - DDEV >= 1.19 47 | - Modern OS 48 | - MacOS 10.9 and above (Intel or Apple Silicon 64-bit (x64 or arm64)) 49 | - Linux Ubuntu 12.04 and above, Fedora 21 and Debian 8 (x86_64 or Arm 64-bit (x64 or arm64)) 50 | - Windows 7 and above (64-bit) 51 | - Interactive mode requires a X11 server running on the host machine. 52 | 53 | ## Steps 54 | 55 | - Install service 56 | 57 | ```shell 58 | ddev add-on get ddev/ddev-cypress 59 | ``` 60 | 61 | Then restart the project 62 | 63 | ```shell 64 | ddev restart 65 | ``` 66 | 67 | - Run cypress via `ddev cypress-open` or `ddev cypress-run` (headless). 68 | 69 | We recommend running `ddev cypress-open` first to create configuration and support files. 70 | This addon sets `CYPRESS_baseUrl` to DDEV's primary URL in the `docker-compose.cypress.yaml`. 71 | 72 | ### Configure `DISPLAY` 73 | 74 | To display the Cypress screen and browser output, you must configure a `DISPLAY` environment variable. 75 | 76 | #### macOS 77 | 78 | ddev Cypress Setup (Mac) 79 | 80 | ```bash 81 | # Install XQuartz 82 | brew install xquartz --cask 83 | 84 | # Run XQuartz 85 | open -a Xquartz 86 | ``` 87 | 88 | In the XQuartz preferences, go to the “Security” tab and make sure the “Allow connections from network clients” checkbox is checked. 89 | 90 | Now __restart your Mac__. XQuartz will not properly be set to listen for X11 connections until you do this. 91 | 92 | ```bash 93 | # Run the below command 94 | xhost + 127.0.0.1 95 | ``` 96 | 97 | Add a file called `docker-compose.cypress_extra.yaml` with the following content to the .ddev directory: 98 | 99 | ```yaml 100 | services: 101 | cypress: 102 | environment: 103 | - DISPLAY=host.docker.internal:0 104 | ``` 105 | 106 | #### Linux 107 | 108 | You may need to set up access control for the X server for this to work. Install the xhost package (one is available for all distros) and run: 109 | 110 | ```sh 111 | export DISPLAY=:0 112 | xhost + 113 | ``` 114 | 115 | #### Windows 10 116 | 117 | If you are running DDEV on Win10 or WSL2, you need to configure a display server on Win10. 118 | You are free to use any X11-compatible server. A configuration-free solution is to install [GWSL via the Windows Store](https://www.microsoft.com/en-us/p/gwsl/9nl6kd1h33v3#activetab=pivot:overviewtab). 119 | 120 | ##### Running DDEV on Win10 (not WSL) 121 | 122 | - Install [GWSL via the Windows Store](https://www.microsoft.com/en-us/p/gwsl/9nl6kd1h33v3#activetab=pivot:overviewtab) 123 | - Get you "IPv4 Address" for your "Ethernet adapter" via networking panel or by typing `ipconfig` in a terminal. The address in the below example is `192.168.0.196` 124 | 125 | ```shell 126 | ❯ ipconfig 127 | 128 | Windows IP Configuration 129 | 130 | 131 | Ethernet adapter Ethernet: 132 | 133 | Connection-specific DNS Suffix . : 134 | IPv4 Address. . . . . . . . . . . : 192.168.0.196 135 | Subnet Mask . . . . . . . . . . . : 255.255.255.0 136 | Default Gateway . . . . . . . . . : 192.168.0.1 137 | ``` 138 | 139 | - In your project `./docker-compose.cypress.yaml`, add the IPv4 address and `:0` (For example `192.168.0.196:0` ) to the display section under environment. 140 | 141 | ```yaml 142 | environment: 143 | - DISPLAY=192.168.0.196:0 144 | ``` 145 | 146 | ### A note about the Cypress image 147 | 148 | This recipe uses the latest `cypress/include` image which includes the following browsers: 149 | 150 | - Chrome 151 | - Firefox 152 | - Electron 153 | 154 | Best practice encourages using a [specific image tag](https://github.com/cypress-io/cypress-docker-images#best-practice). 155 | 156 | - If you require a specific browser, update `image` in your `./.ddev/docker-compose.cypress.yaml`. 157 | - Available images and versions are available on the [cypress-docker-images](https://github.com/cypress-io/cypress-docker-images) page. 158 | 159 | ## Commands 160 | 161 | Cypress can run into 2 different modes: interactive and runner. 162 | This recipe includes 2 alias commands to help you use Cypress. 163 | 164 | To see Cypress in interactive mode, Cypress forward XVFB messages out of the Cypress container into an X11 server running on the host machine. Each OS has different options. Developers have reported success with the following: 165 | 166 | - Windows 10 / WSL users: 167 | - [GWSL](https://opticos.github.io/gwsl/tutorials/manual.html) (via [Microsoft store](ms-windows-store://pdp/?productid=9NL6KD1H33V3)) 168 | - [VcXsrv](https://sourceforge.net/projects/vcxsrv/) (via [chocolatey](https://community.chocolatey.org/packages/vcxsrv#versionhistory)). 169 | - Mac users: 170 | - [XQuartz](https://www.xquartz.org/). See [Running GUI applications using Docker for Mac](https://sourabhbajaj.com/blog/2017/02/07/gui-applications-docker-mac/). 171 | 172 | ### `cypress-open` 173 | 174 | To open cypress in "interactive" mode, run the following command: 175 | 176 | ```shell 177 | ddev cypress-open 178 | ``` 179 | 180 | See ["#cypress open" documentation](https://docs.cypress.io/guides/guides/command-line#cypress-open) for a full list of available arguments. 181 | 182 | Example: To open Cypress in interactive mode, and specify a config file 183 | 184 | ```shell 185 | ddev cypress-open --config cypress.json 186 | ``` 187 | 188 | ### `cypress-run` 189 | 190 | To run Cypress in "runner" mode, run the following command: 191 | 192 | ```shell 193 | ddev cypress-run 194 | ``` 195 | 196 | See [#cypress run](https://docs.cypress.io/guides/guides/command-line#cypress-run) for a full list of available arguments. 197 | 198 | Example: To run all Cypress tests, using Chrome in headless mode 199 | 200 | ```shell 201 | ddev cypress-run --browser chrome 202 | ``` 203 | 204 | ## Notes 205 | 206 | - The dockerized Cypress *should* find any locally installed plugins in your project's `node_modules`; assuming they are install via npm or yarn. 207 | - Some plugins may require specific settings, such as environmental variables. Pass them through via command arguments. 208 | 209 | ## Troubleshooting 210 | 211 | ### "Could not find a Cypress configuration file, exiting" 212 | 213 | Cypress expects a directory structures containing the tests, plugins and support files. 214 | 215 | - If the `./cypress` directory does not exist, it will scaffold out these directories, including a default `cypress.json` setting file and example tests when you first run `ddev cypress-open`. 216 | - Make sure you have a `cypress.json` file in your project root, or use `--config [file]` argument to specify one. 217 | 218 | ### "Unable to open X display." 219 | 220 | - This recipe forwards the Cypress GUI via an X11 / X410 server. Please ensure you have this working on your host system. 221 | 222 | __Contributed by [@tyler36](https://github.com/tyler36)__ 223 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | --------------------------------------------------------------------------------