Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate to circle 2.0 workflow #67

Merged
merged 11 commits into from
May 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
version: 2

# this block contains anchors to reusable blocks of config.
references:
setup_env: &setup_env
docker:
- image: circleci/node:8.10.0
save_cache: &save_cache
key: v1-dependency-cache-{{ checksum "yarn.lock" }}
paths:
- node_modules
restore_cache: &restore_cache
keys:
- v1-dependency-cache-{{ checksum "yarn.lock" }}
- v1-dependency-cache-
reports_path: &reports_path
path: ./reports
run_on_tags: &run_on_tags
filters:
# run this job for tags as well
tags:
only: /.*/

jobs:
build:
<<: *setup_env
steps:
- checkout
- restore_cache: *restore_cache
- attach_workspace:
at: '.'
- run: yarn --frozen-lockfile
- save_cache: *save_cache
- run: mkdir ./reports
- run: yarn compile
- run: yarn lint --format junit --out ./reports/tslint.xml
- store_artifacts:
path: dist
- store_test_results: *reports_path
- persist_to_workspace:
root: '.'
paths:
- dist

test:
<<: *setup_env
steps:
- checkout
- restore_cache: *restore_cache
- attach_workspace:
at: '.'
- run:
command: yarn test --ci --testResultsProcessor="jest-junit"
environment:
JEST_JUNIT_OUTPUT: ./reports/jest.xml
- store_test_results: *reports_path

preview:
<<: *setup_env
steps:
- checkout
- restore_cache: *restore_cache
- attach_workspace:
at: '.'
- run: yarn docs
- store_artifacts:
path: docs
- run:
name: Submit Github comment with links to built artifacts
command: node theme/bot.js
environment:
# circle-github-bot@0.4.0 expects this env variable
CIRCLE_ARTIFACTS: dopedopedope

publish:
<<: *setup_env
steps:
- checkout
- restore_cache: *restore_cache
- attach_workspace:
at: '.'
- run: echo -e "$NPM_USER\n$NPM_PASS\n$NPM_EMAIL" | npm login
- run: npm publish

workflows:
version: 2
build:
jobs:
- build: *run_on_tags
- test: *run_on_tags
- preview:
requires: [build]
# this job never runs on a tag
- publish:
requires: [build, test]
filters:
# run this job only on tags, never on branches
tags:
only: /^release-.*/
branches:
ignore: /.*/

40 changes: 0 additions & 40 deletions circle.yml

This file was deleted.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"@types/yargs": "^10.0.0",
"circle-github-bot": "^0.4.0",
"jest": "^22.0.3",
"jest-junit": "^3.7.0",
"npm-run-all": "^4.1.2",
"pug-cli": "^1.0.0-alpha6",
"ts-jest": "^22.0.0",
Expand Down
7 changes: 4 additions & 3 deletions theme/bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

const bot = require("circle-github-bot").create();

demos = [
const links = [
bot.artifactLink("docs/index.html", "docs"),
];
].join(" | ").replace("circleci/documentalist", "circleci/project");
// string replace for Circle 2.0 changes

bot.comment(`
<h3>${bot.env.commitMessage}</h3>
Preview: <strong>${demos.join(" | ")}</strong>
Preview: <strong>${links}</strong>
`);
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1702,6 +1702,14 @@ jest-jasmine2@^22.0.3:
jest-snapshot "^22.0.3"
source-map-support "^0.5.0"

jest-junit@^3.7.0:
version "3.7.0"
resolved "https://registry.yarnpkg.com/jest-junit/-/jest-junit-3.7.0.tgz#34abaed677439eb96557815d18b5ba01364fd897"
dependencies:
mkdirp "^0.5.1"
strip-ansi "^4.0.0"
xml "^1.0.1"

jest-leak-detector@^22.0.3:
version "22.0.3"
resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-22.0.3.tgz#b64904f0e8954a11edb79b0809ff4717fa762d99"
Expand Down Expand Up @@ -3463,6 +3471,10 @@ xml-name-validator@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-2.0.1.tgz#4d8b8f1eccd3419aa362061becef515e1e559635"

xml@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5"

y18n@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-3.2.1.tgz#6d15fba884c08679c0d77e88e7759e811e07fa41"
Expand Down