dist: xenial
language: c
compiler:
  - gcc

addons:
  apt:
    sources:
      - ubuntu-toolchain-r-test
    packages:
      - gcc-7
      - valgrind

env:
  global:
    - RISCV="/home/travis/riscv_install"

before_install:
  - export CC=gcc-7
  - export PATH=$RISCV/bin:$PATH
  - export NUM_JOBS=4

stages:
  - checkout
  - build1
  - build2
  - testdata
  - test32
  - test64

jobs:
  include:
    - stage: checkout
      name: checkout risc-v gcc
      script:
        - ./ci/get-gcc.sh 0
    - stage: build1
      name: build risc-v gcc
      script:
        - ./ci/get-gcc.sh 1
    - stage: build2
      name: build tools
      script:
        - make spike-32
        - make spike-64
        - make riscv-fesvr/build.ok
    - stage: testdata
      name: generate test data
      script:
        - make spike-traces-32
        - make spike-traces-64
    - stage: test32
      name: run spike trace tests (32-bit)
      script:
        - ./ci/run-tests-32.sh
    - stage: test64
      name: run spike trace tests (64-bit)
      script:
        - ./ci/run-tests-64.sh
