1
0
mirror of https://github.com/SomboChea/ui synced 2024-11-28 00:44:30 +07:00

chore: restore circleci

This commit is contained in:
Juan Picado @jotadeveloper 2019-05-04 15:58:50 +02:00
parent 5e43ac0d49
commit c960fa76db
No known key found for this signature in database
GPG Key ID: 18AC54485952D158
3 changed files with 182 additions and 4 deletions

168
.circleci/config.yml Normal file
View File

@ -0,0 +1,168 @@
version: 2
aliases:
- &defaults
working_directory: ~/ui-theme
- &node11_executor
docker:
- image: circleci/node:11.10.1
- &node8_executor
docker:
- image: circleci/node:8
- &node10_executor
docker:
- image: circleci/node:10
- &default_executor
<<: *node10_executor
- &repo_key
repo-{{ .Branch }}-{{ .Revision }}
- &coverage_key
coverage-{{ .Branch }}-{{ .Revision }}
- &base_config_key
base-config-{{ .Branch }}-{{ .Revision }}
- &yarn_cache_key
yarn-sha-{{ checksum "yarn.lock" }}
- &restore_repo
restore_cache:
keys:
- *repo_key
- &ignore_non_dev_branches
filters:
tags:
only: /.*/
branches:
ignore:
- /release\/.*/
- &execute_on_release
filters:
tags:
only: /(v)?[0-9]+(\.[0-9]+)*/
branches:
ignore:
- /.*/
jobs:
prepare:
<<: *defaults
<<: *default_executor
steps:
- *restore_repo
- checkout
- restore_cache:
key: *base_config_key
- run:
name: 'Base environment setup'
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
- save_cache:
key: *base_config_key
paths:
- ~/.npmrc
- ~/.gitconfig
- restore_cache:
key: *yarn_cache_key
- run:
name: Install Js dependencies
command: yarn install --no-progress --registry https://registry.verdaccio.org --no-lockfile
- run:
name: Build project
command: yarn run build
- save_cache:
key: *yarn_cache_key
paths:
- ~/.yarn
- ~/.cache/yarn
- node_modules
- save_cache:
key: *repo_key
paths:
- ~/local-storage
test_node11:
<<: *defaults
<<: *node11_executor
steps:
- *restore_repo
- run:
name: Test with Node 11
command: yarn run test
test_node8:
<<: *defaults
<<: *node8_executor
steps:
- *restore_repo
- run:
name: Test with Node 8
command: yarn test
test_node10:
<<: *defaults
<<: *node10_executor
steps:
- *restore_repo
- run:
name: Test with Node 10
command: yarn run test
- save_cache:
key: *coverage_key
paths:
- coverage
coverage:
<<: *defaults
<<: *default_executor
steps:
- *restore_repo
- restore_cache:
key: *coverage_key
- run:
name: Publish coverage
command: yarn run coverage:publish
- store_artifacts:
path: coverage/clover.xml
prefix: tests
- store_artifacts:
path: coverage
prefix: coverage
- store_test_results:
path: coverage/clover.xml
publish_package:
<<: *defaults
<<: *default_executor
steps:
- *restore_repo
- restore_cache:
key: *base_config_key
- run:
name: Publish
command: yarn publish
workflows:
version: 2
workflow:
jobs:
- prepare:
<<: *ignore_non_dev_branches
- test_node11:
requires:
- prepare
<<: *ignore_non_dev_branches
- test_node8:
requires:
- prepare
<<: *ignore_non_dev_branches
- test_node10:
requires:
- prepare
<<: *ignore_non_dev_branches
- coverage:
requires:
- test_node11
- test_node8
- test_node10
<<: *ignore_non_dev_branches
- publish_package:
requires:
- coverage
<<: *execute_on_release

13
scripts/gh_publish.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
# Get the last tag from GitHub
lastTag=$(git describe --tags $(git rev-list --tags --max-count=1))
# Print it to the console for verification
echo "Bumping version to new tag: ${lastTag}"
# creating .npmrc
echo "//$REGISTRY_URL/:_authToken=$REGISTRY_AUTH_TOKEN" > .npmrc
# Publish to NPM
npm publish --registry https://$REGISTRY_URL/

View File

@ -6,8 +6,5 @@ lastTag=$(git describe --tags $(git rev-list --tags --max-count=1))
# Print it to the console for verification # Print it to the console for verification
echo "Bumping version to new tag: ${lastTag}" echo "Bumping version to new tag: ${lastTag}"
# creating .npmrc
echo "//$REGISTRY_URL/:_authToken=$REGISTRY_AUTH_TOKEN" > .npmrc
# Publish to NPM # Publish to NPM
npm publish --registry https://$REGISTRY_URL/ npm publish