kind: pipeline
name: default

steps:
  - name: dco
    image: algernon/drone-plugin-dco

  - name: signature-check
    image: algernon/drone-plugin-signature-check
    settings:
      keys: [ 10E65DC045EABEFCC5193A26AC1E90BAC433F68F ]
    when:
      event: tag

  - name: bootstrap
    image: algernon/drone-language:C
    commands:
      - autoreconf -i

  - name: tls-certificates
    image: algernon/drone-language:C
    commands:
      - apt update
      - apt install -y openssl
      - cd tests/etc && ./gen-certs.sh

  - name: riemann
    image: algernon/drone-service:riemann
    detach: true
    environment:
      RIEMANN_CONFIG: /drone/src/tests/etc/riemann.config
      RIEMANN_HOST: riemann
      RIEMANN_TLS_KEY: /drone/src/tests/etc/server.pkcs8
      RIEMANN_TLS_CERT: /drone/src/tests/etc/server.crt
      RIEMANN_TLS_CACERT: /drone/src/tests/etc/cacert.pem

  - name: build
    image: algernon/drone-language:C
    environment:
      RCC_NETWORK_TESTS: 1
      RIEMANN_HOST: riemann
    commands:
      - apt update
      - apt install -y check protobuf-c-compiler libprotobuf-c-dev libgnutls28-dev libjson-c-dev lcov
      - install -d _build/unstable
      - cd _build/unstable
      - ../../configure --enable-silent-rules CFLAGS="-Wall -Wextra -O3 -g --coverage"
      - make
      - make coverage.info CK_VERBOSITY=normal
      - genhtml coverage.info | tail -n 3
