{"id":19422982,"url":"https://github.com/houfeng/cize","last_synced_at":"2025-04-24T16:30:31.696Z","repository":{"id":57199073,"uuid":"60496777","full_name":"Houfeng/cize","owner":"Houfeng","description":"🔌 Continuous integration with the simplest solution","archived":false,"fork":false,"pushed_at":"2017-12-12T02:22:03.000Z","size":1439,"stargazers_count":99,"open_issues_count":4,"forks_count":11,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-11T20:48:46.229Z","etag":null,"topics":["ci","cize","jenkins","job","job-cize","test","testing","travis-ci"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Houfeng.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-06T03:48:57.000Z","updated_at":"2023-09-01T08:40:30.000Z","dependencies_parsed_at":"2022-09-16T15:01:26.317Z","dependency_job_id":null,"html_url":"https://github.com/Houfeng/cize","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Houfeng%2Fcize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Houfeng%2Fcize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Houfeng%2Fcize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Houfeng%2Fcize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Houfeng","download_url":"https://codeload.github.com/Houfeng/cize/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223958940,"owners_count":17231880,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ci","cize","jenkins","job","job-cize","test","testing","travis-ci"],"created_at":"2024-11-10T13:36:23.186Z","updated_at":"2024-11-10T13:36:23.797Z","avatar_url":"https://github.com/Houfeng.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# CIZE 是什么？\nCIZE 是一个「持续集成」工具，希望能让开发人员更快捷的搭建一个完整、可靠、便捷的 CI 服务。\n甚至可以像 Gulp 或 Grunt 一样，仅仅通过一个 ```cizefile.js``` 即可完成几乎所有的工作。\n\n[![npm version](https://badge.fury.io/js/cize.svg)](http://badge.fury.io/js/cize)\n[![Build Status](https://travis-ci.org/Houfeng/cize.svg?branch=master)](https://travis-ci.org/Houfeng/cize) \n\n\u003cimg src=\"https://raw.githubusercontent.com/houfeng/cize/master/screenshot/monitor.png\" width=\"888\"/\u003e\n\n# 快速搭建\n### 全局安装 \n```sh\n$ [sudo] npm install cize -g\n```\n\n### 编写 Job\n\n新建 cizefile.js\n```\n$ mkdir your_path\n$ cd your_path\n$ vim cizefile.js\n```\n\n输入如下内容\n```js\n//定义「项目」\nconst demo = cize.project('demo', {});\n\n//定义一个 Job，这是一个最基础的 Job\ndemo.job('hello', function (self) {\n  self.console.log('hello world');\n  self.done();\n});\n```\n\n然后，在「工作目录」中执行 ```cize``` 启动服务\n\n```\n$ cize\nStrarting...\nThe server on \"localhost:9000\" started \n```\n默认会启动和 CPU 核数相同的「工作进程」。\n\n接下来，可以在浏览器中访问 ```http://localhost:9000``` , \n并可以在 UI 中手动触发这个名为 ```hello``` 的 Job\n\n# 定义 Project\n```js\nconst demo = cize.project('demo', {\n  ...\n  //可以在此添加针对项目的配置\n  ...\n});\n```\n注意，即便一个项目不需要任何配置，也不能省略第二个参数，\n没有第二个参数时 ```cize.project(name)``` 为获取指定的项目\n\n# 定义 Job\n假定现在已经有一个定义好的名为 ```demo``` 的 ```project``` \n\n### 用 js 编写的 Job\n```js\ndemo.job('test', function (self) {\n  self.console.log('test');\n  self.done();\n});\n```\n这是最基础的 Job 类型，是其它 Job 类型或「扩展」的基础。\n\n### 用 shell 编写的 Job\n```js\ndemo.job('test', cize.shell(function () {\n  /*\n    echo \"hello world\"\n  */\n}));\n```\n 定义一个用 SHELL 编写的 Job，用到了 cize.shell，这是一个「内置扩展」\n\n### 定时执行的 Job\n```js\ndemo.job('test', cize.cron('* */2 * * * *', cize.shell(function () {\n  /*\n    echo \"hello world\"\n  */\n})));\n```\n如上定义了一个每两分种触发一次的 Job 并且，嵌套使用了 shell.\n\n### 监听其它 Job 的 Job\n```js\ndemo.job('test2', cize.by('test1', function(self){\n  self.console.log('hello');\n  self.done();\n});\n```\n如下，在 test1 执行成功后，将会触发 test2\n\n### 串行执行的 Job\n```js\ndemo.job('test', cize.series([\n  \"test1\",\n  function(self){\n    self.console.log('hello');\n    self.done();\n  },\n  \"test3\"\n]));\n```\nseries 是一个内置扩展，可以定义一个「串行执行」多个步骤的任务列表，每个步骤可以是一个任意类型的 job，\n也可以是指定要调用的其它 Job 的名称。\n\n### 并行执行的 Job\n```js\ndemo.job('test', cize.parallel([\n  \"test1\",\n  function(self){\n    self.console.log('hello');\n    self.done();\n  },\n  \"test3\"\n]));\n```\nseries 是一个内置扩展，可以定义一个「并行执行」多个步骤的任务列表，每个步骤可以是一个任意类型的 job，\n也可以是指定要调用的其它 Job 的名称。\n\n### 多步嵌套的 Job \nCIZE 所有的 Job 可以自由嵌套，例如：\n```js\ndemo.job('test', cize.parallel([\n  \"test1\",\n  function(self){\n    self.console.log('hello');\n    self.done();\n  },\n  \"test3\",\n  cize.series([\n    \"test4\",\n    cize.shell(function(){\n      /*\n        echo hello\n      */\n    })\n  ])\n]));\n```\n当你使用一个「外部扩展」时，也可以混合使用。\n\n# 编写一个扩展\n如上用到的 cize.shell、cize.series、cize。parallel、cize.cron、cize.by 是 cize 默契认包含的「内置扩展」。\n编写一个「外部扩展」和「内置扩展」并无本质区别，如下:\n```js\nmodule.exports = function(options...){\n  return function(self){\n    //处理逻辑\n  };\n};\n```\n如查需要在 Job 定义时进行一些处理，可以使用 ```register``` ，如下\n```js\nmodule.exports = function(options...){\n  return {\n    register: function(Job){\n      //Job 是你的「自定义 Job 类型」\n      //注册时逻辑\n    },\n    runable: function(self){\n      //执行时逻辑\n    }\n  };\n};\n```\n可以将扩展发布为一个「npm 包」，让更多的人使用。\n\n# 服务选项\n\n可以通过一些选择去控制 CI 服务的端口、密钥等，有两种方式，如下\n\n### 在 cizefile.js 中配置\n```js\ncize.config({\n  port: 9000,\n  secret: '12345'\n});\n```\n\n### 通过命令行工具\n```js\ncize ./ -p=port -s=secret\n```\n通过 cize -h 可以查看完整的说明\n```sh\nUsage:\n  cize [folder|file] [options]\n\nOptions:\n  -w   set the number of workers\n  -p   set the port\n  -s   set the secret\n  -h   display help information\n\nExample:\n  cize ./ -p=9000 -s=12345 -w=4\n```\n\n# 更多内容\n\n请访问 wiki: [https://github.com/Houfeng/cize/wiki](https://github.com/Houfeng/cize/wiki)\n\n# 路线图\n- 所有 Job 都在单儿独立在一个进程中执行（现在可能会有 n 个 job 共用一个主进程）\n- 集成 Docker ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoufeng%2Fcize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhoufeng%2Fcize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhoufeng%2Fcize/lists"}