config.yml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. version: 2
  2. references:
  3. test-steps: &test-steps
  4. - checkout
  5. - restore_cache:
  6. keys:
  7. - v2-dependencies-{{ .Environment.CIRCLE_JOB }}-{{ arch }}-{{ checksum "package.json" }}
  8. - run: npm install
  9. - run: npm run build
  10. - run: npm run ${BUILDTARGET}
  11. - run: npm run ${TESTTARGET}
  12. - save_cache:
  13. key: v2-dependencies-{{ .Environment.CIRCLE_JOB }}-{{ arch }}-{{ checksum "package.json" }}
  14. paths:
  15. - node_modules
  16. jobs:
  17. unittest-node8:
  18. docker:
  19. - image: circleci/node:8-browsers
  20. steps: *test-steps
  21. environment:
  22. BUILDTARGET: build:unittests
  23. TESTTARGET: test:unit
  24. unittest-node10:
  25. docker:
  26. - image: circleci/node:10-browsers
  27. steps: *test-steps
  28. environment:
  29. BUILDTARGET: build:unittests
  30. TESTTARGET: test:unit
  31. uitest-firefox:
  32. docker:
  33. - image: circleci/node:10-browsers
  34. steps: *test-steps
  35. environment:
  36. BUILDTARGET: build:uitests
  37. TESTTARGET: test:ui firefox
  38. uitest-chrome:
  39. docker:
  40. - image: circleci/node:10-browsers
  41. steps: *test-steps
  42. environment:
  43. BUILDTARGET: build:uitests
  44. TESTTARGET: test:ui chrome
  45. lint:
  46. docker:
  47. - image: circleci/node:8-browsers
  48. steps:
  49. - checkout
  50. - restore_cache:
  51. keys:
  52. - v2-dependencies-test-node8-{{ arch }}-{{ checksum "package.json" }}
  53. - run: npm install
  54. - run: npm run lint
  55. docker-build:
  56. docker:
  57. - image: docker:stable
  58. steps:
  59. - checkout
  60. - setup_remote_docker
  61. - run: docker build . --no-cache
  62. docker-push-branch:
  63. docker:
  64. - image: docker:stable
  65. steps:
  66. - checkout
  67. - setup_remote_docker
  68. - run: >
  69. docker build . --no-cache -t threema/threema-web:${CIRCLE_BRANCH}
  70. && docker login -u $DOCKER_USER -p $DOCKER_API_KEY
  71. && docker push threema/threema-web
  72. docker-push-tag:
  73. docker:
  74. - image: docker:stable
  75. environment:
  76. IMAGE: threema/threema-web
  77. steps:
  78. - checkout
  79. - setup_remote_docker
  80. - run: >
  81. export minortag=$(echo $CIRCLE_TAG | sed 's/^\(v[0-9]*\.[0-9]*\)\..*$/\1/')
  82. majortag=$(echo $CIRCLE_TAG | sed 's/^\(v[0-9]*\)\..*$/\1/')
  83. && docker build . --no-cache -t $IMAGE:$CIRCLE_TAG -t $IMAGE:$minortag -t $IMAGE:$majortag
  84. && docker login -u $DOCKER_USER -p $DOCKER_API_KEY
  85. && docker push threema/threema-web
  86. docker-rebuild-images:
  87. docker:
  88. - image: docker:stable
  89. steps:
  90. - checkout
  91. - setup_remote_docker
  92. - run: bash docker/rebuild.sh
  93. workflows:
  94. version: 2
  95. build:
  96. jobs:
  97. - unittest-node8
  98. - unittest-node10
  99. - uitest-firefox
  100. - uitest-chrome
  101. - lint
  102. - docker-build:
  103. filters:
  104. branches:
  105. ignore: master
  106. - docker-push-branch:
  107. filters:
  108. branches:
  109. only: master
  110. - docker-push-tag:
  111. filters:
  112. branches:
  113. only: /v[0-9.]*/
  114. weekly:
  115. triggers:
  116. - schedule:
  117. cron: "45 14 * * 4"
  118. filters:
  119. branches:
  120. only:
  121. - master
  122. jobs:
  123. - docker-rebuild-images