.option_tester: &option_tester
  stage: test
  needs: []
  after_script:
    - PYTHON=python2 bash tests/option-tester.sh
    - PYTHON=python3 bash tests/option-tester.sh
  tags:
    - gitlab-org
  rules:
    - if: '$CI_PIPELINE_SOURCE == "schedule"'

alpine-edge-options-tester:
  <<: *option_tester
  image: alpine:edge
  script:
    - apk update && apk add gcc bison musl-dev openssl-dev libcap-dev python2-dev python3-dev asciidoc libseccomp-dev bash

alpine-options-tester:
  <<: *option_tester
  image: alpine
  script:
    - apk update && apk add gcc bison musl-dev openssl-dev libcap-dev python2-dev python3-dev asciidoc libseccomp-dev bash

centos-options-tester:
  <<: *option_tester
  image: centos:latest
  script:
    - dnf -y --enablerepo=powertools install bison gcc openssl-devel libcap-devel python3-devel python2-devel pps-tools-devel libseccomp-devel bash

fedora-latest-options-tester:
  image:
    name: fedora:latest
    entrypoint: [ '/bin/bash', '-c', 'ln -snf /bin/bash /bin/sh && /bin/bash -c $0' ]
  script:
    - yum -y install bison gcc openssl-devel libcap-devel pps-tools-devel python3-devel python2-devel libseccomp-devel bash
  <<: *option_tester

opensuse-leap-options-tester:
  <<: *option_tester
  image: opensuse/leap
  script:
    - zypper -n install bison gcc libopenssl-devel libcap-devel pps-tools-devel python-devel python-curses libseccomp-devel python3-devel python3-curses bash

gentoo-options-tester:
  <<: *option_tester
  image: gentoo/stage3-amd64
  script:
    - emerge-webrsync
    - emerge -q y sys-libs/libcap sys-devel/bison net-misc/pps-tools app-text/asciidoc sys-libs/libseccomp app-shells/bash

gentoo-hardened-options-tester:
  <<: *option_tester
  image: gentoo/stage3-amd64-hardened
  script:
    - emerge-webrsync
    - emerge -q y sys-libs/libcap sys-devel/bison net-misc/pps-tools app-text/asciidoc sys-libs/libseccomp app-shells/bash

macos-options-tester:
  stage: test
  needs: []
  image: macos-11-xcode-12
  script:
    - PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig PYTHON=python2.7 tests/option-tester.sh||true
    - PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig PYTHON=python3 tests/option-tester.sh
  tags:
    - shared-macos-amd64
  rules:
    - if: '$CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_BRANCH && $CI_PROJECT_PATH == "NTPsec/ntpsec"'

fbsd-11-options-tester:
  stage: test
  needs: []
  script:
    - PYTHON=python2.7 tests/option-tester.sh
    - PYTHON=python3 tests/option-tester.sh
  tags:
    - freebsd-11
  rules:
    - if: '$CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_BRANCH && $CI_PROJECT_PATH == "NTPsec/ntpsec"'
      when: never
    - when: never

fbsd-12-options-tester:
  stage: test
  needs: []
  script:
    - PYTHON=python2.7 tests/option-tester.sh
    - PYTHON=python3 tests/option-tester.sh
  tags:
    - freebsd-11
  rules:
    - if: '$CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_BRANCH && $CI_PROJECT_PATH == "NTPsec/ntpsec"'
      when: never
    - when: never

.deb_option_tester: &deb_option_tester
  stage: test
  needs: []
  script:
    - apt-get update
    - DEBIAN_FRONTEND=noninteractive apt-get install -y netbase bison gcc libssl-dev libcap-dev pps-tools python2-dev python2-minimal libseccomp-dev bash pkg-config python3-dev python3-minimal
    - PYTHON=python2 bash tests/option-tester.sh
    - PYTHON=python3 bash tests/option-tester.sh
  tags:
    - gitlab-org
  rules:
    - if: '$CI_PIPELINE_SOURCE == "schedule"'

.deb_old_option_tester: &deb_old_option_tester
  stage: test
  needs: []
  script:
    - apt-get update
    - apt-get install -y netbase bison gcc libssl-dev libcap-dev pps-tools python-dev python-minimal libseccomp-dev bash pkg-config python3-dev python3-minimal
    - PYTHON=python bash tests/option-tester.sh
    - PYTHON=python3 bash tests/option-tester.sh
  tags:
    - gitlab-org
  rules:
    - if: '$CI_PIPELINE_SOURCE == "schedule"'

debian-i386-options-tester:
  image: i386/debian:stable-slim
  <<: *deb_option_tester

debian-oldstable-options-tester:
  image: debian:oldstable-slim
  <<: *deb_old_option_tester

debian-stable-options-tester:
  image: debian:stable-slim
  <<: *deb_option_tester

debian-testing-options-tester:
  image: debian:testing-slim
  <<: *deb_option_tester

debian-unstable-options-tester:
  image: debian:unstable-slim
  <<: *deb_option_tester

ubuntu-latest-options-tester:
  image: ubuntu:latest
  <<: *deb_option_tester

ubuntu-devel-options-tester:
  image:
    name: ubuntu:devel
    entrypoint: [ '/bin/sh', '-c', 'ln -snf /bin/bash /bin/sh && /bin/bash -c $0']
  <<: *deb_option_tester

ubuntu-rolling-options-tester:
  image:
    name: ubuntu:rolling
    entrypoint: [ '/bin/sh', '-c', 'ln -snf /bin/bash /bin/sh && /bin/bash -c $0']
  <<: *deb_option_tester
