stages:
    - prebuild
    - build
    - testing
    - deploy

prebuild:bsd:
    stage: prebuild
    script:
        - gcc --version
        - g++ --version
    tags:
        - rmrf
        - rmrfcode
        - freebsd

prebuild:deb:
    stage: prebuild
    script:
        - gcc --version
        - g++ --version
    tags:
        - rmrf
        - rmrfcode
        - debian

build:bsd:
    stage: build
    dependencies:
        - prebuild:bsd
    script:
        - gmake
    artifacts:
        paths:
            - bin
    tags:
        - rmrf
        - rmrfcode
        - freebsd

build:deb:
    stage: build
    dependencies:
        - prebuild:deb
    script:
        - make
        - dpkg-buildpackage -b -us -uc
        - mkdir -p deb && cp -t deb ../rmrf*.deb ../rmrf*.changes ../rmrf*.buildinfo
    artifacts:
        paths:
            - bin
            - deb
    tags:
        - rmrf
        - rmrfcode
        - debian

test:bsd:
    stage: testing
    dependencies:
        - build:bsd
    script:
        - make test
        - echo Successfully tested.

test:deb:
    stage: testing
    dependencies:
        - build:deb
    script:
        - make lintian
        - make test
        - echo Successfully tested.
