From dc1e2a7bac9499eb060ba74c342f0fd997afd52f Mon Sep 17 00:00:00 2001
From: Frank Sauerburger <frank@sauerburger.com>
Date: Sun, 3 Jan 2021 11:46:24 +0100
Subject: [PATCH] Add uhepp-js built to CI

---
 .gitignore                            |  1 +
 .gitlab-ci.yml                        | 22 +++++++++++++++++++---
 uhepp-js/webpack.config.js            |  2 +-
 uhepp_org/uhepp_vault/static/uhepp-js |  1 -
 4 files changed, 21 insertions(+), 5 deletions(-)
 delete mode 120000 uhepp_org/uhepp_vault/static/uhepp-js

diff --git a/.gitignore b/.gitignore
index d276a9e..8b47a5d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
 client_secret
 .env
+uhepp_org/uhepp_vault/static/uhepp-js/
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 67a4da5..342479a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,6 +1,7 @@
 
 stages:
   - test
+  - jsbuild
   - build
   - deploy
 
@@ -22,11 +23,23 @@ jstest:
    - npm i
    - npm run-script test
 
+jsbuild:
+  stage: jsbuild
+  when: manual
+  image: node:12
+
+  script:
+    - cd uhepp-js
+    - npm i
+    - npm run-script build
+
+  artifacts:
+    expire_in: 1 week
+    paths: 
+     - uhepp_org/uhepp_vault/static/uhepp-js/main.js*
+
 build:
   stage: build
-  # Build a docker image, tag it with the current git commit and push it to the
-  # gitlab registry.
-  when: manual
   image:
       name: docker/compose:1.24.0
       entrypoint: ["/bin/sh", "-c"]
@@ -37,6 +50,9 @@ build:
     - name: docker:18.09.7-dind
       alias: docker-in-docker
 
+  dependencies:
+    - jsbuild
+
   tags:
     # Use docker-machine (virtualbox) runner to run containers in priviliged
     # mode
diff --git a/uhepp-js/webpack.config.js b/uhepp-js/webpack.config.js
index eaea0e6..f55ca34 100644
--- a/uhepp-js/webpack.config.js
+++ b/uhepp-js/webpack.config.js
@@ -27,7 +27,7 @@ module.exports = {
   output: {
     filename: '[name].js',
     library: 'uhepp',
-    path: path.resolve(__dirname, 'dist')
+    path: path.resolve(__dirname, '../uhepp_org/uhepp_vault/static/uhepp-js')
   },
   module: {
     rules: [
diff --git a/uhepp_org/uhepp_vault/static/uhepp-js b/uhepp_org/uhepp_vault/static/uhepp-js
deleted file mode 120000
index ad8fdfb..0000000
--- a/uhepp_org/uhepp_vault/static/uhepp-js
+++ /dev/null
@@ -1 +0,0 @@
-../../../uhepp-js/dist/
\ No newline at end of file
-- 
GitLab