Merge branch 'feature/version_deploy' into 'develop'
Feature/version deploy See merge request !10
This commit is contained in:
commit
e310d27ff2
@ -1,68 +1,31 @@
|
|||||||
|
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
# PRODUCT_NAME: "AG"
|
SW_MAJOR: "0"
|
||||||
# PRODUCT_VARIANT: "NA"
|
SW_MINOR: "1"
|
||||||
# PRODUCT_VARIANT: "EU"
|
APP: "engine_control"
|
||||||
# PRODUCT_VARIANT: "CN"
|
|
||||||
# PROJECT_VERSION: "10"
|
|
||||||
# SW_MAJOR: "1"
|
|
||||||
# SW_MINOR: "3"
|
|
||||||
|
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- "echo $CI_BUILD_ID"
|
- "echo $CI_BUILD_ID"
|
||||||
- "echo $CI_BUILD_REF_NAME"
|
- "echo $CI_BUILD_REF_NAME"
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
# - check
|
|
||||||
- build
|
- build
|
||||||
# - test
|
- deploy
|
||||||
# - deploy
|
|
||||||
|
|
||||||
build_job:
|
build_job:
|
||||||
script:
|
script:
|
||||||
- "make all BOARD=stm32f4-discovery"
|
- "make all BOARD=stm32f4-discovery"
|
||||||
# - "make all BOARD=stm32f4-discovery DEBUG=y"
|
|
||||||
stage: build
|
stage: build
|
||||||
except:
|
except:
|
||||||
- /^release/.*$/
|
- /^release/.*$/
|
||||||
|
|
||||||
#check_job:
|
deploy_job:
|
||||||
# script:
|
stage: deploy
|
||||||
# - "make check BOARD=stm32f4-discovery DEBUG=y"
|
script:
|
||||||
# stage: check
|
- "source/scripts/release_number.py"
|
||||||
|
- "make deploy BOARD=stm32f4-discovery"
|
||||||
#test_job:
|
artifacts:
|
||||||
# script:
|
paths:
|
||||||
# - "python source/scripts/get_history.py"
|
- ./*.xz
|
||||||
# - "make install BOARD=stm32f4-discovery DEBUG=y"
|
only:
|
||||||
# stage: test
|
- tags
|
||||||
|
|
||||||
#int_release_job:
|
|
||||||
# script:
|
|
||||||
# - "cd top_agricola/core"
|
|
||||||
# - "./generate_ci_makefile.py"
|
|
||||||
# - "make -f Makefile_ci.gen all"
|
|
||||||
# - "cd ci"
|
|
||||||
# - "./deploy_release.py -t rc"
|
|
||||||
# stage: deploy
|
|
||||||
# only:
|
|
||||||
# - /^release/.*$/
|
|
||||||
# except:
|
|
||||||
# - tags
|
|
||||||
|
|
||||||
#ext_release_job:
|
|
||||||
# script:
|
|
||||||
# - "cd top_agricola/core"
|
|
||||||
# - "./generate_ci_makefile.py"
|
|
||||||
# - "make -f Makefile_ci.gen all"
|
|
||||||
# - "cd ci"
|
|
||||||
# - "./deploy_release.py -t r"
|
|
||||||
# stage: deploy
|
|
||||||
# only:
|
|
||||||
# - /^release/174_AG.*$/
|
|
||||||
# except:
|
|
||||||
# - branches
|
|
||||||
|
|
||||||
|
|
||||||
|
12
Makefile
12
Makefile
@ -2,11 +2,20 @@ include config/make/rules.mk
|
|||||||
|
|
||||||
APP ?= engine_control
|
APP ?= engine_control
|
||||||
|
|
||||||
|
# version numbering deployed by ci deploy script - no necessary for local build
|
||||||
|
ifdef SW_MAJOR
|
||||||
|
VERSION := -$(SW_MAJOR).$(SW_MINOR).$(CI_BUILD_ID)
|
||||||
|
else
|
||||||
|
VERSION :=
|
||||||
|
endif
|
||||||
MAINFILE = $(EXE_DIR)/$(APP)$(ELF_EXT)
|
MAINFILE = $(EXE_DIR)/$(APP)$(ELF_EXT)
|
||||||
BINFILE = $(EXE_DIR)/$(APP)$(BIN_EXT)
|
BINFILE = $(EXE_DIR)/$(APP)$(BIN_EXT)
|
||||||
HEXFILE = $(EXE_DIR)/$(APP)$(HEX_EXT)
|
HEXFILE = $(EXE_DIR)/$(APP)$(HEX_EXT)
|
||||||
SIZEFILE = $(SIZE_DIR)/$(APP)$(SIZE_EXT)
|
SIZEFILE = $(SIZE_DIR)/$(APP)$(SIZE_EXT)
|
||||||
MAP_FILE = $(MAP_DIR)/$(APP)$(MAP_EXT)
|
MAP_FILE = $(MAP_DIR)/$(APP)$(MAP_EXT)
|
||||||
|
|
||||||
|
DEPLOY_PACKET = $(APP)-$(ARCH)-$(BOARD)$(VERSION)$(DBG_EXT).tar.xz
|
||||||
|
|
||||||
INCLUDES += $(SRC_DIR)
|
INCLUDES += $(SRC_DIR)
|
||||||
|
|
||||||
SOURCES := $(wildcard $(SRC_DIR)/*.c)
|
SOURCES := $(wildcard $(SRC_DIR)/*.c)
|
||||||
@ -21,6 +30,9 @@ SOURCES += $(foreach folder, $(SUB_FOLDER), $(wildcard $(ROOT_DIR)/$(folder)/*.c
|
|||||||
|
|
||||||
all: $(MAINFILE)
|
all: $(MAINFILE)
|
||||||
|
|
||||||
|
deploy: all
|
||||||
|
tar cvJf $(DEPLOY_PACKET) -C $(EXE_DIR) .
|
||||||
|
|
||||||
$(MAINFILE): $(OBJECTS)
|
$(MAINFILE): $(OBJECTS)
|
||||||
@$(MKDIR) $(EXE_DIR)
|
@$(MKDIR) $(EXE_DIR)
|
||||||
@$(MKDIR) $(MAP_DIR)
|
@$(MKDIR) $(MAP_DIR)
|
||||||
|
9
source/application/include/version.h
Normal file
9
source/application/include/version.h
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
/* Release number include file */
|
||||||
|
|
||||||
|
#ifndef VERSION_H
|
||||||
|
#define VERSION_H
|
||||||
|
|
||||||
|
#define MAJOR_VERSION "unknown"
|
||||||
|
#define MINOR_VERSION "unknown"
|
||||||
|
#define BUILD_NUMBER "unknown"
|
||||||
|
#endif /* VERSION_H */
|
@ -11,6 +11,7 @@
|
|||||||
#include "driver.h"
|
#include "driver.h"
|
||||||
#include "shell.h"
|
#include "shell.h"
|
||||||
#include "drive_ctrl.h"
|
#include "drive_ctrl.h"
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
static void *drive_turn_right_cb(const char *param);
|
static void *drive_turn_right_cb(const char *param);
|
||||||
static void *drive_turn_left_cb(const char *param);
|
static void *drive_turn_left_cb(const char *param);
|
||||||
@ -19,6 +20,13 @@ static void *drive_retard_cb(const char *param);
|
|||||||
static void *drive_halt_cb(const char *param);
|
static void *drive_halt_cb(const char *param);
|
||||||
static void *drive_forward_cb(const char *param);
|
static void *drive_forward_cb(const char *param);
|
||||||
static void *drive_backward_cb(const char *param);
|
static void *drive_backward_cb(const char *param);
|
||||||
|
static void *app_version(const char *param);
|
||||||
|
|
||||||
|
static struct command cmd_app_version = {
|
||||||
|
.command = "version",
|
||||||
|
.description = "Get application version.",
|
||||||
|
.command_callback = app_version,
|
||||||
|
};
|
||||||
|
|
||||||
static struct command drive_forward = {
|
static struct command drive_forward = {
|
||||||
.command = "f",
|
.command = "f",
|
||||||
@ -71,6 +79,7 @@ int shell_commands_init(void)
|
|||||||
shell_add_command(&drive_halt);
|
shell_add_command(&drive_halt);
|
||||||
shell_add_command(&drive_turn_left);
|
shell_add_command(&drive_turn_left);
|
||||||
shell_add_command(&drive_turn_right);
|
shell_add_command(&drive_turn_right);
|
||||||
|
shell_add_command(&cmd_app_version);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -150,3 +159,18 @@ static void *drive_backward_cb(const char *param)
|
|||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void *app_version(const char *param)
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
char *greeter = "engine_control version: ";
|
||||||
|
|
||||||
|
drv_write(shell_object.shell_device, greeter, strlen(greeter));
|
||||||
|
drv_write(shell_object.shell_device, MAJOR_VERSION, strlen(MAJOR_VERSION));
|
||||||
|
drv_write(shell_object.shell_device, ".", 1);
|
||||||
|
drv_write(shell_object.shell_device, MINOR_VERSION, strlen(MINOR_VERSION));
|
||||||
|
drv_write(shell_object.shell_device, ".", 1);
|
||||||
|
drv_write(shell_object.shell_device, BUILD_NUMBER, strlen(BUILD_NUMBER));
|
||||||
|
#endif
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
43
source/scripts/release_number.py
Executable file
43
source/scripts/release_number.py
Executable file
@ -0,0 +1,43 @@
|
|||||||
|
#!/usr/bin/python2
|
||||||
|
from sys import argv, exit
|
||||||
|
from getopt import getopt
|
||||||
|
from re import match, sub
|
||||||
|
import os
|
||||||
|
|
||||||
|
def get_current_numbers():
|
||||||
|
config = {}
|
||||||
|
if os.environ.has_key("SW_MAJOR"):
|
||||||
|
config["sw_major"] = os.environ["SW_MAJOR"]
|
||||||
|
if os.environ.has_key("SW_MINOR"):
|
||||||
|
config["sw_minor"] = os.environ["SW_MINOR"]
|
||||||
|
if os.environ.has_key("CI_BUILD_ID"):
|
||||||
|
config["build_id"] = os.environ["CI_BUILD_ID"]
|
||||||
|
return config
|
||||||
|
|
||||||
|
def generate_include(numbers):
|
||||||
|
f = open("source/application/include/version.h", "w")
|
||||||
|
f.write("/* Release number include file */\n\n")
|
||||||
|
f.write("#ifndef VERSION_H\n")
|
||||||
|
f.write("#define VERSION_H\n\n")
|
||||||
|
if numbers.has_key("sw_major"):
|
||||||
|
f.write("#define MAJOR_VERSION\t\"" + numbers["sw_major"] + "\"\n")
|
||||||
|
else:
|
||||||
|
f.write("#define MAJOR_VERSION\t\"unknown\"\n")
|
||||||
|
if numbers.has_key("sw_minor"):
|
||||||
|
f.write("#define MINOR_VERSION\t\"" + numbers["sw_minor"] + "\"\n")
|
||||||
|
else:
|
||||||
|
f.write("#define MINOR_VERSION\t\"unknown\"\n")
|
||||||
|
if numbers.has_key("build_id"):
|
||||||
|
f.write("#define BUILD_NUMBER\t\"" + numbers["build_id"] + "\"\n")
|
||||||
|
else:
|
||||||
|
f.write("#define BUILD_NUMBER\t\"unknown\"\n")
|
||||||
|
f.write("\n#endif /* VERSION_H */\n")
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
def main(argv):
|
||||||
|
numbers = get_current_numbers()
|
||||||
|
generate_include(numbers)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main(argv[1:])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user