-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #107 from Financial-Times/matth/circle
Switch to circle CI
- Loading branch information
Showing
16 changed files
with
241 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
version: 2 | ||
|
||
references: | ||
|
||
# | ||
# Workspace | ||
# | ||
container_config_node8: &container_config_node8 | ||
working_directory: ~/project/build | ||
docker: | ||
- image: circleci/node:8 | ||
|
||
workspace_root: &workspace_root | ||
~/project | ||
|
||
attach_workspace: &attach_workspace | ||
attach_workspace: | ||
at: *workspace_root | ||
|
||
# | ||
# Cache keys | ||
# | ||
cache_keys_root: &cache_keys_root | ||
keys: | ||
- cache-root-v1-{{ checksum "./package.json" }} | ||
- cache-root-v1- | ||
|
||
cache_keys_docs: &cache_keys_docs | ||
keys: | ||
- cache-docs-v1-{{ checksum "./tools/x-docs/package.json" }} | ||
- cache-docs-v1- | ||
|
||
cache_keys_workbench: &cache_keys_workbench | ||
keys: | ||
- cache-workbench-v1-{{ checksum "./tools/x-workbench/package.json" }} | ||
- cache-workbench-v1- | ||
|
||
# | ||
# Cache creation | ||
# | ||
create_cache_root: &create_cache_root | ||
save_cache: | ||
key: cache-root-v1-{{ checksum "./package.json" }} | ||
paths: | ||
- ./node_modules/ | ||
|
||
create_cache_docs: &create_cache_docs | ||
save_cache: | ||
key: cache-docs-v1-{{ checksum "./tools/x-docs/package.json" }} | ||
paths: | ||
- ./tools/x-docs/node_modules/ | ||
|
||
create_cache_workbench: &create_cache_workbench | ||
save_cache: | ||
key: cache-workbench-v1-{{ checksum "./tools/x-workbench/package.json" }} | ||
paths: | ||
- ./tools/x-workbench/node_modules/ | ||
|
||
# | ||
# Cache restoration | ||
# | ||
restore_cache_root: &restore_cache_root | ||
restore_cache: | ||
<<: *cache_keys_root | ||
|
||
restore_cache_docs: &restore_cache_docs | ||
restore_cache: | ||
<<: *cache_keys_docs | ||
|
||
restore_cache_workbench: &restore_cache_workbench | ||
restore_cache: | ||
<<: *cache_keys_workbench | ||
|
||
# | ||
# Filters | ||
# | ||
filters_branch_build: &filters_branch_build | ||
branches: | ||
ignore: | ||
- gh-pages | ||
tags: | ||
ignore: /.*/ | ||
|
||
filters_release_build: &filters_release_build | ||
tags: | ||
only: | ||
- /^v\d+\.\d+\.\d+(?:-(?:\w+\.)?\d+)?$/ | ||
branches: | ||
ignore: /.*/ | ||
|
||
jobs: | ||
|
||
build: | ||
<<: *container_config_node8 | ||
steps: | ||
- checkout | ||
- run: | ||
name: Checkout next-ci-shared-helpers | ||
command: git clone --depth 1 [email protected]:Financial-Times/next-ci-shared-helpers.git .circleci/shared-helpers | ||
- *restore_cache_root | ||
- *restore_cache_docs | ||
- *restore_cache_workbench | ||
- run: | ||
name: Install project dependencies | ||
command: make install | ||
- run: | ||
name: Run the project build task | ||
command: make build | ||
- *create_cache_root | ||
- *create_cache_docs | ||
- *create_cache_workbench | ||
- persist_to_workspace: | ||
root: *workspace_root | ||
paths: | ||
- build | ||
|
||
test: | ||
<<: *container_config_node8 | ||
steps: | ||
- *attach_workspace | ||
- run: | ||
name: Run tests | ||
command: make test | ||
|
||
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: NPM publish | ||
command: npx athloi version ${CIRCLE_TAG} && npx athloi publish -- --access=public | ||
- run: | ||
name: Publish GitHub Pages | ||
command: ./private/scripts/gh-pages | ||
|
||
workflows: | ||
|
||
version: 2 | ||
|
||
build-test: | ||
jobs: | ||
- build: | ||
filters: | ||
<<: *filters_branch_build | ||
- test: | ||
filters: | ||
<<: *filters_branch_build | ||
requires: | ||
- build | ||
|
||
build-test-publish: | ||
jobs: | ||
- build: | ||
filters: | ||
<<: *filters_release_build | ||
- test: | ||
filters: | ||
<<: *filters_release_build | ||
requires: | ||
- build | ||
- publish: | ||
filters: | ||
<<: *filters_release_build | ||
requires: | ||
- test | ||
|
||
notify: | ||
webhooks: | ||
- url: https://ft-next-webhooks.herokuapp.com/circleci2-workflow |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ clean: | |
@git clean -fxdi | ||
|
||
install: | ||
npm install | ||
npm install --no-package-lock | ||
|
||
build: | ||
npm run build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,5 @@ | |
"components/*", | ||
"packages/*", | ||
"tools/*" | ||
], | ||
"version": "1.0.0-1" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/usr/bin/env bash | ||
|
||
TARGET_DIR=tools/x-docs/public/* | ||
TARGET_BRANCH=gh-pages | ||
TEMP_DIR=tmp | ||
|
||
# Set error handling | ||
set -eu -o pipefail | ||
|
||
# Set GitHub user information (the email must match the SSH key provided to Circle) | ||
git config --global user.email $GITHUB_EMAIL | ||
git config --global user.name $GITHUB_NAME | ||
|
||
# HACK: Add GitHub to known hosts to avoid an interactive prompt when cloning over SSH | ||
ssh-keyscan -H github.com >> ~/.ssh/known_hosts | ||
|
||
# Clone only the branch we need so we don't download all of the project history | ||
git clone $CIRCLE_REPOSITORY_URL $TEMP_DIR --single-branch --branch $TARGET_BRANCH | ||
|
||
# Remove all of the files, -q prevents logging every filename | ||
cd $TEMP_DIR | ||
git rm -rq . | ||
cd .. | ||
|
||
# Copy contents of target directory to the deployment directory | ||
cp -r $TARGET_DIR $TEMP_DIR | ||
|
||
# Copy CI config (which should instruct Circle to ignore this branch) | ||
cp -r .circleci $TEMP_DIR | ||
|
||
# Stage and commit all of the files, silencing the list output | ||
git add -A &> /dev/null | ||
git commit -m "Automated deployment to GitHub Pages: ${CIRCLE_SHA1}" --allow-empty | ||
|
||
# Push to the target branch, staying quiet unless something goes wrong | ||
git push -q origin $TARGET_BRANCH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
.cache | ||
bower_components | ||
/public | ||
travis_deploy_key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.