.gitlab-ci.yml 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. - echo "" > ./env/local.app.opentalent.fr.crt
  26. - echo "" > ./env/local.app.opentalent.fr.key
  27. - yarn install --network-timeout 10000
  28. - HOSTNAME=ci yarn prepare
  29. unit:
  30. <<: *default_config
  31. stage: test
  32. script:
  33. - yarn test
  34. artifacts:
  35. paths:
  36. - ./coverage/
  37. when: always
  38. reports:
  39. junit: coverage/junit.xml
  40. coverage_report:
  41. coverage_format: cobertura
  42. path: coverage/cobertura-coverage.xml
  43. # Extract total coverage from job logs (https://docs.gitlab.com/15.6/ee/ci/yaml/index.html#coverage)
  44. coverage: '/All files\s*|\s*\d+\.\d+/'
  45. code_quality:
  46. <<: *default_config
  47. stage: analysis
  48. script:
  49. - yarn eslint
  50. code_style:
  51. <<: *default_config
  52. stage: analysis
  53. script:
  54. - yarn prettier . --check