language: c
sudo: false
dist: xenial
env:
  global:
    - PATH=~/.roswell/bin:/home/linuxbrew/.linuxbrew/bin:$PATH
    - ROSWELL_BRANCH=$TRAVIS_BRANCH
    - ROSWELL_INSTALL_DIR=$HOME/.roswell
    - ROSWELL_REPO=https://github.com/${TRAVIS_REPO_SLUG}
os:
  - linux

jobs:
  include:
      - os: linux
        arch: arm64
        env: LISP=sbcl-bin
        addons:
          apt:
            packages:
              - libcurl4-openssl-dev
      - sudo: required
        name: "valgrind"
        os: linux
        install:
          - sh bootstrap
          - CFLAGS="-g -O0" ./configure --disable-dependency-tracking --disable-maintainer-mode
          - make
          - sudo make install
          - make maintainer-clean
        script:
          - ros setup
          - valgrind --leak-check=yes ros config
          - ros config
        addons:
          apt:
            packages:
              - valgrind

#branches:
#  except:
#      - /^v[0-9]/

addons:
  apt:
    packages:
      - libc6-i386
#      - gcc-multilib

before_install:
  - date
install:
  - $SETARCH sh ./scripts/install-for-ci.sh
script:
  - $SETARCH ros version
  - $SETARCH ros version=t run
  - $SETARCH ros install prove
  - $SETARCH run-prove roswell-test.asd 2>&1
  - $SETARCH ros -q run && [`ros -q run 2>&1` == ""]
  - if [ "$LISP" = "sbcl-bin" ] && [ x$ALLOW_FAILURES != x ]; then
       if [ $ALLOW_FAILURES = YES ]; then
         ros sbcl.patchless=t install sbcl;
       else
         ros install sbcl --sbcl-bin;
         [`ros -e "(ros:ignore-shebang)" -e '(loop for x in (directory "src/lisp/*.ros") do (load x))' 2>&1` == ""];
       fi;
       make -C t/tree-shaker ;
    fi
  - $SETARCH ros config
