#=========================================================================
# Travis CI Configuration
#=========================================================================
# This file configures Travis CI to automatically run tests for this RTL
# project everytime a commit is made.

# Prefer use of container-based environment as they start up faster and
# provide more RAM and CPU cores.

sudo: false

node_js:
  - 16
# Install the build requirements
addons:
  apt:
   sources:
    # For gcc-4.8
    - ubuntu-toolchain-r-test
   packages:
    # Dependencies from tutorial
    - autoconf
    - automake
    - autotools-dev
    - curl
    - libmpc-dev
    - libmpfr-dev
    - libgmp-dev
    - gawk
    - build-essential
    - bison
    - flex
    - texinfo
    - gperf
    - libncurses5-dev
    - libusb-1.0-0
    - libboost-dev
    # Need gcc-4.8
    - gcc
    - g++
    - gtkwave

# No Git operations will be performed. Best to fetch only the latest commit.
git:
  depth: 1

# TODO: Verify that this setting is optimal.
env:
  - JOBS=2

# Don't need email notifications for now.
notifications:
  email: false

install:
 # Build Verilator.
 - git clone http://git.veripool.org/git/verilator
 - cd verilator
 - autoconf && ./configure && make
 - export VERILATOR_ROOT=${PWD}
 - export PATH=${VERILATOR_ROOT}/bin:$PATH
 - verilator -V
 - cd ..



script:
 # Run the simulation.
 - nvm use || nvm install
 - npm i
 - make
 - make VERILATOR_USER_ARGS=-DEB0
 - git clone https://github.com/ameetgohil/elastic-signalflip-example.git elastic && rm -rf elastic/.git
 - cd elastic
 - nvm use || nvm install
 - npm i
 - res=make
 - cd ..
 - git clone https://github.com/ameetgohil/basic-signalflip-example.git basic && rm -rf basic/.git
 - cd basic
 - nvm use || nvm install
 - npm i
 - res=res || make
 - cd ..
 - git clone https://github.com/ameetgohil/APB3-config-regs.git
 - cd APB3-config-regs/sim
 - nvm use || nvm install
 - npm i
 - res=res || make
 - cd ../..
 - git clone https://github.com/ameetgohil/leading-zeroes-counter.git
 - cd leading-zeroes-counter/sim
 - nvm use || nvm install
 - npm i
 - res=res || make
 - cd ../..
 - git clone --recursive https://github.com/ameetgohil/reciprocal-sv.git
 - cd reciprocal-sv/sim
 - nvm use || nvm install
 - npm i
 - res || make



branches:
  only:
    - master

