language: generic
conditions: v1

branches:
  only:
  - stable
  - dev
  - /^release-.*$/
  - /^prerelease-.*$/
  - /^travis-.*$/
  - /^import-.*$/

services:
  - docker

jobs:
  fast_finish: true
  include:
    # Linux with GCC on PowerPC
    - os: linux
      name: PPC64
      arch: ppc64le
      dist: focal
      env: COMPILER_NAME=gcc CXX=g++ CC=gcc CFLAGS="-DRZ_ASSERT_STDOUT=1" RZ_ARM64_AS=aarch64-linux-gnu-as RZ_ARM32_AS=arm-linux-gnueabi-as RZ_X86_AS=x86_64-linux-gnu-as
      addons:
        apt:
          packages:
            - binutils-aarch64-linux-gnu
            - binutils-arm-linux-gnueabi
            - binutils-x86-64-linux-gnu
            - cabextract
    # Linux with GCC on System Z
    - os: linux
      name: S390X
      arch: s390x
      dist: focal
      env: COMPILER_NAME=gcc CXX=g++ CC=gcc CFLAGS="-DRZ_ASSERT_STDOUT=1" RZ_X86_AS=x86_64-w64-mingw32-as
      addons:
        apt:
          packages:
            - binutils-mingw-w64-x86-64
            - cabextract
    # Linux with GCC on ARMv8 (64bit)
    - os: linux
      name: ARM64
      arch: arm64
      dist: focal
      env: COMPILER_NAME=gcc CXX=g++ CC=gcc CFLAGS="-DRZ_ASSERT_STDOUT=1" RZ_ARM32_AS=arm-linux-gnueabi-as RZ_X86_AS=x86_64-linux-gnu-as RZ_PPC_AS=powerpc64le-linux-gnu-as
      addons:
        apt:
          packages:
            - binutils-arm-linux-gnueabi
            - binutils-x86-64-linux-gnu
            - binutils-powerpc64le-linux-gnu
            - cabextract

  allow_failures:
    # Linux with GCC on PowerPC
    - os: linux
      arch: ppc64le
      env: COMPILER_NAME=gcc CXX=g++ CC=gcc CFLAGS="-DRZ_ASSERT_STDOUT=1" RZ_ARM64_AS=aarch64-linux-gnu-as RZ_ARM32_AS=arm-linux-gnueabi-as RZ_X86_AS=x86_64-linux-gnu-as
      addons:
        apt:
          packages:
            - binutils-aarch64-linux-gnu
            - binutils-arm-linux-gnueabi
            - binutils-x86-64-linux-gnu
            - cabextract
    # Linux with GCC on System Z
    - os: linux
      arch: s390x
      env: COMPILER_NAME=gcc CXX=g++ CC=gcc CFLAGS="-DRZ_ASSERT_STDOUT=1" RZ_X86_AS=x86_64-w64-mingw32-as
      addons:
        apt:
          packages:
            - binutils-mingw-w64-x86-64
            - cabextract

cache:
  - ccache

script:
  - export PR_NAME=$(echo $TRAVIS_PULL_REQUEST_SLUG | cut -d'/' -f1)
  - |
    pip3 install -U --user meson ninja
    pip3 install --user 'git+https://github.com/rizinorg/rz-pipe#egg=rzpipe&subdirectory=python'
    $SHELL travis-script
