config.yml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. aliases:
  2. # Cache management
  3. - &restore_yarn_cache
  4. restore_cache:
  5. keys:
  6. - v1-yarn-cache
  7. - &save_yarn_cache
  8. save_cache:
  9. paths:
  10. - ~/.cache/yarn
  11. key: v1-yarn-cache
  12. - &restore_deps_cache
  13. restore_cache:
  14. keys:
  15. - v1-deps-cache-{{ checksum "yarn.lock" }}
  16. - &save_deps_cache
  17. save_cache:
  18. paths:
  19. - node_modules
  20. key: v1-yarn-deps-{{ checksum "yarn.lock" }}
  21. # Default
  22. - &defaults
  23. working_directory: ~/prettier
  24. docker:
  25. - image: circleci/node:9
  26. version: 2
  27. jobs:
  28. # Install dependencies and cache everything
  29. checkout_code:
  30. <<: *defaults
  31. steps:
  32. - checkout
  33. - *restore_yarn_cache
  34. - *restore_deps_cache
  35. - run: yarn install
  36. - run: yarn check-deps
  37. - *save_deps_cache
  38. - *save_yarn_cache
  39. - persist_to_workspace:
  40. root: .
  41. paths:
  42. - .
  43. # Create the production bundle and cache
  44. build_prod:
  45. <<: *defaults
  46. environment:
  47. NODE_ENV: production
  48. steps:
  49. - attach_workspace:
  50. at: ~/prettier
  51. - run: yarn build
  52. - persist_to_workspace:
  53. root: .
  54. paths:
  55. - dist
  56. - store_artifacts:
  57. path: ~/prettier/dist
  58. # Run tests on the production bundle
  59. test_prod_node4:
  60. <<: *defaults
  61. docker:
  62. - image: circleci/node:4
  63. steps:
  64. - attach_workspace:
  65. at: ~/prettier
  66. - run: yarn test:dist
  67. # Run tests on the production bundle
  68. test_prod_node9:
  69. <<: *defaults
  70. steps:
  71. - attach_workspace:
  72. at: ~/prettier
  73. - run: yarn test:dist
  74. workflows:
  75. version: 2
  76. prod:
  77. jobs:
  78. - checkout_code
  79. - build_prod:
  80. requires:
  81. - checkout_code
  82. - test_prod_node4:
  83. requires:
  84. - build_prod
  85. - test_prod_node9:
  86. requires:
  87. - build_prod