27 seconds to build a simple C code?


language: C

script: make


    gcc hello.c


int main(){

  return 0;

any ideas on what the slow down is?

Hey @SolarUltima,

Travis not only has to build your C code, it also has to create the environment provisionally – in which it has access to a C complier to build your code, and spin up the rest of the dependencies.

Creating an environment (especially for the first time, will take a bit of time).

Happy building!
Montana Mendy

1 Like

To add on to this a little bit via I felt the explanation I gave was a bit vague, you can on some occasion speed the builds up for example, you have something like this in your .travis.yml :

  os: linux
  dist: xenial
  sudo: required
  language: python
  python: "3.6"
    - docker
      - $HOME/.conan/data
osx: &osx
  os: osx
  language: generic
      - $HOME/.conan/data
      - $HOME/.pyenv/versions/2.7.10/
      - /usr/local/Homebrew

macOS is part of our .travis/install.sh, that will look like this:

if [[ "`uname -s`" == 'Darwin' ]]; then
    cd /usr/local/Homebrew/
    if [[ -d Library/Taps/homebrew/homebrew-cask ]]; then
        rm -rf Library/Taps/caskroom/homebrew-cask
    for d in `find $(pwd) -type d -name .git`; do
        cd `dirname $d`
        git clean -fxd
    brew cleanup
    cd $curdir # Where Montana almost messed up

    brew update
    brew outdated pyenv || brew upgrade pyenv
    brew install pyenv-virtualenv
    brew install cmake || true

    if which pyenv > /dev/null; then
        eval "$(pyenv init -)"

    pyenv install 2.7.10 --skip-existing
    pyenv virtualenv 2.7.10 conan --force
    pyenv rehash
    pyenv activate conan

And finally, in our build-script we create packager with additional arguments to pass to Docker, and Docker can call packager when need be:

packager = ConanMultiPackager(
  docker_build_options='--mount type=bind,source=$HOME/.conan/data,destination=/home/conan/.conan/data',

This is one example on how you can improve build times with bash scripts, and certain methods. Sometimes it’s unavoidable.

Happy building!
Montana Mendy

whoa @Montana!! what you wrote out actually worked for me the first build, I cannot keep thanking you enough for all the help recently, you seriously are a yaml master!!!

Hey @SolarUltima,

I wouldn’t consider myself a YAML master, I just have a really good understanding of it. I think it would be hard for anyone to call themselves a “YAML Master”. I’m good at it, but definitely no master, I appreciate your kind words though.

Happy building!
Montana Mendy