From 07c2e7eef2c4350dafa9d585c7325115aa5bca84 Mon Sep 17 00:00:00 2001
From: Pieter Donker <donker@astron.nl>
Date: Fri, 10 Mar 2023 10:56:42 +0000
Subject: [PATCH] Update .gitlab-ci.yml file

---
 .gitlab-ci.yml | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0ca8a44805..cda931f6c9 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -26,10 +26,50 @@
 # . See https://support.astron.nl/confluence/display/L2M/L3+SDP+Decision%3A+Gitlab+pipeline+automation+to+test+SDPFW+with+OPC+UA
 
 stages:
+    - image
     - simulation
     - synthesis
     - hardware
 
+# build docker image
+docker-image:
+  stage: image
+  image: docker:latest
+  tags:
+    - privileged
+  only:
+    refs:
+      - master
+  services:
+    - docker:dind
+  variables:
+    DOCKER_TLS_CERTDIR: "/certs"
+  before_script:
+    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
+  script:
+    - |
+      if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
+        tag=""
+        echo "Running on default branch '$CI_DEFAULT_BRANCH': tag = 'latest'"
+      else
+        tag=":$CI_COMMIT_REF_SLUG"
+        echo "Running on branch '$CI_COMMIT_BRANCH': tag = $tag"
+      fi
+    - docker build --pull -t "$CI_REGISTRY_IMAGE${tag}" .
+    - docker push "$CI_REGISTRY_IMAGE${tag}"
+
+lint-vhdl-libraries:
+    stage: linting
+    extends: docker-image
+    allow_failure: true
+    before_script:
+        - DEBIAN_FRONTEND=noninteractive apt-get update
+        - DEBIAN_FRONTEND=noninteractive apt-get install -y python3 python3-pip python3-ipython
+        - pip3 install vsg --use-pep517
+    script:
+        - cd libraries
+        - find . -name "*.vhd" -exec vsg -f {} \;
+
 
 ###############################################################################
 # HDL simulation stage
-- 
GitLab