default:
  # The image was generated with the following Dockerfile. It is also used
  # for libxslt, that's why we need git and libgcrypt-dev.
  #
  # FROM ubuntu:19.04
  # RUN apt-get update && \
  #     apt-get upgrade -y && \
  #     apt-get install -y --no-install-recommends \
  #         curl git ca-certificates \
  #         autoconf automake libtool pkg-config \
  #         make gcc clang llvm \
  #         python-dev zlib1g-dev liblzma-dev libgcrypt-dev
  # WORKDIR /tests
  # RUN curl https://www.w3.org/XML/Test/xmlts20080827.tar.gz |tar xz
  image: registry.gitlab.gnome.org/gnome/libxml2

.test:
  script:
    - |
      ln -s /tests/xmlconf
      sh autogen.sh $CONFIG
      make -j$(nproc) V=1 CFLAGS="$CFLAGS -Werror"
      make check

gcc:
  extends: .test
  variables:
    CFLAGS: "-O2 -std=c89 -D_XOPEN_SOURCE=700"

clang:asan:
  extends: .test
  variables:
    CONFIG: "--without-python"
    CC: clang
    CFLAGS: "-O2 -g -fno-omit-frame-pointer -fsanitize=address,undefined -fno-sanitize=pointer-overflow -fno-sanitize-recover=all -Wno-error=cast-align"
    UBSAN_OPTIONS: "print_stacktrace=1"

clang:msan:
  extends: .test
  variables:
    CONFIG: "--without-python --without-zlib --without-lzma"
    CC: clang
    CFLAGS: "-O2 -g -fno-omit-frame-pointer -fsanitize=memory -Wno-error=cast-align"

