Skip to content
Snippets Groups Projects
.prod-ci.yml 1.44 KiB
Newer Older
variables:
  CYPRESS_RECORD_KEY: $CYPRESS_RECORD_KEY

stages:          # List of stages for jobs, and their order of execution
  - build
  - test
  - deploy

build-job:       # This job runs in the build stage, which runs first.
  stage: build
  script:
    - npm ci
    - npm run build
    - chmod u+x node_modules
  tags:
    - build-runner  # Use the runner with correct tag to run this pipeline
unit-test-job:
  image: cypress/browsers:node16.16.0-chrome107-ff107-edge
  stage: test
  script:
    - npm ci
    - npm run test-component
  artifacts:
    when: always
    paths:
      - cypress/videos/**/*.mp4
      - cypress/screenshots/**/*.png

      #e2e-test-job:   # This job runs in the test stage.
      #stage: test    # It only starts when the job in the build stage completes successfully.
      #script:
      #- npm run test-e2e
      # tags:
      #- test-runner  # Use the runner with correct tag to run this pipeline

deploy-job:      # This job runs in the deploy stage.
  stage: deploy  # It only runs when *all* jobs in the test stage complete successfully.
  environment: production
  script:
    - touch ./next.log
    - sudo fuser -k $PORT/tcp || true  # Kill any process running on $PORT
    - sudo npm run start $PORT > ./next.log 2>&1 &  # Run the web app
  artifacts:
    paths:
      - next.log  # Keep output from deploy as artifact
  tags:
    - deploy-runner  # Use the runner with correct tag to run this pipeline