Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #12 from KnapsackPro/semaphore-2.0
Browse files Browse the repository at this point in the history
Add support for Semaphore CI 2.0
  • Loading branch information
ArturT authored Mar 15, 2019
2 parents ea64031 + b0e8351 commit 0171ea5
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 9 deletions.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ Read article about [runnning javascript E2E tests faster with Cypress on paralle
- [GitLab CI `>= 11.5`](#gitlab-ci--115)
- [GitLab CI `< 11.5` (old GitLab CI)](#gitlab-ci--115-old-gitlab-ci)
- [SemaphoreCI.com](#semaphorecicom)
- [Semaphore 2.0](#semaphore-20)
- [Semaphore 1.0](#semaphore-10)
- [Cirrus-CI.org](#cirrus-ciorg)
- [Jenkins](#jenkins)
- [Other CI provider](#other-ci-provider)
Expand Down Expand Up @@ -309,6 +311,42 @@ test_ci_node_1:
#### SemaphoreCI.com
##### Semaphore 2.0
`@knapsack-pro/cypress` supports environment variables provided by Semaphore CI 2.0 to run your tests. You will have to define a few things in `.semaphore/semaphore.yml` config file.
- You need to set `KNAPSACK_PRO_TEST_SUITE_TOKEN_CYPRESS`. If you don't want to commit secrets in yml file then you can [follow this guide](https://docs.semaphoreci.com/article/66-environment-variables-and-secrets).
- You need to create as many jobs with unique names (Node 0 - Knapsack Pro, Node 1 - Knapsack Pro etc) as many parallel jobs you want to run. If your test suite is long you should use more parallel jobs.
- If you have 2 parallel jobs you need to set `KNAPSACK_PRO_CI_NODE_TOTAL=2` for each job.
- You need to set job index starting from 0 like `KNAPSACK_PRO_CI_NODE_INDEX=0` for Node 0.
Below you can find example part of Semaphore CI 2.0 config.
```yaml
blocks:
- name: Cypress tests
task:
env_vars:
- name: KNAPSACK_PRO_TEST_SUITE_TOKEN_CYPRESS
value: your_api_token_here
prologue:
commands:
- checkout
- nvm install --lts carbon
- sem-version node --lts carbon
jobs:
- name: Node 0 - Knapsack Pro
commands:
- KNAPSACK_PRO_CI_NODE_TOTAL=2 KNAPSACK_PRO_CI_NODE_INDEX=0 $(npm bin)/knapsack-pro-cypress
- name: Node 1 - Knapsack Pro
commands:
- KNAPSACK_PRO_CI_NODE_TOTAL=2 KNAPSACK_PRO_CI_NODE_INDEX=1 $(npm bin)/knapsack-pro-cypress
```

##### Semaphore 1.0

The only thing you need to do is set up `@knapsack-pro/cypress` for as many parallel threads as you need. Here is an example:

```
Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"knapsack-pro-cypress": "lib/knapsack-pro-cypress.js"
},
"dependencies": {
"@knapsack-pro/core": "^1.1.0",
"@knapsack-pro/core": "^1.2.0",
"cypress": "^3.1.5",
"glob": "^7.1.3",
"minimist": "^1.2.0"
Expand Down

0 comments on commit 0171ea5

Please sign in to comment.