version: 2 references: test-steps: &test-steps - checkout - restore_cache: keys: - v2-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: v2-dependencies-{{ .Environment.CIRCLE_JOB }}-{{ arch }}-{{ checksum "package.json" }} paths: - node_modules jobs: unittest-node8: docker: - image: circleci/node:8-browsers steps: *test-steps environment: BUILDTARGET: build:unittests TESTTARGET: test:unit unittest-node10: docker: - image: circleci/node:10-browsers steps: *test-steps environment: BUILDTARGET: build:unittests TESTTARGET: test:unit uitest-firefox: docker: - image: circleci/node:10-browsers steps: *test-steps environment: BUILDTARGET: build:uitests TESTTARGET: test:ui firefox uitest-chrome: docker: - image: circleci/node:10-browsers steps: *test-steps environment: BUILDTARGET: build:uitests TESTTARGET: test:ui chrome lint: docker: - image: circleci/node:8-browsers steps: - checkout - restore_cache: keys: - v2-dependencies-test-node8-{{ arch }}-{{ checksum "package.json" }} - run: npm install - run: npm run lint docker-build: docker: - image: docker:stable steps: - checkout - setup_remote_docker - run: docker build . --no-cache docker-push-branch: docker: - image: docker:stable steps: - checkout - setup_remote_docker - run: > docker build . --no-cache -t threema/threema-web:${CIRCLE_BRANCH} && docker login -u $DOCKER_USER -p $DOCKER_API_KEY && docker push threema/threema-web docker-push-tag: docker: - image: docker:stable environment: IMAGE: threema/threema-web steps: - 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 threema/threema-web docker-rebuild-images: docker: - image: docker:stable steps: - checkout - setup_remote_docker - run: bash docker/rebuild.sh workflows: version: 2 build: jobs: - unittest-node8 - unittest-node10 - uitest-firefox - uitest-chrome - lint - docker-build: filters: branches: ignore: master - docker-push-branch: filters: branches: only: master - docker-push-tag: filters: branches: only: /v[0-9.]*/ weekly: triggers: - schedule: cron: "45 14 * * 4" filters: branches: only: - master jobs: - docker-rebuild-images