dependencies:
    cache_directories:
       - "~/.opam"
       - "~/aptcache"
    override:
        - sudo add-apt-repository -y ppa:avsm/ppa
        # BEGIN apt cache setup. Used in case cache is wiped.
        - sudo mkdir -p ~/aptcache/partial
        - sudo touch ~/aptcache/lock
        - sudo chmod 640 ~/aptcache/lock
        # END apt cache setup.
        - sudo apt-get update -o dir::cache::archives="/home/ubuntu/aptcache" -y
        - sudo apt-get install -o dir::cache::archives="/home/ubuntu/aptcache" -y ocaml ocaml-native-compilers opam
        - opam init --auto-setup --dot-profile=~/.bashrc # Modify dotfiles
        - opam update
        - opam switch --no-switch 4.02.3 # Download and compile all the versions
        - opam install -y jbuilder
        - opam switch --no-switch 4.03.0
        - opam install -y jbuilder
        - opam switch --no-switch 4.04.0
        - opam install -y jbuilder
        - npm install -g esy

test:
    override:
        - ./scripts/test-with-version.sh 4.02.3
        - ./scripts/test-with-version.sh 4.03.0
        - ./scripts/test-with-version.sh 4.04.0
        - esy install && esy build && ./_esyinstall/bin/refmt --version
machine:
  node:
    version: 8.7.0

dependencies:
    cache_directories:
       - "~/.opam"
       - "~/aptcache"
    override:
        - sudo add-apt-repository -y ppa:avsm/ppa
        # BEGIN apt cache setup. Used in case cache is wiped.
        - sudo mkdir -p ~/aptcache/partial
        - sudo touch ~/aptcache/lock
        - sudo chmod 640 ~/aptcache/lock
        # END apt cache setup.
        - sudo apt-get update -o dir::cache::archives="/home/ubuntu/aptcache" -y
        - sudo apt-get install -o dir::cache::archives="/home/ubuntu/aptcache" -y ocaml ocaml-native-compilers opam
        - opam init --auto-setup --dot-profile=~/.bashrc # Modify dotfiles
        - opam update
        - opam switch --no-switch 4.02.3 # Download and compile all the versions
        - opam install -y jbuilder
        - opam switch --no-switch 4.03.0
        - opam install -y jbuilder
        - opam switch --no-switch 4.04.0
        - opam install -y jbuilder
        - npm install -g esy

test:
    override:
        - ./scripts/test-with-version.sh 4.02.3
        - ./scripts/test-with-version.sh 4.03.0
        - ./scripts/test-with-version.sh 4.04.0
        - esy install && esy build && _build/install/default/bin/refmt --version
machine:
  node:
    version: 8.7.0

Fix CircleCI for newest esy
Fix CircleCI for newest esy
