{"id":2407,"date":"2017-12-24T18:46:47","date_gmt":"2017-12-24T10:46:47","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=2407"},"modified":"2017-12-24T18:46:47","modified_gmt":"2017-12-24T10:46:47","slug":"%e6%8c%81%e7%bb%ad%e9%9b%86%e6%88%90%ef%bc%88travis-ci%ef%bc%89%e8%bf%90%e8%a1%8c%e6%b5%81%e7%a8%8b%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=2407","title":{"rendered":"\u6301\u7eed\u96c6\u6210\uff08Travis CI\uff09\u8fd0\u884c\u6d41\u7a0b\u8be6\u89e3"},"content":{"rendered":"<p>\n\tTravis \u7684\u8fd0\u884c\u6d41\u7a0b\u5f88\u7b80\u5355\uff0c\u4efb\u4f55\u9879\u76ee\u90fd\u4f1a\u7ecf\u8fc7\u4e24\u4e2a\u9636\u6bb5\uff08\u547d\u4ee4\uff09\u3002\n<\/p>\n<ul>\n<li>\n\t\tinstall \u547d\u4ee4\uff1a\u5b89\u88c5\u4f9d\u8d56\n\t<\/li>\n<li>\n\t\tscript \u547d\u4ee4\uff1a\u8fd0\u884c\u811a\u672c\n\t<\/li>\n<\/ul>\n<h2>\n\tinstall \u547d\u4ee4<br \/>\n<\/h2>\n<p>\n\tinstall\u547d\u4ee4\u7528\u6765\u6307\u5b9a\u5b89\u88c5\u811a\u672c\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\ninstall: .\/install-dependencies.sh<\/pre>\n<p>\n\t\u5982\u679c\u6709\u591a\u4e2a\u811a\u672c\uff0c\u53ef\u4ee5\u5199\u6210\u4e0b\u9762\u7684\u5f62\u5f0f\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\ninstall:\r\n  - command1\r\n  - command2<\/pre>\n<p>\n\t\u4e0a\u9762\u4ee3\u7801\u4e2d\uff0c\u5982\u679c<code>command1<\/code>\u5931\u8d25\u4e86\uff0c\u6574\u4e2a\u6784\u5efa\u5c31\u4f1a\u505c\u4e0b\u6765\uff0c\u4e0d\u518d\u5f80\u4e0b\u8fdb\u884c\u3002\n<\/p>\n<p>\n\t\u5982\u679c\u4e0d\u9700\u8981\u5b89\u88c5\uff0c\u5373\u8df3\u8fc7\u5b89\u88c5\u9636\u6bb5\uff0c\u5c31\u76f4\u63a5\u8bbe\u4e3a<code>true<\/code>\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\ninstall: true<\/pre>\n<h2>\n\tscript \u547d\u4ee4<br \/>\n<\/h2>\n<p>\n\t<code>script<\/code>\u5b57\u6bb5\u7528\u6765\u6307\u5b9a\u6784\u5efa\u6216\u6d4b\u8bd5\u811a\u672c\u3002\n<\/p>\n<pre class=\"brush:plain;\">\r\nscript: bundle exec thor build<\/pre>\n<p>\n\t\u5982\u679c\u6709\u591a\u4e2a\u811a\u672c\uff0c\u53ef\u4ee5\u5199\u6210\u4e0b\u9762\u7684\u5f62\u5f0f\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\nscript:\r\n  - command1\r\n  - command2<\/pre>\n<p>\n\t\u6ce8\u610f\uff0cscript\u4e0einstall\u4e0d\u4e00\u6837\uff0c\u5982\u679ccommand1\u5931\u8d25\uff0ccommand2\u4f1a\u7ee7\u7eed\u6267\u884c\u3002\u4f46\u662f\uff0c\u6574\u4e2a\u6784\u5efa\u9636\u6bb5\u7684\u72b6\u6001\u662f\u5931\u8d25\u3002\n<\/p>\n<p>\n\t\u5982\u679ccommand2\u53ea\u6709\u5728command1\u6210\u529f\u540e\u624d\u80fd\u6267\u884c\uff0c\u5c31\u8981\u5199\u6210\u4e0b\u9762\u8fd9\u6837\u3002\n<\/p>\n<pre class=\"brush:bash;\">\r\nscript: command1 &amp;&amp; command2<\/pre>\n<h2>\n\tNode \u9879\u76ee\u5b9e\u4f8b<br \/>\n<\/h2>\n<p>\n\tNode \u9879\u76ee\u7684\u73af\u5883\u9700\u8981\u5199\u6210\u4e0b\u9762\u8fd9\u6837\u3002\n<\/p>\n<pre class=\"brush:plain;\">\r\nlanguage: node_js\r\nnode_js:\r\n  - &quot;8&quot;<\/pre>\n<p>\n\t\u4e0a\u9762\u4ee3\u7801\u4e2d\uff0cnode_js\u5b57\u6bb5\u7528\u6765\u6307\u5b9a Node \u7248\u672c\u3002\n<\/p>\n<p>\n\tNode \u9879\u76ee\u7684install\u548cscript\u9636\u6bb5\u90fd\u6709\u9ed8\u8ba4\u811a\u672c\uff0c\u53ef\u4ee5\u7701\u7565\u3002\n<\/p>\n<ul>\n<li>\n\t\tinstall\u9ed8\u8ba4\u503c\uff1anpm install\n\t<\/li>\n<li>\n\t\tscript\u9ed8\u8ba4\u503c\uff1anpm test\n\t<\/li>\n<\/ul>\n<p>\n\t\u66f4\u591a\u8bbe\u7f6e\u8bf7\u770b<a href=\"https:\/\/docs.travis-ci.com\/user\/languages\/javascript-with-nodejs\/\" target=\"_blank\">\u5b98\u65b9\u6587\u6863<\/a>\u3002\n<\/p>\n<h2>\n\tTravis \u90e8\u7f72<br \/>\n<\/h2>\n<p>\n\t<code>script<\/code>\u9636\u6bb5\u7ed3\u675f\u4ee5\u540e\uff0c\u8fd8\u53ef\u4ee5\u8bbe\u7f6e<a href=\"https:\/\/docs.travis-ci.com\/user\/notifications\/\" target=\"_blank\">\u901a\u77e5\u6b65\u9aa4<\/a>\uff08notification\uff09\u548c<a href=\"https:\/\/docs.travis-ci.com\/user\/deployment\/\" target=\"_blank\">\u90e8\u7f72\u6b65\u9aa4<\/a>\uff08deployment\uff09\uff0c\u5b83\u4eec\u4e0d\u662f\u5fc5\u987b\u7684\u3002\n<\/p>\n<p>\n\t\u90e8\u7f72\u7684\u811a\u672c\u53ef\u4ee5\u5728<code>script<\/code>\u9636\u6bb5\u6267\u884c\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528 Travis \u4e3a\u51e0\u5341\u79cd\u5e38\u89c1\u670d\u52a1\u63d0\u4f9b\u7684\u5feb\u6377\u90e8\u7f72\u529f\u80fd\u3002\u6bd4\u5982\uff0c\u8981\u90e8\u7f72\u5230&nbsp;<a href=\"https:\/\/docs.travis-ci.com\/user\/deployment\/pages\/\" target=\"_blank\">Github Pages<\/a>\uff0c\u53ef\u4ee5\u5199\u6210\u4e0b\u9762\u8fd9\u6837\u3002\n<\/p>\n<pre class=\"brush:plain;\">\r\ndeploy:\r\n  provider: pages\r\n  skip_cleanup: true\r\n  github_token: $GITHUB_TOKEN # Set in travis-ci.org dashboard\r\n  on:\r\n    branch: master<\/pre>\n<p>\n\t\u5176\u4ed6\u90e8\u7f72\u65b9\u5f0f\uff0c\u8bf7\u770b<a href=\"https:\/\/docs.travis-ci.com\/user\/deployment\/\" target=\"_blank\">\u5b98\u65b9\u6587\u6863<\/a>\u3002\n<\/p>\n<h2>\n\tTravis \u94a9\u5b50\u65b9\u6cd5<br \/>\n<\/h2>\n<p>\n\tTravis \u4e3a\u4e0a\u9762\u8fd9\u4e9b\u9636\u6bb5\u63d0\u4f9b\u4e867\u4e2a\u94a9\u5b50\u3002\n<\/p>\n<ul>\n<li>\n\t\tbefore_install\uff1ainstall \u9636\u6bb5\u4e4b\u524d\u6267\u884c\n\t<\/li>\n<li>\n\t\tbefore_script\uff1ascript \u9636\u6bb5\u4e4b\u524d\u6267\u884c\n\t<\/li>\n<li>\n\t\tafter_failure\uff1ascript \u9636\u6bb5\u5931\u8d25\u65f6\u6267\u884c\n\t<\/li>\n<li>\n\t\tafter_success\uff1ascript \u9636\u6bb5\u6210\u529f\u65f6\u6267\u884c\n\t<\/li>\n<li>\n\t\tbefore_deploy\uff1adeploy \u6b65\u9aa4\u4e4b\u524d\u6267\u884c\n\t<\/li>\n<li>\n\t\tafter_deploy\uff1adeploy \u6b65\u9aa4\u4e4b\u540e\u6267\u884c\n\t<\/li>\n<li>\n\t\tafter_script\uff1ascript \u9636\u6bb5\u4e4b\u540e\u6267\u884c\n\t<\/li>\n<\/ul>\n<p>\n\t\u5b8c\u6574\u7684\u751f\u547d\u5468\u671f\uff0c\u4ece\u5f00\u59cb\u5230\u7ed3\u675f\u662f\u4e0b\u9762\u7684\u6d41\u7a0b\u3002\n<\/p>\n<ol>\n<li>\n\t\tbefore_install\n\t<\/li>\n<li>\n\t\tinstall\n\t<\/li>\n<li>\n\t\tbefore_script\n\t<\/li>\n<li>\n\t\tscript\n\t<\/li>\n<li>\n\t\taftersuccess or afterfailure\n\t<\/li>\n<li>\n\t\t[OPTIONAL] before_deploy\n\t<\/li>\n<li>\n\t\t[OPTIONAL] deploy\n\t<\/li>\n<li>\n\t\t[OPTIONAL] after_deploy\n\t<\/li>\n<li>\n\t\tafter_script\n\t<\/li>\n<\/ol>\n<p>\n\t\u4e0b\u9762\u662f\u4e00\u4e2abefore_install\u94a9\u5b50\u7684\u4f8b\u5b50\u3002\n<\/p>\n<pre class=\"brush:plain;\">\r\nbefore_install:\r\n  - sudo apt-get -qq update\r\n  - sudo apt-get install -y libxml2-dev<\/pre>\n<p>\n\t\u4e0a\u9762\u4ee3\u7801\u8868\u793a<code>before_install<\/code>\u9636\u6bb5\u8981\u505a\u4e24\u4ef6\u4e8b\uff0c\u7b2c\u4e00\u4ef6\u4e8b\u662f\u8981\u66f4\u65b0\u4f9d\u8d56\uff0c\u7b2c\u4e8c\u4ef6\u4e8b\u662f\u5b89\u88c5<code>libxml2-dev<\/code>\u3002\u7528\u5230\u7684\u51e0\u4e2a\u53c2\u6570\u7684\u542b\u4e49\u5982\u4e0b\uff1a<code>-qq<\/code>\u8868\u793a\u51cf\u5c11\u4e2d\u95f4\u6b65\u9aa4\u7684\u8f93\u51fa\uff0c<code>-y<\/code>\u8868\u793a\u5982\u679c\u9700\u8981\u7528\u6237\u8f93\u5165\uff0c\u603b\u662f\u8f93\u5165<code>yes<\/code>\u3002\n<\/p>\n<h2>\n\tTravis&nbsp;\u8fd0\u884c\u72b6\u6001<br \/>\n<\/h2>\n<p>\n\t\u6700\u540e\uff0cTravis \u6bcf\u6b21\u8fd0\u884c\uff0c\u53ef\u80fd\u4f1a\u8fd4\u56de\u56db\u79cd\u72b6\u6001\u3002\n<\/p>\n<ul>\n<li>\n\t\tpassed\uff1a\u8fd0\u884c\u6210\u529f\uff0c\u6240\u6709\u6b65\u9aa4\u7684\u9000\u51fa\u7801\u90fd\u662f0\n\t<\/li>\n<li>\n\t\tcanceled\uff1a\u7528\u6237\u53d6\u6d88\u6267\u884c\n\t<\/li>\n<li>\n\t\terrored\uff1abefore_install\u3001install\u3001before_script\u6709\u975e\u96f6\u9000\u51fa\u7801\uff0c\u8fd0\u884c\u4f1a\u7acb\u5373\u505c\u6b62\n\t<\/li>\n<li>\n\t\tfailed \uff1ascript\u6709\u975e\u96f6\u72b6\u6001\u7801 \uff0c\u4f1a\u7ee7\u7eed\u8fd0\u884c\n\t<\/li>\n<\/ul>\n<h2>\n\t\u53c2\u8003\u8d44\u6599<br \/>\n<\/h2>\n<ul>\n<li>\n\t\t<a href=\"https:\/\/gist.github.com\/domenic\/ec8b0fc8ab45f39403dd\" target=\"_blank\">Auto-deploying built products to gh-pages with Travis<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/oncletom.io\/2016\/travis-ssh-deploy\/\" target=\"_blank\">SSH deploys with Travis CI<\/a>\n\t<\/li>\n<\/ul>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=2407\">\u6301\u7eed\u96c6\u6210\uff08Travis CI\uff09\u8fd0\u884c\u6d41\u7a0b\u8be6\u89e3<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>Travis \u7684\u8fd0\u884c\u6d41\u7a0b\u5f88\u7b80\u5355\uff0c\u4efb\u4f55\u9879\u76ee\u90fd\u4f1a\u7ecf\u8fc7\u4e24\u4e2a\u9636\u6bb5\uff08\u547d\u4ee4\uff09\u3002 install \u547d\u4ee4\uff1a\u5b89\u88c5\u4f9d\u8d56 scrip [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[1381,801],"class_list":["post-2407","post","type-post","status-publish","format-standard","hentry","category-yyzt","tag-1381","tag-801"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2407","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2407"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2407\/revisions"}],"predecessor-version":[{"id":2408,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2407\/revisions\/2408"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2407"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2407"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2407"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}