-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
577fee4
commit af01cb9
Showing
5 changed files
with
136 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,9 +23,54 @@ Authentication is done using basic auth, which is set up based on environment va | |
## Setting up sorry-cypress | ||
|
||
1. Follow the [sorry-cypress setup instructions](https://docs.sorry-cypress.dev/guide/get-started) | ||
- `npm i cypress-cloud` | ||
- Edit `cypress` CLI for `cypress-coud` [see docs](https://docs.sorry-cypress.dev/guide/get-started#running-cypress-tests-in-parallel) | ||
- Add `cloudPlugin` to `cypress.config.js` | ||
2. Set `cloudServiceUrl` in your `currents.config.js` to `https://your_user:[email protected]_domain.com` | ||
3. See `.github-actions.example.yml` for an example for how to set up a parallel resting CI on Github | ||
|
||
### Example usage in Github actions | ||
|
||
You can use the director in Github Actions by setting `currents.config.js` to: | ||
|
||
```js | ||
module.exports = { | ||
projectId: "APP NAME", // the projectId, can be any values for sorry-cypress users | ||
recordKey: "xxx", // the record key, can be any value for sorry-cypress users | ||
cloudServiceUrl: "%%cypress_cloud_service_url%%", // Sorry Cypress users - set the director service URL | ||
} | ||
``` | ||
|
||
And in Github Actions add the URL with authentication using: | ||
|
||
```bash | ||
sed -i "s;%%cypress_cloud_service_url%%;${{ secrets.CYPRESS_CLOUD_SERVICE_URL }};g" currents.config.js | ||
``` | ||
|
||
You can then run parallel testing using: | ||
|
||
```yml | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
# run 3 copies of the current job in parallel | ||
containers: [ 1, 2, 3 ] | ||
``` | ||
You can save the artifacts of the containers for debugging by using: | ||
```yml | ||
# If CI failed, upload the videos for debugging | ||
- name: Upload cypress video files | ||
if: always() # you can optionally set this to failure() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: cypress-videos ${{ matrix.containers }} | ||
path: | | ||
cypress/videos | ||
cypress/screenshots | ||
``` | ||
|
||
## Notes | ||
|
||
**Buildjet is highly recommended** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
version: '3' | ||
|
||
services: | ||
|
||
## ############### | ||
## Infra services | ||
## ############### | ||
|
||
# MongoDB service, this is used by the cypress services to store data | ||
mongo: | ||
image: mongo:4.4 | ||
container_name: mongo | ||
volumes: | ||
- ./data/data-mongo-cypress:/data/db | ||
networks: | ||
- internal | ||
restart: unless-stopped | ||
|
||
# Reverse proxy service, this is used to expose the cypress services to the world securely | ||
swag: | ||
image: lscr.io/linuxserver/swag:latest | ||
container_name: swag | ||
cap_add: | ||
- NET_ADMIN | ||
environment: | ||
# Environment setup | ||
- PUID=1000 | ||
- PGID=1000 | ||
- TZ=Europe/London | ||
# Automatic SSL certificate provisioning | ||
- URL=${PROXY_SERVER_DOMAIN} | ||
- VALIDATION=http | ||
- SUBDOMAINS=${PROXY_DIRECTOR_SUBDOMAIN},${PROXY_API_SUBDOMAIN},${PROXY_DASHBOARD_SUBDOMAIN} | ||
- ONLY_SUBDOMAINS=true | ||
volumes: | ||
- ./swag:/config | ||
ports: | ||
- 443:443 | ||
- 80:80 | ||
depends_on: | ||
- director | ||
- mongo | ||
networks: | ||
- internal | ||
- external | ||
restart: unless-stopped | ||
|
||
|
||
## ############### | ||
## Cypress services | ||
## ############### | ||
|
||
# Cypress director (required) | ||
# Coordinates & parallelizes tests, saves test results, this is the container that the cypress test runner connects to | ||
# This is the only **required** service to run parallel tests, see: https://docs.sorry-cypress.dev/configuration/in-memory | ||
director: | ||
image: agoldis/sorry-cypress-director:latest | ||
container_name: sorry-cypress-director | ||
environment: | ||
MONGODB_URI: 'mongodb://mongo:27017' | ||
MONGODB_DATABASE: 'sorry-cypress' | ||
EXECUTION_DRIVER: '../execution/mongo/driver' | ||
GITLAB_JOB_RETRIES: 'false' | ||
#S3_REGION: us-east-1 | ||
PROBE_LOGGER: "false" | ||
ports: | ||
- 1234:1234 | ||
networks: | ||
- internal | ||
depends_on: | ||
- mongo | ||
restart: unless-stopped |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: '3' | ||
|
||
# Network configuration, we'll make one internal network for the cypress container, and one publicly available network for the proxy | ||
networks: | ||
internal: | ||
name: internal | ||
internal: true | ||
external: | ||
name: external |