From f4f5f4ef984c7f874183e1a0039f3903daf7da49 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Mon, 5 Aug 2019 12:07:17 +0100 Subject: [PATCH] Start writing lantern build script for CI --- .gitmodules | 3 ++ build | 83 ++++++++++++++++++++++++++++++++++++++++++++ lantern-build-engine | 1 + 3 files changed, 87 insertions(+) create mode 100644 .gitmodules create mode 100755 build create mode 160000 lantern-build-engine diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..ecc03d9 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lantern-build-engine"] + path = lantern-build-engine + url = https://gitlab.com/sbrl/lantern-build-engine.git diff --git a/build b/build new file mode 100755 index 0000000..0f4634e --- /dev/null +++ b/build @@ -0,0 +1,83 @@ +#!/usr/bin/env bash +# Make sure the current directory is the location of this script to simplify matters +cd "$(dirname $(readlink -f $0))"; +################ +### Settings ### +################ + +# The name of this project +project_name="PolyFeed"; + +# The path to the lantern build engine git submodule +lantern_path="./lantern-build-engine"; + +### +# Custom Settings +### + +# Put any custom settings here. +build_output_folder="./dist"; + +############################################################################### + +# Check out the lantern git submodule if needed +if [ ! -f "${lantern_path}/lantern.sh" ]; then git submodule update --init "${lantern_path}"; fi + +source "${lantern_path}/lantern.sh"; + +if [[ "$#" -lt 1 ]]; then + echo -e "${FBLE}${project_name}${RS} build script"; + echo -e " by Starbeamrainbowlabs"; + echo -e "${LC}Powered by the lantern build engine, v${version}${RS}"; + echo -e ""; + echo -e "${CSECTION}Usage${RS}"; + echo -e " ./build ${CTOKEN}{action}${RS} ${CTOKEN}{action}${RS} ${CTOKEN}{action}${RS} ..."; + echo -e ""; + echo -e "${CSECTION}Available actions${RS}"; + echo -e " ${CACTION}setup${RS} - Do initial setup"; + echo -e " ${CACTION}ci${RS} - Execute CI tasks"; + echo -e ""; + + exit 1; +fi + +############################################################################### + +task_setup() { + task_begin "Checking environment"; + + check_command git true; + check_command msbuild true; + check_command nuget true; + check_command fpm true; + + task_end 0; + + + task_begin "Initialising submodules"; + execute git submodule update --init; + task_end $?; +} + +task_build() { + task_begin "Building PolyFeed for release"; + execute nuget restore; + execute msbuild /p:Configuration=Release; + execute chmod -x PolyFeed/bin/Release/*; + execute chmod +x PolyFeed/bin/Release/*.exe; + task_end $?; +} + +task_package() { + task_begin "Packaging as .deb"; + + task_end $?; +} + +task_ci() { + tasks_run setup build package; +} + +############################################################################### + +tasks_run $@; diff --git a/lantern-build-engine b/lantern-build-engine new file mode 160000 index 0000000..617fcdb --- /dev/null +++ b/lantern-build-engine @@ -0,0 +1 @@ +Subproject commit 617fcdb5b9df7f57ccb6639a87be68238f99b9ed