config.yml 3.3 KB

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