.gitlab-ci.yml 1.5 KB

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