sr-ci
v0.0.22
Published
install
Downloads
25
Readme
sr-ci by stage pipe line tool
install
yarn add sr-ci
# or
npm install sr-ci
use by just 'sr-ci run' command it will find sr.ci.json
in your project folder
sr-ci run
init a sr.ci.json
sr-ci init
sr.ci.json
file content example
{
// project name (required) used by cache folder
"name": "crm",
// cache folder should add {branch} or not
"withBranch":true,
// choose you ci flow id(required)
"flow": "fe",
// define variables then you can use {{ var }} in scripts
"variables": {
"1": "web",
"2": "club"
},
"caches": [
"frontend/packages/pc/dist",
"frontend/packages/mobile/dist"
],
// at least one
"flows": [
{
"id": "fe",
"stages": [
"ci-cache-take",
"build",
"ci-cache-backup",
"clean-modules"
],
// `fe`flow self caches here,it will extends the global caches
// so `fe` caches are
/** "frontend/packages/pc/dist",
* "frontend/packages/mobile/dist"
* "frontend/node_modules",
* "frontend/packages/pc/node_modules",
* "frontend/packages/mobile/node_modules",
* "frontend/packages/common/node_modules"
**/
"caches":[
"frontend/node_modules",
"frontend/packages/pc/node_modules",
"frontend/packages/mobile/node_modules",
"frontend/packages/common/node_modules"
]
},
{
"id": "be",
"stages": [
"ci-cache-take",
"clean-modules"
]
}
],
"stages": [
{
// stage id
"id": "build",
// pre-scripts hook
"pre-scripts": [
"cd frontend && yarn",
"cd frontend && npm run install"
],
"scripts": [
"cd frontend && npm run build"
],
// post-scripts hook notice the {{1}} here mean 'web'
"post-scripts": ["echo {{1}}"]
},
{
"id": "clean-modules",
"scripts": [
"cd frontend && npm run clean",
"cd frontend && rm -rf node_modules"
]
}
]
}
clear cache
# in project folder
sr-ci clear
beauty sr.ci.json to standard format,useful by git merge problem
sr-ci format
default inner ci stage you can just use
ci-cache-take
take cache from sr-ci cache folderci-cache-backup
put cache to sr-ci cache folderci-cache-clear
clear current projects's cache