Skip to content

Commit

Permalink
restoring split workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyrb committed Jul 16, 2018
1 parent 19df297 commit 60ee5ba
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 67 deletions.
119 changes: 53 additions & 66 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ defaults: &defaults
working_directory: ~/repo
docker:
- image: circleci/node:latest
# environment variables for all commands executed in the primary container
# environment:
# JEST_JUNIT_OUTPUT: reports/junit/js-test-results.xml
# COVERALLS_SERVICE_NAME: circleci
# COVERALLS_SERVICE_JOB_ID: $CIRCLE_BUILD_NUM

jobs:
setup:

# Run on successful merge/commit to vNext
test-merge:
<<: *defaults
steps:
- checkout
Expand All @@ -24,96 +21,86 @@ jobs:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
# - persist_to_workspace:
# root: ~/repo
# paths: .
# test-merge:
# <<: *defaults
# steps:
# - attach_workspace:
# at: ~/repo
# - run:
# name: "JavaScript Test Suite"
# environment:
# JEST_JUNIT_OUTPUT: reports/junit/js-test-results.xml
# COVERALLS_SERVICE_NAME: circleci
# COVERALLS_SERVICE_JOB_ID: $CIRCLE_BUILD_NUM
# command: npm run test:ci
# # Store our test results + Output
# - store_test_results:
# path: reports/junit
# - store_artifacts:
# path: reports/junit
# # Allows deploy to pickup where this job leaves off
# - persist_to_workspace:
# root: ~/repo
# paths: .
# test-pr:
# <<: *defaults
# steps:
# - attach_workspace:
# at: ~/repo
- run:
name: "JavaScript Test Suite"
name: Jest Tests && Coveralls Report
environment:
JEST_JUNIT_OUTPUT: reports/junit/js-test-results.xml
COVERALLS_SERVICE_NAME: circleci
COVERALLS_SERVICE_JOB_ID: $CIRCLE_BUILD_NUM
command: npm run test:ci
# Store our test results + Output
- store_test_results:
path: reports/junit
- store_artifacts:
path: reports/junit
# Allows deploy to pickup where this job leaves off
- persist_to_workspace:
root: ~/repo
paths: .

# Note: We do not expose project environment variables
# to pull requests from forks (security reasons). This
# job should never rely on such an environment variable.
test-pr:
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-
- run: npm install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run:
name: Jest Tests && Coverage Report
environment:
JEST_JUNIT_OUTPUT: reports/junit/js-test-results.xml
command: npm run test:unit -- --coverage --coverageReporters=text-lcov
# Store our test results + Output
- store_test_results:
path: reports/junit
- store_artifacts:
path: reports/junit
# Allows deploy to pickup where this job leaves off
# - persist_to_workspace:
# root: ~/repo
# paths: .
# deploy:
# <<: *defaults
# steps:
# - attach_workspace:
# at: ~/repo
# # - run: echo -e "$NPM_USER\n$NPM_PASS\n$NPM_EMAIL" | npm login
- persist_to_workspace:
root: ~/repo
paths: .

# Used to publish latest under @next tag
deploy:
<<: *defaults
steps:
- run:
name: Write NPM Token to ~/.npmrc
command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc
# - run: git config --global user.email "[email protected]"
# - run: git config --global user.name "Daniel Brown"
- run:
name: Bump version number
command: sh ~/repo/.circleci/version.sh
- run:
name: Publish package
command: npm publish --tag next || true
- store_artifacts:
path: ~/.npm/_logs
- store_artifacts:
path: ~/repo/.npmrc
- run: printenv
command: npm publish --tag next

workflows:
version: 2

# Pull Requests
build-test:
jobs:
- setup:
- test-pr:
filters:
branches:
only: vNext
- test-pr:
requires:
- setup
ignore: vNext

# Merges to vNext
build-test-deploy:
jobs:
- setup:
- test-merge:
filters:
branches:
ignore: vNext
# - test-pr:
# requires:
# - setup
# - deploy:
# requires:
# - test-pr
only: vNext
- deploy:
requires:
- test-merge
1 change: 0 additions & 1 deletion .circleci/version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ then
# uses npm-version to set version in package.json
# see https://docs.npmjs.com/cli/version
npm version $NEW_PACKAGE_VERSION --no-git-tag-version
npm run webpack
#
git config credential.helper 'cache --timeout=120'
git config user.email "[email protected]"
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"eslint": "eslint -c .eslintrc.js src",
"eslint-quiet": "eslint -c .eslintrc.js --quiet src",
"eslint-fix": "eslint -c .eslintrc.js --fix src",
"prepare": "npm run webpack",
"start": "npm run webpack",
"start:dev": "webpack-dev-server --config ./config/webpack/webpack-dev",
"test": "npm run test:chrome",
Expand Down

0 comments on commit 60ee5ba

Please sign in to comment.