Код IT
← Каталог

Gitverse - отечественная альтернатива Git — Структура конфигурации

Фрагмент из «Gitverse - отечественная альтернатива Git»: Структура конфигурации.

yaml infra-securityencyclopedia8-03-zabota-o-kode-i-dannyh-1181 embed URL статья в энциклопедии
YAML main.yaml
stages:
  - lint
  - build
  - test
  - deploy

lint:
  stage: lint
  script:
    - npm run lint
    - python -m flake8 .
  artifacts:
    reports:
      coverage_report: coverage.xml

build:
  stage: build
  image: node:18-alpine
  script:
    - npm install
    - npm run build
  artifacts:
    paths:
      - dist/

test:
  stage: test
  image: node:18-alpine
  script:
    - npm test
  coverage: '/Test Result.*([0-9]{1,3})%/'

deploy:
  stage: deploy
  image: alpine:latest
  script:
    - cp dist/* /var/www/html/
  only:
    - main
  environment:
    name: production
    url: https://example.com
stages:
  - lint
  - build
  - test
  - deploy

lint:
  stage: lint
  script:
    - npm run lint
    - python -m flake8 .
  artifacts:
    reports:
      coverage_report: coverage.xml

build:
  stage: build
  image: node:18-alpine
  script:
    - npm install
    - npm run build
  artifacts:
    paths:
      - dist/

test:
  stage: test
  image: node:18-alpine
  script:
    - npm test
  coverage: '/Test Result.*([0-9]{1,3})%/'

deploy:
  stage: deploy
  image: alpine:latest
  script:
    - cp dist/* /var/www/html/
  only:
    - main
  environment:
    name: production
    url: https://example.com