【发布时间】:2015-04-10 09:54:58
【问题描述】:
我有一个 GitLab CI 运行程序,每次我在我的分支中推送代码时都会运行它。 问题是:我使用 npm+bower 来拥有我需要的所有依赖项,但我不想为每个测试下载所有依赖项:这是浪费网络和时间。
所以我想出了这个脚本。这有意义吗?
touch ~/.bash_profile
npm config set prefix ~/npm
export PATH="~/npm/bin:$PATH"
source ~/.bash_profile
npm install
rm -f ~/bower/bower.json
cp bower.json ~/bower
pushd ~/bower
bower update
bower install
popd
mkdir bower_components
cp -r ~/bower/bower_components bower_components
grunt test
无论如何,我面临的一个问题是 Bower 总是超时:
bower angular-cookies#1.2.16 ECMDERR Failed to execute "git ls-remote --tags --heads git://github.com/angular/bower-angular-cookies.git", exit code of #128 fatal: unable to connect to github.com: github.com[0: 192.30.252.128]: errno=Connection timed out
另外,它没有完成一次,所以我不确定,但似乎每次都重新下载所有包。
我试图在网上搜索,但我没有找到任何东西。有办法实现我想要实现的目标吗? (也有完全不同的策略。我也可以通过 ssh 访问跑步者)
【问题讨论】:
-
嘿,我正在尝试做同样的事情,我也在使用 bower、npm 和 grunt。但对我来说,“npm install”甚至没有运行。它在 30 分钟后取消,告诉我命令的执行时间太长。 “npm install”对你有用吗?
-
@error1337 是的,它有效。最后我修改了我刚刚发布的脚本作为回复,希望这可以帮助
标签: angularjs gruntjs gitlab-ci