.gitlab-ci.yml 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. stages:
  2. - build
  3. - test
  4. - analysis
  5. variables:
  6. APP_ENV: ci
  7. cache:
  8. paths:
  9. - ./node_modules
  10. - .yarn
  11. - yarn.lock
  12. build_image:
  13. stage: build
  14. image: docker:20.10
  15. before_script:
  16. - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
  17. script:
  18. - docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA .
  19. - docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:latest
  20. - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
  21. - docker push $CI_REGISTRY_IMAGE:latest
  22. .default_config: &default_config
  23. image: $CI_REGISTRY_IMAGE:latest
  24. before_script:
  25. - yarn install --network-timeout 10000
  26. - HOSTNAME=ci yarn prepare
  27. unit:
  28. <<: *default_config
  29. stage: test
  30. script:
  31. - yarn test
  32. artifacts:
  33. paths:
  34. - ./coverage/
  35. when: always
  36. reports:
  37. junit: coverage/junit.xml
  38. coverage_report:
  39. coverage_format: cobertura
  40. path: coverage/cobertura-coverage.xml
  41. # Extract total coverage from job logs (https://docs.gitlab.com/15.6/ee/ci/yaml/index.html#coverage)
  42. coverage: '/All files\s*|\s*\d+\.\d+/'
  43. code_quality:
  44. <<: *default_config
  45. stage: analysis
  46. script:
  47. - yarn eslint
  48. code_style:
  49. <<: *default_config
  50. stage: analysis
  51. script:
  52. - yarn prettier . --check