From 84e7a1a1a2dcc343618409c672dbc187104f0611 Mon Sep 17 00:00:00 2001 From: DanyLE Date: Sun, 10 Mar 2024 09:11:02 +0100 Subject: [PATCH] improve: optimize pipeline + clean C based project before build --- Jenkinsfile | 32 ++++++++++++++++++++++++-------- Makefile | 23 +++++++++++++---------- 2 files changed, 37 insertions(+), 18 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ad69f31..79d1127 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,4 +1,4 @@ -def build_rust_and_frontend() { +def build_rust_mod() { sh '''#!/bin/bash set -e set -x @@ -52,7 +52,7 @@ def build_server_and_backend() { PLATFORM=$arch \ FRONTEND_IGNORE=true \ LUAFCGI_IGNORE=true \ - make + make clean_c all ''' } @@ -112,7 +112,23 @@ pipeline { ''' } } - stage('Build RUST + FRONTEND AMD64') { + stage('Build Frontend (TS)') { + agent { + node { label'workstation' } + } + steps { + sh''' + mkdir -p build/frontend/ + DESTDIR=$(realpath build/frontend/) make frontend + for arch in arm arm64 amd64; do + mkdir build/$arch + cp -rf build/frontend/* build/$arch/ + done + rm -rf build/frontend + ''' + } + } + stage('Build RUST MODULE AMD64') { agent { node { label'workstation' } } @@ -120,10 +136,10 @@ pipeline { script { env.arch = 'amd64' } - build_rust_and_frontend() + build_rust_mod() } } - stage('Build RUST + FRONTEND ARM64') { + stage('Build RUST MODULE ARM64') { agent { node { label'workstation' } } @@ -131,10 +147,10 @@ pipeline { script { env.arch = 'arm64' } - build_rust_and_frontend() + build_rust_mod() } } - stage('Build RUST + FRONTEND ARM') { + stage('Build RUST MODULE ARM') { agent { node { label'workstation' } } @@ -142,7 +158,7 @@ pipeline { script { env.arch = 'arm' } - build_rust_and_frontend() + build_rust_mod() } } diff --git a/Makefile b/Makefile index b1f427c..703dabd 100644 --- a/Makefile +++ b/Makefile @@ -86,16 +86,19 @@ else @echo "Ignore building $@" endif -clean: - @echo "Clean all target" - make -C antd/ant-http clean - make -C antd/antd-fcgi-plugin clean - make -C antd/antd-tunnel-plugin clean - make -C antd/antd-wvnc-plugin clean - make -C antd/antd-tunnel-publishers clean - make -C antd/luasec clean - make -C antd/luasocket clean - make -C antd/silk clean +clean_c: + @echo "Clean all C based modules" + -make -C antd/ant-http clean + -make -C antd/antd-fcgi-plugin clean + -make -C antd/antd-tunnel-plugin clean + -make -C antd/antd-wvnc-plugin clean + -make -C antd/antd-tunnel-publishers clean + -make -C antd/luasec clean + -make -C antd/luasocket clean + -make -C antd/silk clean + +clean: clean_c + @echo "Clean Rust project and output DIR" RUSTUP_HOME=$(RUSTUP_HOME) CARGO_HOME=$(CARGO_HOME) \ . $(CARGO_HOME)/env && cargo clean \ --manifest-path=$(ROOT_DIR)/antd/luafcgi/Cargo.toml \