From eac646743fedc8726c1af4141c86669b716086e0 Mon Sep 17 00:00:00 2001
From: Adam Zielinski <adam.zielinski@anyline.com>
Date: Wed, 14 Aug 2024 12:25:49 +0200
Subject: [PATCH] CAPI-245(feat): introduce gitlab CI

---
 .gitlab-ci.yml | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100644 .gitlab-ci.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..0d5c127
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,21 @@
+# "Do not create two separate pipelines on commits pushed when branch has open merge request (mr pipeline)":
+# Only an MR pipeline is created if there's a merge request linked to the branch on a push to it, otherwise, only a
+# branch pipeline is created on a push (but never both kinds of pipelines at the same push)
+# Ref: https://docs.gitlab.com/ee/ci/yaml/workflow.html#switch-between-branch-pipelines-and-merge-request-pipelines
+workflow:
+  rules:
+    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS && $CI_PIPELINE_SOURCE == "push"
+      when: never
+    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+      when: always
+    - if: $CI_PIPELINE_SOURCE == "web"
+      when: always
+    - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
+      when: never
+    - if: $CI_COMMIT_BRANCH
+      when: always
+
+include:
+  - template: Code-Quality.gitlab-ci.yml
+  - template: Security/SAST.gitlab-ci.yml
+  - template: Security/Secret-Detection.gitlab-ci.yml