Skip to content

Instantly share code, notes, and snippets.

@ArturT
Created October 19, 2019 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ArturT/9e219ad72cbffb64e3c0d82bbf2cee2b to your computer and use it in GitHub Desktop.
Save ArturT/9e219ad72cbffb64e3c0d82bbf2cee2b to your computer and use it in GitHub Desktop.
Codefresh.io example for Cypress.io E2E test runner - parallel testing. Example from blog post https://docs.knapsackpro.com/2019/how-to-run-cypress-parallel-tests-on-codefresh-ci-server
# .codefresh/codefresh.yml
version: "1.0"
stages:
- "clone"
- "build"
- "tests"
steps:
main_clone:
type: "git-clone"
description: "Cloning main repository..."
repo: "${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}"
revision: "${{CF_BRANCH}}"
stage: "clone"
BuildTestDockerImage:
title: Building Test Docker image
type: build
arguments:
image_name: "${{CF_ACCOUNT}}/${{CF_REPO_NAME}}-test"
tag: "${{CF_BRANCH_TAG_NORMALIZED}}-${{CF_SHORT_REVISION}}"
dockerfile: Test.Dockerfile
stage: "build"
run_tests:
stage: "tests"
image: "${{BuildTestDockerImage}}"
working_directory: /src
fail_fast: false
environment:
# set how many parallel jobs you want to run
- KNAPSACK_PRO_CI_NODE_TOTAL=2
matrix:
environment:
# please ensure you have here listed N-1 indexes
# where N is KNAPSACK_PRO_CI_NODE_TOTAL
- KNAPSACK_PRO_CI_NODE_INDEX=0
- KNAPSACK_PRO_CI_NODE_INDEX=1
commands:
# run http server in the background (silent mode)
# we did && echo on purpose to ensure Codefresh does not fail
# when we pass npm process to background with & sign
- (npm run start:ci &) && echo "start http server in the background"
- $(npm bin)/knapsack-pro-cypress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment