Skip to content
This repository has been archived by the owner on Jul 4, 2019. It is now read-only.

Commit

Permalink
Merge pull request #53 from Financial-Times/circle2-migration
Browse files Browse the repository at this point in the history
Migrate kmt-header to CircleCI 2.0
  • Loading branch information
simonplend authored Jul 6, 2018
2 parents 5d37955 + 2d6629e commit 05b6856
Show file tree
Hide file tree
Showing 2 changed files with 164 additions and 10 deletions.
164 changes: 164 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
# generator: n-circle2-cli
# template: component

references:

container_config_node8: &container_config_node8
working_directory: ~/project/build
docker:
- image: circleci/node:8-browsers

container_config_lambda_node8: &container_config_lambda_node8
working_directory: ~/project/build
docker:
- image: lambci/lambda:build-nodejs8.10

workspace_root: &workspace_root
~/project

attach_workspace: &attach_workspace
attach_workspace:
at: *workspace_root

npm_cache_keys: &npm_cache_keys
keys:
- v1-dependency-npm-{{ checksum "package.json" }}-
- v1-dependency-npm-{{ checksum "package.json" }}
- v1-dependency-npm-

cache_npm_cache: &cache_npm_cache
save_cache:
key: v1-dependency-npm-{{ checksum "package.json" }}-{{ epoch }}
paths:
- ./node_modules/

restore_npm_cache: &restore_npm_cache
restore_cache:
<<: *npm_cache_keys

filters_only_master: &filters_only_master
branches:
only: master

filters_ignore_master: &filters_ignore_master
branches:
ignore: master

filters_ignore_tags: &filters_ignore_tags
tags:
ignore: /.*/

filters_version_tag: &filters_version_tag
tags:
only:
- /^v?\d+\.\d+\.\d+(?:-beta\.\d+)?$/
branches:
ignore: /.*/

version: 2

jobs:

build:
<<: *container_config_node8
steps:
- checkout
- run:
name: Checkout next-ci-shared-helpers
command: git clone --depth 1 git@github.com:Financial-Times/next-ci-shared-helpers.git .circleci/shared-helpers
- *restore_npm_cache
- run:
name: Install project dependencies
command: make install
- run:
name: shared-helper / npm-install-peer-deps
command: .circleci/shared-helpers/helper-npm-install-peer-deps
- run:
name: shared-helper / npm-update
command: .circleci/shared-helpers/helper-npm-update
- run:
name: shared-helper / generate-build-state-artifacts
command: .circleci/shared-helpers/helper-generate-build-state-artifacts
when: always
- *cache_npm_cache
- store_artifacts:
path: build-state
destination: build-state
- persist_to_workspace:
root: *workspace_root
paths:
- build

test:
<<: *container_config_node8
steps:
- *attach_workspace
- run:
name: Run tests
command: make test
environment:
JEST_JUNIT_OUTPUT: test-results/jest/results.xml
MOCHA_FILE: test-results/mocha/results.xml
- store_test_results:
path: test-results
- store_artifacts:
path: test-results
destination: test-results

publish:
<<: *container_config_node8
steps:
- *attach_workspace
- run:
name: shared-helper / npm-store-auth-token
command: .circleci/shared-helpers/helper-npm-store-auth-token
- run:
name: shared-helper / npm-version-and-publish-public
command: .circleci/shared-helpers/helper-npm-version-and-publish-public

workflows:

version: 2

build-test:
jobs:
- build:
filters:
<<: *filters_ignore_tags
- test:
requires:
- build

build-test-publish:
jobs:
- build:
filters:
<<: *filters_version_tag
- test:
filters:
<<: *filters_version_tag
requires:
- build
- publish:
filters:
<<: *filters_version_tag
requires:
- test

nightly:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
<<: *filters_only_master
jobs:
- build:
context: next-nightly-build
- test:
requires:
- build
context: next-nightly-build

notify:
webhooks:
- url: https://ft-next-webhooks.herokuapp.com/circleci2-workflow
10 changes: 0 additions & 10 deletions circle.yml

This file was deleted.

0 comments on commit 05b6856

Please sign in to comment.