Skip to content
Snippets Groups Projects
Commit 6afdac9a authored by Dmitry Rodionov's avatar Dmitry Rodionov
Browse files

chore: incorporate webui submodule

parent b90fffe5
No related branches found
No related tags found
1 merge request!1136chore: incorporate webui submodule
Pipeline #45194 passed
...@@ -77,10 +77,10 @@ variables: ...@@ -77,10 +77,10 @@ variables:
.base_node: &base_node .base_node: &base_node
paths: paths:
- picodata-webui/node_modules/ - webui/node_modules/
key: key:
files: files:
- picodata-webui/yarn.lock - webui/yarn.lock
.py_cache: &py_cache .py_cache: &py_cache
paths: paths:
...@@ -459,7 +459,7 @@ deploy-docker: ...@@ -459,7 +459,7 @@ deploy-docker:
project: picodata/devops/picodata-in-docker project: picodata/devops/picodata-in-docker
branch: main branch: main
strategy: depend strategy: depend
# Stages of independent stress testing in downstream pipeline # Stages of independent stress testing in downstream pipeline
# We cannot move artefacts to the downstream pipeline, so we need to build and upload them to our repo # We cannot move artefacts to the downstream pipeline, so we need to build and upload them to our repo
upload-picodata-to-binary: upload-picodata-to-binary:
......
...@@ -7,6 +7,8 @@ use std::path::Path; ...@@ -7,6 +7,8 @@ use std::path::Path;
use std::process::Command; use std::process::Command;
use std::process::Stdio; use std::process::Stdio;
const WEBUI_DIR: &str = "webui";
// See also: https://doc.rust-lang.org/cargo/reference/build-scripts.html // See also: https://doc.rust-lang.org/cargo/reference/build-scripts.html
fn main() { fn main() {
do_compile_time_checks(); do_compile_time_checks();
...@@ -22,10 +24,10 @@ fn main() { ...@@ -22,10 +24,10 @@ fn main() {
// │ ├── CMakeLists.txt // used for dynamic build // │ ├── CMakeLists.txt // used for dynamic build
// │ └── static-build // │ └── static-build
// │ └── CMakeLists.txt // configures above CMakeLists.txt for static build // │ └── CMakeLists.txt // configures above CMakeLists.txt for static build
// ├── picodata-webui // ├── webui
// └── <target-dir>/<build-type>/build // <- build_root // └── <target-dir>/<build-type>/build // <- build_root
// ├── picodata-<smth>/out // <- std::env::var("OUT_DIR") // ├── picodata-<smth>/out // <- std::env::var("OUT_DIR")
// ├── picodata-webui // ├── webui
// ├── tarantool-http // ├── tarantool-http
// └── tarantool-sys/{static,dynamic} // └── tarantool-sys/{static,dynamic}
// ├── ncurses-prefix // ├── ncurses-prefix
...@@ -38,8 +40,7 @@ fn main() { ...@@ -38,8 +40,7 @@ fn main() {
// Running `cargo build` and `cargo clippy` produces 2 different // Running `cargo build` and `cargo clippy` produces 2 different
// `out_dir` paths. To avoid unnecessary rebuilds we use a different // `out_dir` paths. To avoid unnecessary rebuilds we use a different
// build root for foreign deps (tarantool-sys, tarantool-http, // build root for foreign deps (tarantool-sys, tarantool-http, webui)
// picodata-webui)
let build_root = Path::new(&out_dir).ancestors().nth(2).unwrap(); let build_root = Path::new(&out_dir).ancestors().nth(2).unwrap();
dbg!(&build_root); // "<target-dir>/<build-type>/build" dbg!(&build_root); // "<target-dir>/<build-type>/build"
...@@ -236,16 +237,17 @@ fn generate_export_stubs(out_dir: &str) { ...@@ -236,16 +237,17 @@ fn generate_export_stubs(out_dir: &str) {
fn rerun_if_webui_changed() { fn rerun_if_webui_changed() {
use std::fs; use std::fs;
let source_dir = std::env::current_dir().unwrap().join("picodata-webui"); let source_dir = std::env::current_dir().unwrap().join(WEBUI_DIR);
// Do not rerun for generated files changes // Do not rerun for generated files changes
let ignored_files = ["node_modules", ".husky"]; let ignored_files = ["node_modules", ".husky"];
for entry in fs::read_dir(source_dir) for entry in fs::read_dir(source_dir)
.expect("failed to scan picodata-webui dir") .expect("failed to scan webui dir")
.flatten() .flatten()
{ {
if !ignored_files.contains(&entry.file_name().to_str().unwrap()) { if !ignored_files.contains(&entry.file_name().to_str().unwrap()) {
println!( println!(
"cargo:rerun-if-changed=picodata-webui/{}", "cargo:rerun-if-changed={}/{}",
WEBUI_DIR,
entry.file_name().to_string_lossy() entry.file_name().to_string_lossy()
); );
} }
...@@ -260,8 +262,8 @@ fn build_webui(build_root: &Path) { ...@@ -260,8 +262,8 @@ fn build_webui(build_root: &Path) {
} }
println!("building webui_bundle ..."); println!("building webui_bundle ...");
let source_dir = std::env::current_dir().unwrap().join("picodata-webui"); let source_dir = std::env::current_dir().unwrap().join(WEBUI_DIR);
let out_dir = build_root.join("picodata-webui"); let out_dir = build_root.join(WEBUI_DIR);
let out_dir_str = out_dir.display().to_string(); let out_dir_str = out_dir.display().to_string();
let webui_bundle = out_dir.join("bundle.json"); let webui_bundle = out_dir.join("bundle.json");
......
default:
tags:
- docker
image: node:19.8-alpine
stages:
- lint
- test
lint:
stage: lint
before_script:
- yarn add eslint
script:
- yarn lint
.test:
stage: test
before_script:
- yarn add jest
script:
- yarn test
...@@ -12,8 +12,7 @@ ...@@ -12,8 +12,7 @@
"lint": "eslint src --max-warnings 0", "lint": "eslint src --max-warnings 0",
"lint:fix": "eslint --fix src", "lint:fix": "eslint --fix src",
"type-check:watch": "tsc -w --pretty", "type-check:watch": "tsc -w --pretty",
"type-check": "tsc --noEmit", "type-check": "tsc --noEmit"
"prepare": "husky install"
}, },
"lint-staged": { "lint-staged": {
"*.ts": "yarn tsc --noEmit", "*.ts": "yarn tsc --noEmit",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment