variables:
  DEPS: build-essential git libwlroots-examples wget gnome-session
        gdb weston valgrind

before_script:
  - export DEBIAN_FRONTEND=noninteractive
  - apt-get -y update
  - apt-get -y install wget gnupg eatmydata
  - echo "deb http://ci.puri.sm/ scratch librem5" > /etc/apt/sources.list.d/ci.list
  - wget -O- https://ci.puri.sm/ci-repo.key | apt-key add -
  - eatmydata apt-get -y update
  - eatmydata apt-get -y build-dep .
  - eatmydata apt-get -y install $DEPS
  - ulimit -c unlimited

.tags: &tags
  tags:
    - librem5

build:native:
  <<: *tags
  stage: build
  artifacts:
    paths:
      - _build
  script:
    - meson --werror . _build
    - ninja -C _build

test:native:
  <<: *tags
  stage: test
  dependencies:
    - build:native
  script:
    - export LC_ALL=C.UTF-8
    - xvfb-run ninja -C _build test

test:smoke:one-output:
  <<: *tags
  stage: test
  dependencies:
    - build:native
  script:
    - export OUTDIR=output
    - export G_DEBUG=fatal-criticals
    - export WLR_X11_OUTPUTS=1
    - tests/smoke
  artifacts:
    paths:
      - output/*.log

test:smoke:two-outputs:
  <<: *tags
  stage: test
  dependencies:
    - build:native
  script:
    - export OUTDIR=output
    - export G_DEBUG=fatal-criticals
    - export WLR_X11_OUTPUTS=2
    - tests/smoke
  artifacts:
    paths:
      - output/*.log

test:smoke:valgrind:
  <<: *tags
  stage: test
  dependencies:
    - build:native
  script:
    - export OUTDIR=output
    - export G_DEBUG=fatal-criticals
    - export WLR_X11_OUTPUTS=1
    - tests/smoke -V -T 30
  artifacts:
    paths:
      - vgdump
      - output/*.log