Skip to content
Snippets Groups Projects
.gitlab-ci.yml 1.4 KiB
Newer Older
Trygve Jørgensen's avatar
Trygve Jørgensen committed
image: node:20-slim
Trygve Jørgensen's avatar
Trygve Jørgensen committed
cache:
  key: ${CI_COMMIT_REF_SLUG}
  paths:
    - node_modules/

  artifacts:
    paths:
      - node_modules/

lint-code:
  stage: lint_and_format
  script:
    - npm run lint

test:e2e:
  image: cypress/browsers:node16.14.2-slim-chrome100-ff99-edge
    - npm ci --cache .npm --prefer-offline
    - npx cypress verify
    - npm run test:e2e

test-coverage:
  stage: test
  script:
    - npm run test:coverage

include:
  - template: SAST.gitlab-ci.yml

sast:
  stage: security_scan
  script:
    - echo "Running SAST..."

deploy:
  stage: deploy
  image: docker:latest
  tags:
    - dind
  services:
    - name: docker:dind
  variables:
    DOCKER_DRIVER: overlay2
    DOCKER_IMAGE_NAME: $CI_REGISTRY_USER/idatt2106_2024_02_frontend-app
    DOCKER_TLS_CERTDIR: ""
    DOCKER_HOST: tcp://docker:2375
  script:
    - echo "$CI_REGISTRY_PASSWORD" | docker login --username $CI_REGISTRY_USER --password-stdin
    - docker build -t $DOCKER_IMAGE_NAME:latest .
    - docker push $DOCKER_IMAGE_NAME:latest