123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- version: 2
- references:
- test-steps: &test-steps
- - checkout
- - restore_cache:
- keys:
- - v3-dependencies-{{ .Environment.CIRCLE_JOB }}-{{ arch }}-{{ checksum "package.json" }}
- - run: npm install
- - run: npm run build
- - run: npm run ${BUILDTARGET}
- - run: npm run ${TESTTARGET}
- - save_cache:
- key: v3-dependencies-{{ .Environment.CIRCLE_JOB }}-{{ arch }}-{{ checksum "package.json" }}
- paths:
- - node_modules
- jobs:
- unittest:
- docker:
- - image: circleci/node:12-browsers
- steps: *test-steps
- environment:
- BUILDTARGET: build:unittests
- TESTTARGET: test:unit
- uitest-firefox:
- docker:
- - image: circleci/node:12-browsers
- steps: *test-steps
- environment:
- BUILDTARGET: build:uitests
- TESTTARGET: test:ui firefox
- uitest-chrome:
- docker:
- - image: circleci/node:12-browsers
- steps: *test-steps
- environment:
- BUILDTARGET: build:uitests
- TESTTARGET: test:ui chrome
- lint:
- docker:
- - image: circleci/node:12-browsers
- steps:
- - checkout
- - restore_cache:
- keys:
- - v3-dependencies-test-node12-{{ arch }}-{{ checksum "package.json" }}
- - run: npm install
- - run: npm run lint
- docker-build:
- docker:
- - image: docker:stable
- steps:
- - run: apk update && apk add git openssh
- - checkout
- - setup_remote_docker
- - run: docker build . --no-cache
- docker-push-branch:
- docker:
- - image: docker:stable
- environment:
- IMAGE: threema/threema-web
- steps:
- - run: apk update && apk add git openssh
- - checkout
- - setup_remote_docker
- - run: >
- docker build . --no-cache -t $IMAGE:${CIRCLE_BRANCH}
- && docker login -u $DOCKER_USER -p $DOCKER_API_KEY
- && docker push $IMAGE
- docker-push-tag:
- docker:
- - image: docker:stable
- environment:
- IMAGE: threema/threema-web
- steps:
- - run: apk update && apk add git openssh
- - checkout
- - setup_remote_docker
- - run: >
- export minortag=$(echo $CIRCLE_TAG | sed 's/^\(v[0-9]*\.[0-9]*\)\..*$/\1/')
- majortag=$(echo $CIRCLE_TAG | sed 's/^\(v[0-9]*\)\..*$/\1/')
- docker build . --no-cache -t $IMAGE:$CIRCLE_TAG -t $IMAGE:$minortag -t $IMAGE:$majortag
- && docker login -u $DOCKER_USER -p $DOCKER_API_KEY
- && docker push $IMAGE
- docker-rebuild-images:
- docker:
- - image: docker:stable
- steps:
- - run: apk update && apk add git openssh bash git
- - checkout
- - setup_remote_docker
- - run: /bin/bash docker/rebuild.sh
- workflows:
- version: 2
- build:
- jobs:
- - unittest
- - uitest-firefox
- - uitest-chrome
- - lint
- - docker-build:
- filters:
- branches:
- ignore: master
- - docker-push-branch:
- filters:
- branches:
- only: master
- - docker-push-tag:
- filters:
- # Only build for tag, not for branch
- tags:
- only: /^v.*/
- branches:
- ignore: /.*/
- rebuild-images:
- triggers:
- - schedule:
- cron: "30 5 * * 1,4"
- filters:
- branches:
- only:
- - master
- jobs:
- - docker-rebuild-images
|