Stack with Travis CI
Asked Answered
T

1

6

I have recently been trying to use travis CI with stack and i have been running in to some issues.

my .travis.yml file is located in my repo which is here: (I used the guide on the stack website) A snapshot of my config file is as follows:

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'

The tests fail to run when i push them to git, travis CI tries to build my repo, but when i examine the log it says that it cannot find the stack command.

However in my config file I specified for it to install stack.

I am not to sure why this is happening, any help will be appreciated?

Traci answered 11/8, 2016 at 18:45 Comment(2)
StackOverflow questions should be mostly self-contained; please reduce .travis.yml to something that can actually be posted here.Dobrinsky
Can you give the relevant section of the file where you are trying to call Stack in the Travis CI file and the error message you get from that call?Shyamal
T
5

I've seen this too.

[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.

It's when curl fails due to some kind of network problem. Restart your build and hope for better luck next time.

In case folks are interested, here is my complete but minimal .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
Treadwell answered 14/8, 2016 at 14:37 Comment(2)
Thanks for the .travis.yml! If I may ask, why the language: c?Ddt
It's just some kind of lowest common denominator on Travis CI. i.e. minimal dependenciesTreadwell

© 2022 - 2024 — McMap. All rights reserved.