stages:
    - lint
    - build
    - test

pattern:
    stage: lint
    tags:
        - regular
        - debian
    script:
        - shopt -s extglob
        - apt-get update && apt-get install -y git python
        - git clone https://github.com/google/styleguide
        - cd styleguide/cpplint
        - ./cpplint.py --filter=-whitespace/blank_line,-build/include_what_you_use ../../src/!(jsoncpp).cpp  ../../src/linux/*.cpp ../../src/windows/*.cpp

compile:
    stage: build
    artifacts:
        paths:
            - bin/
            - build/
    tags:
        - regular
        - debian
    script:
        - echo "Estágio 'build'"
        - apt-get update && apt-get install -y build-essential cmake git
          libudev-dev
        - git submodule init
        - git submodule update --init --recursive
        - mkdir build
        - cd build
        - cmake -DPRINT_JSON=ON ..
        - make

testDebian:
    stage: test
    tags:
        - regular
        - debian
    script:
        - apt-get update && apt-get install -y git jq
        - git clone https://github.com/sstephenson/bats.git
        - cd bats 
        - ./install.sh /usr 
        - cd ../test
        - ./returnTest.bats
    dependencies:
        - compile

testUbuntu:
    stage: test
    tags:
        - ubuntu
        - regular
    script:
        - apt-get update && apt-get install -y bats jq
        - cd test
        - ./returnTest.bats
    dependencies:
        - compile

testOpensuse:
    stage: test
    tags:
        - opensuse
    script:
        - zypper -n update
        - zypper -n install bats && zypper -n install jq
        - cd test
        - ./returnTest.bats
    dependencies:
        - compile
