config.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. - run: apk update && apk add git openssh
  60. - checkout
  61. - setup_remote_docker
  62. - run: docker build . --no-cache
  63. docker-push-branch:
  64. docker:
  65. - image: docker:stable
  66. environment:
  67. IMAGE: threema/threema-web
  68. steps:
  69. - run: apk update && apk add git openssh
  70. - checkout
  71. - setup_remote_docker
  72. - run: >
  73. docker build . --no-cache -t $IMAGE:${CIRCLE_BRANCH}
  74. && docker login -u $DOCKER_USER -p $DOCKER_API_KEY
  75. && docker push $IMAGE
  76. docker-push-tag:
  77. docker:
  78. - image: docker:stable
  79. environment:
  80. IMAGE: threema/threema-web
  81. steps:
  82. - run: apk update && apk add git openssh
  83. - checkout
  84. - setup_remote_docker
  85. - run: >
  86. export minortag=$(echo $CIRCLE_TAG | sed 's/^\(v[0-9]*\.[0-9]*\)\..*$/\1/')
  87. majortag=$(echo $CIRCLE_TAG | sed 's/^\(v[0-9]*\)\..*$/\1/')
  88. docker build . --no-cache -t $IMAGE:$CIRCLE_TAG -t $IMAGE:$minortag -t $IMAGE:$majortag
  89. && docker login -u $DOCKER_USER -p $DOCKER_API_KEY
  90. && docker push $IMAGE
  91. docker-rebuild-images:
  92. docker:
  93. - image: docker:stable
  94. steps:
  95. - run: apk update && apk add git openssh bash git
  96. - checkout
  97. - setup_remote_docker
  98. - run: /bin/bash docker/rebuild.sh
  99. workflows:
  100. version: 2
  101. build:
  102. jobs:
  103. - unittest-node8
  104. - unittest-node10
  105. - uitest-firefox
  106. - uitest-chrome
  107. - lint
  108. - docker-build:
  109. filters:
  110. branches:
  111. ignore: master
  112. - docker-push-branch:
  113. filters:
  114. branches:
  115. only: master
  116. - docker-push-tag:
  117. filters:
  118. # Only build for tag, not for branch
  119. tags:
  120. only: /^v.*/
  121. branches:
  122. ignore: /.*/
  123. rebuild-images:
  124. triggers:
  125. - schedule:
  126. cron: "30 5 * * 1,4"
  127. filters:
  128. branches:
  129. only:
  130. - master
  131. jobs:
  132. - docker-rebuild-images