Travis CI集成堆栈

6

最近我一直在尝试使用travis CI与stack集成,但是遇到了一些问题。

我的.travis.yml文件位于我的repo中,链接在这里: (我使用了stack网站上的指南) 我的配置文件示例:

sudo: false

# Caching so the next build will be fast too.
cache:
  directories:
  - $HOME/.stack

before_install:
# Download and unpack the stack executable
- mkdir -p ~/.local/bin
- export PATH=$HOME/.local/bin:$PATH
- travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'

当我把测试代码推送到git上时,测试无法运行。travis CI尝试构建我的存储库,但是当我检查日志时,它说找不到stack命令。

然而,在我的配置文件中,我已经指定安装了stack。

我不太确定为什么会发生这种情况,希望能得到帮助。


StackOverflow的问题应该是自包含的;请将.travis.yml简化为可以在此处实际发布的内容。 - leftaroundabout
你能给出在Travis CI文件中尝试调用Stack的相关部分以及从该调用中获得的错误消息吗? - Christopher Wells
1个回答

5
我也看到了这个。
[0K$ travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | \ tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
/home/travis/build.sh: line 45:  tar: command not found
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

  0     0    0   607    0     0   7527      0 --:--:-- --:--:-- --:--:--  7527

  0 9223k    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
[31;1mThe command "curl -L https://www.stackage.org/stack/linux-x86_64" failed. Retrying, 2 of 3.[0m

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

  0     0    0   607    0     0   9491      0 --:--:-- --:--:-- --:--:--  9491

[31;1mThe command "curl -L https://www.stackage.org/stack/linux-x86_64" failed. Retrying, 3 of 3.[0m

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

  0     0    0   607    0     0  11999      0 --:--:-- --:--:-- --:--:-- 11999

[31;1mThe command "curl -L https://www.stackage.org/stack/linux-x86_64" failed 3 times.

curl由于某种网络问题而失败时,需要重新启动构建,并希望下次运气更好。

如果有人感兴趣,这是我完整但最小化的.travis.yml文件:

sudo: false

language: c

cache:
  directories:
    - ~/.stack

addons:
  apt:
    packages:
      - libgmp-dev

before_install:
  # Download and unpack the stack executable
  - mkdir -p ~/.local/bin
  - export PATH=$HOME/.local/bin:$PATH
  - travis_retry curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'

install:
  - stack --no-terminal --install-ghc test --only-dependencies

script:
  - stack --no-terminal test --haddock --no-haddock-deps

谢谢提供.travis.yml文件!如果我可以问一下,为什么选择language: c呢? - mfaerevaag
这只是Travis CI上一些最低公共分母的东西,即最小化依赖关系。 - Steven Shaw

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接