Revert "let's officially give up on jenkins"

This reverts commit d3c12dc6f5.
This commit is contained in:
rusefillc 2023-01-31 08:48:58 -05:00
parent d3c12dc6f5
commit 004180f27e
10 changed files with 216 additions and 0 deletions

View File

@ -0,0 +1,2 @@
@echo off
bash.exe misc/jenkins/functional_test_and_build_bundle/build_current_bundle.sh

View File

@ -0,0 +1,90 @@
#!/bin/bash
# This script would compile firmware, dev console and win32 simulator into a single bundle file
# This script depends on: zip
SCRIPT_NAME="build_current_bundle"
ROOT_FOLDER=$(pwd)
echo "$SCRIPT_NAME Entering ROOT_FOLDER=$ROOT_FOLDER"
echo "$SCRIPT_NAME.sh: Hello rusEFI build full bundle"
date "+%a %D %T.%2S"
export BUNDLE_NAME="default"
# As of 2023 default bundle comes without hard-coded UART connectivity - USB is king for modern stm32 rusEFI boards
# also OpenBLT is probably the more reasonable approach for UxART bootloader
#cd firmware/bootloader
#bash clean_bootloader.sh
#bash compile_bootloader_discovery407.sh
#[ -e bootloader_generated.hxx ] || { echo "FAILED TO COMPILE BOOTLOADER"; exit 1; }
#pwd
#cd ../..
# At root folder here
cd firmware
date "+%a %D %T.%2S"
echo "$SCRIPT_NAME: will be Erasing chip"
[ -e flash_erase407.sh ] || { echo "NOT FOUND flash_erase.sh"; exit 1; }
echo "$SCRIPT_NAME: Erasing chip"
bash flash_erase407.sh
echo "$SCRIPT_NAME: Building firmware"
bash clean.sh
bash update_version.sh
bash clean_compile_two_versions.sh
#[ -e deliver/rusefi_no_asserts.hex ] || { echo "Just to confirm - FAILED to compile no_asserts"; exit 1; }
[ -e deliver/rusefi.hex ] || { echo "Just to confirm - FAILED to compile default DEBUG"; exit 1; }
echo "$SCRIPT_NAME: Building DFU"
if uname | grep "NT"; then
chmod u+x ../misc/encedo_hex2dfu/hex2dfu.exe
# ../misc/encedo_hex2dfu/hex2dfu.exe -i deliver/rusefi_no_asserts.hex -o deliver/rusefi_no_asserts.dfu
../misc/encedo_hex2dfu/hex2dfu.exe -i deliver/rusefi.hex -o deliver/rusefi.dfu
else
chmod u+x ../misc/encedo_hex2dfu/hex2dfu.bin
# ../misc/encedo_hex2dfu/hex2dfu.bin -i deliver/rusefi_no_asserts.hex -o deliver/rusefi_no_asserts.dfu
../misc/encedo_hex2dfu/hex2dfu.bin -i deliver/rusefi.hex -o deliver/rusefi.dfu
fi
echo "${SCRIPT_NAME} ls -l deliver"
ls -l deliver
cd ..
# At root folder here
bash misc/jenkins/build_java_console.sh || { echo "rusefi_console.jar build FAILED"; exit 1; }
bash misc/jenkins/build_simulator.sh || { echo "rusefi_simulator.exe build FAILED"; exit 1; }
STM_ARCH="stm32f407"
TIMESTAMP=$(date "+%Y%m%d_%H%M%S")
if [ "$2" = "true" ]; then
FOLDER="rusefi.${1}.${STM_ARCH}"
else
FOLDER="rusefi.snapshot.${STM_ARCH}"
fi
echo "$SCRIPT_NAME: folder variable1=$FOLDER"
export FOLDER="temp/$FOLDER"
echo "$SCRIPT_NAME: folder variable3=$FOLDER"
pwd
# DfuFlasher.java validates this prefix
export BUNDLE_FULL_NAME="rusefi_bundle"
bash misc/jenkins/build_working_folder.sh "$1" "$2"
[ $? -eq 0 ] || { echo "$SCRIPT_NAME: ERROR: invoking build_working_folder.sh"; exit 1; }
echo "$SCRIPT_NAME: Going back to root folder"
cd "$ROOT_FOLDER"
pwd
echo "TIMESTAMP $(date "+%a %D %T.%2S")"
pwd
echo "exiting $SCRIPT_NAME"

View File

@ -0,0 +1,2 @@
@echo off
sh.exe misc/jenkins/functional_test_and_build_bundle.sh

View File

@ -0,0 +1,39 @@
#!/bin/bash
echo "TIMESTAMP $(date "+%a %D %T.%2S")"
SCRIPT_NAME="hw_test.sh"
echo "Entering $SCRIPT_NAME"
pwd
cd firmware
echo "$SCRIPT_NAME: erasing first"
bash flash_erase407.sh
echo "$SCRIPT_NAME: trying to flash"
# This script depends on someone else building firmware
bash flash_openocd407.sh
[ $? -eq 0 ] || { echo "ERROR invoking flash_openocd407.sh"; exit 1; }
[ -e build/rusefi.bin ] || { echo "FIRMWARE NOT FOUND"; exit 1; }
pwd
cd ..
# echo Running some commands
# pwd
# java -cp java_console_binary\rusefi_console.jar com.rusefi.CmdLine "set_led_blinking_period 10"
cd java_console
echo "Running tests"
which java
which javac
echo Sleeping few seconds to give OS time to connect VCP driver
sleep 20s
ant hardware_ci_f4_discovery
[ $? -eq 0 ] || { echo "ERROR DETECTED"; exit 1; }
echo "TIMESTAMP $(date "+%a %D %T.%2S")"
pwd
echo "exiting $SCRIPT_NAME"

View File

@ -0,0 +1,8 @@
This configuration
1) builds bootloader from firmware/bootload just to validate that it builds (TODO: extract to separate job?)
1) compiles two versions of F4 version of firmware - with and without asserts, _fast_ and _debug_.
1) flashes _debug_ version of F4 into stm32f4discovery and runs a suite of tests against it. The source code
of tests is embedded into rusEfi console by the way (TODO: nicer UI for console to test F4 outside of Jenkins?)
```misc/jenkins/functional_test_and_build_bundle/run.bat```

View File

@ -0,0 +1,2 @@
@echo off
sh.exe misc/jenkins/functional_test_and_build_bundle/run.sh

View File

@ -0,0 +1,15 @@
#!/bin/bash
git submodule update --init
bash misc/jenkins/functional_test_and_build_bundle/build_current_bundle.sh
[ $? -eq 0 ] || { echo "build ERROR DETECTED"; exit 1; }
# bash misc/jenkins/functional_test_and_build_bundle/simulator_test.sh
# [ $? -eq 0 ] || { echo "simulator test ERROR DETECTED"; exit 1; }
# Here we use last version of firmware produced by 'clean_compile_two_versions.bat'
if [ ! "$RUSEFI_SKIP_HW" ] || [ "$RUSEFI_SKIP_HW" = "false" ]; then
sh misc/jenkins/functional_test_and_build_bundle/hw_test.sh
[ $? -eq 0 ] || { echo "real hardware test ERROR DETECTED"; exit 1; }
fi

View File

@ -0,0 +1,2 @@
@echo off
sh.exe misc/jenkins/functional_test_and_build_bundle/simulator_test.sh

View File

@ -0,0 +1,15 @@
#!/bin/bash
echo "I am simulator_test.sh"
pwd
cd java_console
echo "Running simulator functional test"
which java
which javac
ant simulator_test
[ $? -eq 0 ] || { echo "ERROR DETECTED"; exit 1; }
echo "TIMESTAMP $(date "+%a %D %T.%2S")"
echo "simulator_test.sh: done"

View File

@ -0,0 +1,41 @@
echo "TIMESTAMP %date% %time% I am unit_tests.bat"
rem 'RUSEFI_BUILD_FTP_PASS' environment variable
echo We should be in root folder
pwd
rem Prior to running unit tests we build real hardware firmware
git submodule update --init
cd firmware
call update_version.bat
IF NOT ERRORLEVEL 0 echo ERROR: INVOKING VERSION HEADER GENERATOR
IF NOT ERRORLEVEL 0 EXIT /B 1
cd ..
echo We are in root folder
pwd
cd unit_tests
rem Clean build is needed since some file renames would produce a broken incremental build
rem Only here we are building unit_tests
call clean_compile.bat
pwd
ls -l build
if not exist build/rusefi_test.exe echo ERROR: FAILED TO COMPILE UNIT TESTS
if not exist build/rusefi_test.exe exit -1
echo "TIMESTAMP %date% %time% Unit tests build looks good, now executing unit tests"
call build\rusefi_test.exe
IF NOT ERRORLEVEL 0 echo ERROR: UNIT TEST FAILED
IF NOT ERRORLEVEL 0 EXIT /B 1
cd ..
echo Back to root folder
pwd