config.yml 3.4 KB

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