config.yml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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 tag=$(git describe --tags --abbrev=0)
  87. minortag=$(echo $tag | sed 's/^\(v[0-9]*\.[0-9]*\)\..*$/\1/')
  88. majortag=$(echo $tag | sed 's/^\(v[0-9]*\)\..*$/\1/')
  89. docker build . --no-cache -t $IMAGE:$tag -t $IMAGE:$minortag -t $IMAGE:$majortag
  90. && docker login -u $DOCKER_USER -p $DOCKER_API_KEY
  91. && docker push $IMAGE
  92. docker-rebuild-images:
  93. docker:
  94. - image: docker:stable
  95. steps:
  96. - run: apk update && apk add git openssh bash git
  97. - checkout
  98. - setup_remote_docker
  99. - run: /bin/bash docker/rebuild.sh
  100. workflows:
  101. version: 2
  102. build:
  103. jobs:
  104. - unittest-node8
  105. - unittest-node10
  106. - uitest-firefox
  107. - uitest-chrome
  108. - lint
  109. - docker-build:
  110. filters:
  111. branches:
  112. ignore: master
  113. - docker-push-branch:
  114. filters:
  115. branches:
  116. only: master
  117. - docker-push-tag:
  118. filters:
  119. tags:
  120. only: /^v.*/
  121. rebuild-images:
  122. triggers:
  123. - schedule:
  124. cron: "30 5 * * 1,4"
  125. filters:
  126. branches:
  127. only:
  128. - master
  129. jobs:
  130. - docker-rebuild-images