.gitlab-ci.yml 1.02 KB
Newer Older
Alexandre Morin's avatar
Alexandre Morin committed
1
# Docker images provided by https://github.com/cypress-io/cypress-docker-images
Alexandre Morin's avatar
Alexandre Morin committed
2

Alexandre Morin's avatar
Alexandre Morin committed
3
# first, install Cypress, then run all tests (in parallel)
Alexandre Morin's avatar
Alexandre Morin committed
4
5
6
stages:
  - test

Alexandre Morin's avatar
Alexandre Morin committed
7
8
9
10
11
12
13
14
# to cache both npm modules and Cypress binary we use environment variables
# to point at the folders we can list as paths in "cache" job settings
variables:
  npm_config_cache: /builds/cypress-io/cypress-example-docker-gitlab/.npm
  CYPRESS_CACHE_FOLDER: /builds/cypress-io/cypress-example-docker-gitlab/cache/Cypress

# cache using branch name
# https://gitlab.com/help/ci/caching/index.md
Alexandre Morin's avatar
Alexandre Morin committed
15
16
17
18
19
20
cache:
  key: ${CI_COMMIT_REF_SLUG}
  paths:
    - .npm
    - cache/Cypress
    - node_modules
Alexandre Morin's avatar
Alexandre Morin committed
21

Alexandre Morin's avatar
Alexandre Morin committed
22
23
# two jobs that run after "install" job finishes
# NPM dependencies and Cypress binary should be already installed
Alexandre Morin's avatar
Alexandre Morin committed
24
functional-test:cypress:
Alexandre Morin's avatar
Alexandre Morin committed
25
26
27
  image: cypress/base:10
  stage: test
  script:
Alexandre Morin's avatar
Alexandre Morin committed
28
29
    - npm ci
    - $(npm bin)/cypress verify
Alexandre Morin's avatar
Alexandre Morin committed
30
    - $(npm bin)/cypress run
Alexandre Morin's avatar
Alexandre Morin committed
31
32
  only:
    - schedules
Alexandre Morin's avatar
Alexandre Morin committed
33
34
35
36
37
38
  artifacts:
    expire_in: 1 week
    when: always
    paths:
      - cypress/screenshots
      - cypress/videos