gpt4 book ai didi

node.js - 如何在 Travis CI 上的一个项目中运行 Golang 和 Karma 测试

转载 作者:IT王子 更新时间:2023-10-29 02:04:48 25 4
gpt4 key购买 nike

我认为我的问题与这些问题有关,但解决方案在我的案例中不起作用:How to run Node.js and Ruby tests within one project on Travis CIIs it possible to set up travis to run tests for several languages?

我有一个 github 存储库,其中包含一个带有微型 Angularjs 前端的小型 Golang 应用程序。我想同时运行 go-tests 和 Karma-tests。我看到两个选项:

  1. 为一个 repo 运行两个 travis-ci 构建(我不知道如何这样做)

  2. 在一个构建中运行两个测试(因为 travis-ci 中的 Node 版本太旧 (0.10),所以没有成功)。

构建运行了 60 多分钟,然后停止并显示“ fatal error :CALL_AND_RETRY_2 分配失败 - 进程内存不足”。构建显示了大量这样的警告:npm WARN engine escodegen@1.8.0: wanted: {"node":">=0.12.0"} (current: {"node":"0.10.36","npm ":"1.4.28"})

我尝试将构建作为 node_js 运行,但随后“go get xyz”不起作用。

我的 .travis.yml 文件:

language: go

go:
- 1.5

env:
- TRAVIS_NODE_VERSION="0.12"

install:
- export PATH=$HOME/gopath/bin:$PATH
- go get golang.org/x/tools/cmd/cover
- go get -v github.com/axw/gocov
- go install github.com/axw/gocov/gocov
- go get github.com/GeertJohan/go.rice
# we do not need the rice tool!
- go get github.com/xeipuuv/gojsonschema
- go get github.com/finklabs/ttime
- go get github.com/finklabs/graceful
- go get github.com/gorilla/mux

before_script:
- npm install bower
- npm install --dev
- bower install

script:
- gocov test | gocov report
- npm test

最佳答案

有时问题出在机器前面...我找到了一个很好的解决方法,我想与您分享。

我在 https://drone.io/ 上创建了一个帐户在设置选项卡中,我为“Go1”选择了一个构建并添加了以下命令:

# install gogrinder dependencies
go get ./...

# install test dependencies
go get golang.org/x/tools/cmd/cover
go get -v github.com/axw/gocov
go install github.com/axw/gocov/gocov

# install nodejs requirements
npm -d install
./node_modules/bower/bin/bower install

# run the tests on the go code
gocov test | gocov report

# run the tests on the Angularjs frontend
npm test

现在我又回到了运行 Golang 和 Karma 测试的 CI 服务器的轨道上。

关于node.js - 如何在 Travis CI 上的一个项目中运行 Golang 和 Karma 测试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34767628/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com