image: debian:stable

before_script:
  - apt-get update -qq
  - apt-get install -y
      make qemu binfmt-support qemu-user-static qemu-user
  - update-binfmts --enable

x86-64:
  stage: test
  script:
    - dpkg --add-architecture amd64
    - apt-get update -qq
    - apt-get install -y libc6-dev:amd64 gcc
    - make -C tests test-native

i686:
  stage: test
  script:
    - dpkg --add-architecture i386
    - apt-get update -qq
    - apt-get install -y gcc-i686-linux-gnu libc6-dev-i386-cross libc6:i386
    - make -C tests test-ia32 CC_IA32=i686-linux-gnu-gcc

aarch64:
  stage: test
  script:
    - dpkg --add-architecture arm64
    - apt-get update -qq
    - apt-get install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross libc6:arm64
    - make -C tests test-aarch64 CC_AARCH64=aarch64-linux-gnu-gcc

armhf:
  stage: test
  script:
    - dpkg --add-architecture armhf
    - apt-get update -qq
    - apt-get install -y gcc-arm-linux-gnueabihf libc6-dev-armhf-cross libc6:armhf
    - make -C tests test-armv7 CC_ARMv7="arm-linux-gnueabihf-gcc -marm"

armhf-thumb:
  stage: test
  script:
    - dpkg --add-architecture armhf
    - apt-get update -qq
    - apt-get install -y gcc-arm-linux-gnueabihf libc6-dev-armhf-cross libc6:armhf
    - make -C tests test-armv7 CC_ARMv7="arm-linux-gnueabihf-gcc -mthumb"

mipsel:
  stage: test
  script:
    - dpkg --add-architecture mipsel
    - apt-get update -qq
    - apt-get install -y gcc-mipsel-linux-gnu libc6-dev-mipsel-cross libc6:mipsel
    - make -C tests test-mipsel CC_MIPSEL="mipsel-linux-gnu-gcc"

mips64el:
  stage: test
  script:
    - dpkg --add-architecture mips64el
    - apt-get update -qq
    - apt-get install -y gcc-mips64el-linux-gnuabi64 libc6-dev-mips64el-cross libc6:mips64el
    - make -C tests test-mips64el CC_MIPS64EL="mips64el-linux-gnuabi64-gcc"

ppc64el:
  stage: test
  script:
    - dpkg --add-architecture ppc64el
    - apt-get update -qq
    - apt-get install -y gcc-powerpc64le-linux-gnu libc6-dev-ppc64el-cross libc6:ppc64el
    - make -C tests test-ppc64le CC_PPC64LE="powerpc64le-linux-gnu-gcc"