From 12edcaa9bf21a55e94f3e78c1dfa6a6b339f5284 Mon Sep 17 00:00:00 2001
From: Bastien Abadie <bastien@nextcairn.com>
Date: Tue, 8 Jun 2021 11:29:42 +0200
Subject: [PATCH] Add gitlab CI

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

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 00000000..6dfbe4e0
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,49 @@
+image: node:14-alpine
+stages:
+  - test
+  - build
+
+# Prevent detached merge request pipelines
+# https://docs.gitlab.com/ee/ci/merge_request_pipelines/
+# Those do not run the environment on_stop jobs when MRs are closed/merged
+# or when branches get deleted, unlike branch pipelines.
+workflow:
+  rules:
+    - if: '$CI_MERGE_REQUEST_ID'
+      when: never
+    - when: always
+
+before_script:
+  - npm ci
+
+lint:
+  stage: test
+
+  before_script:
+    - apk add --update python3 bash git
+    - pip3 install pre-commit
+
+  script:
+    - pre-commit run -a
+
+audit:
+  stage: test
+  script:
+    - npm audit --parseable
+  allow_failure: true
+
+.build:
+  stage: build
+  # Ignore frontend-audit to speed up CI builds
+  needs:
+    - lint
+  artifacts:
+    paths:
+      - dist
+    expire_in: 2 weeks
+
+build-library:
+  extends: .build
+
+  script:
+    - npm run build
-- 
GitLab