Skip to content
Snippets Groups Projects
.gitlab-ci.yml 2.18 KiB
Newer Older
Plup's avatar
Plup committed
# workflow
stages:
Plup's avatar
Plup committed
 - build
 - test
 - integration
 - acceptance
plup's avatar
plup committed
 - release
Plup's avatar
Plup committed
# default image for jobs
default:
  image: node:14
Plup's avatar
Plup committed

# cache modules between jobs
cache:
  key: ${CI_COMMIT_REF_SLUG}
  paths:
    - .npm/

## BUILD ##

build:
  stage: build
  before_script:
    - npm ci --cache .npm --prefer-offline --only=production
  script:
    - cp config.sample.json config.json
    - npm run build
  artifacts:
    when: on_success
    expire_in: 1 day
    paths:
      - dist/
plup's avatar
plup committed
  except:
    - tags
Plup's avatar
Plup committed
  tags:
    - test

## TESTING ##

Plup's avatar
Plup committed
test:e2e:
  stage: test
  image: cypress/included:5.6.0
Plup's avatar
Plup committed
  services:
    - name: ${CI_REGISTRY_IMAGE}/djangoldp:latest
Plup's avatar
Plup committed
  before_script:
    # install missing dependencies
    - npm install -g sirv-cli
    - npm install cypress-localstorage-commands
Plup's avatar
Plup committed
     # making sure the process is orphan
    - sirv dist --port 3000 > /dev/null 2>&1 &
  script:
    - cypress run -e CYPRESS_baseUrl=http://localhost:3000
plup's avatar
plup committed
  except:
    - tags
Plup's avatar
Plup committed
  tags:
    - test

## VALIDATION ##

plup's avatar
plup committed
include:
  project: infra/gitlab
  ref: master
  file: templates/deploy.ci.yml

test1:
plup's avatar
plup committed
  extends: .ansible
  stage: integration
  environment:
    name: test1
    url: https://test1.startinblox.com
plup's avatar
plup committed
    - /^feature\/.*/
  when: manual

test2:
  extends: .ansible
  stage: integration
  environment:
    name: test2
    url: https://test2.startinblox.com
plup's avatar
plup committed
    - /^feature\/.*/
  when: manual
test3:
  extends: .ansible
  stage: integration
  environment:
    name: test3
    url: https://test3.startinblox.com
  only:
plup's avatar
plup committed
    - /^feature\/.*/
  extends: .ansible
  stage: acceptance
  environment:
    name: stg1
    url: https://stg1.startinblox.com
  only:
    - /^release\/.*/
  when: manual
  extends: .ansible
  stage: acceptance
  environment:
    name: stg2
    url: https://stg2.startinblox.com
    - /^release\/.*/
  when: manual
plup's avatar
plup committed
## RELEASE TAGGING ##

publish:
  stage: release
plup's avatar
plup committed
  image: ${CI_REGISTRY}/infra/docker/jsrelease:latest
plup's avatar
plup committed
  script:
    - semantic-release
  only:
    - master
  tags:
    - deploy

## LIVE DEPLOYMENTS ##
plup's avatar
plup committed
hublworld:
  extends: .ansible
plup's avatar
plup committed
  only:
    - master
plup's avatar
plup committed
happydev:
  extends: .ansible
plup's avatar
plup committed
  only:
    - master
  when: manual