###############################################################################
#
# Copyright 2022
# ASTRON (Netherlands Institute for Radio Astronomy) <http://www.astron.nl/>
# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
###############################################################################

# Author:
# . Daniel van der Schuur
# Purpose:
# . Define automated test stages for the HDL repository this file belongs to.
# Description:
# . See https://support.astron.nl/confluence/display/L2M/L3+SDP+Decision%3A+Gitlab+pipeline+automation+to+test+SDPFW+with+OPC+UA

stages:
    - linting

lint-vhdl-lib-base:
    tags:
        - hdl
    stage: linting
    allow_failure: true
    before_script:
        - pip3 install vsg --use-pep517
    script:
        - cd libraries/base
        - find . -name "*.vhd" -exec vsg -c ../../vsg_config.yaml -f {} \;

lint-vhdl-lib-dsp:
    tags:
        - hdl
    stage: linting
    allow_failure: true
    before_script:
        - pip3 install vsg --use-pep517
    script:
        - cd libraries/dsp
        - find . -name "*.vhd" -exec vsg -c ../../vsg_config.yaml -f {} \;

lint-vhdl-lib-io:
    tags:
        - hdl
    stage: linting
    allow_failure: true
    before_script:
        - pip3 install vsg --use-pep517
    script:
        - cd libraries/io
        - find . -name "*.vhd" -exec vsg -c ../../vsg_config.yaml -f {} \;

lint-vhdl-lib-technology:
    tags:
        - hdl
    stage: linting
    allow_failure: true
    before_script:
        - pip3 install vsg --use-pep517
    script:
        - cd libraries/technology
        - find . -name "*.vhd" -exec vsg -c ../../vsg_config.yaml -f {} \;

lint-vhdl-boards-uniboard2b:
    tags:
        - hdl
    stage: linting
    allow_failure: true
    before_script:
        - pip3 install vsg --use-pep517
    script:
        - cd boards/uniboard2b
        - find . -name "*.vhd" -exec vsg -c ../../vsg_config.yaml -f {} \;

lint-vhdl-boards-uniboard2c:
    tags:
        - hdl
    stage: linting
    allow_failure: true
    before_script:
        - pip3 install vsg --use-pep517
    script:
        - cd boards/uniboard2c
        - find . -name "*.vhd" -exec vsg -c ../../vsg_config.yaml -f {} \;

lint-vhdl-applications-lofar2:
    tags:
        - hdl
    stage: linting
    allow_failure: true
    before_script:
        - pip3 install vsg --use-pep517
    script:
        - cd applications/lofar2
        - find . -name "*.vhd" -exec vsg -c ../../vsg_config.yaml -f {} \;