build bundle in make

put zips in artifacts dir; don't upload derived dfu and bin

fix outbin

fix drivers always downloading

use SHORT_BOARD_NAME for BUNDLE_NAME if it is empty
This commit is contained in:
David Holdeman 2024-02-05 19:15:36 -06:00 committed by rusefillc
parent 05f1c5be29
commit 3b9ba27d73
4 changed files with 139 additions and 215 deletions

View File

@ -597,15 +597,12 @@ jobs:
if: ${{ env.skip != 'true' }}
working-directory: ./firmware/
run: |
source config/boards/common_script_read_meta_env.inc ${{ env.BOARD_META_PATH }}
make clean
make bundle -j$(nproc) -r
- name: Package Bundle
if: ${{ env.full == 'true' }}
run: |
source firmware/config/boards/common_script_read_meta_env.inc firmware/${{ env.BOARD_META_PATH }}
bash misc/jenkins/build_working_folder.sh
if [ "$full" == "true" ]; then
bash bin/compile.sh -b ${{env.BOARD_META_PATH}}
else
bash bin/compile.sh ${{env.BOARD_META_PATH}} all deliver/rusefi.dfu deliver/rusefi.bin
fi
- name: Upload Bundle
if: ${{ env.full == 'true' }}

View File

@ -92,6 +92,7 @@ jobs:
cd ..
echo "META_OUTPUT_ROOT_FOLDER=$(realpath firmware/$BOARD_DIR/generated)/" >> $GITHUB_ENV
echo "${{ secrets.ADDITIONAL_ENV }}" >> $GITHUB_ENV
echo "BUNDLE_SIMULATOR=no" >> $GITHUB_ENV
# Build machines don't have arm-none-eabi gcc, so let's download it and put it on the path
- name: Download & Install GCC
@ -169,9 +170,13 @@ jobs:
working-directory: generated/tunerstudio/generated
run: ../../../${{inputs.rusefi_dir}}/firmware/tunerstudio/upload_ini.sh ${{ secrets.RUSEFI_ONLINE_FTP_USER }} ${{ secrets.RUSEFI_ONLINE_FTP_PASS }} ${{ secrets.RUSEFI_FTP_SERVER }}
- name: Build console
working-directory: ${{inputs.rusefi_dir}}
run: bash misc/jenkins/build_java_console.sh
- name: Build Firmware
working-directory: ${{inputs.rusefi_dir}}/firmware
run: bash bin/compile.sh -b ${{ env.BOARD_META_PATH }}
run: bash bin/compile.sh -b ${{ env.BOARD_META_PATH }} deliver/rusefi.bin
- name: Upload build bin artifact
uses: actions/upload-artifact@v4
@ -189,7 +194,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: rusefi.hex
path: ${{inputs.rusefi_dir}}/firmware/deliver/rusefi*.hex
path: ${{inputs.rusefi_dir}}/firmware/build/rusefi*.hex
- name: Upload build list artifact
uses: actions/upload-artifact@v4
@ -209,10 +214,6 @@ jobs:
name: rusefi.elf
path: ${{inputs.rusefi_dir}}/firmware/build/rusefi*.elf
- name: Build console
working-directory: ${{inputs.rusefi_dir}}
run: bash misc/jenkins/build_java_console.sh
- name: Set SSH variables
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
@ -226,10 +227,6 @@ jobs:
echo "NOT setting credentials: ${{github.event_name}} ${{github.ref}}"
fi
- name: Package and Upload Bundle
working-directory: ${{inputs.rusefi_dir}}
run: bash misc/jenkins/build_working_folder.sh
- name: Upload bundle artifact
uses: actions/upload-artifact@v4
with:

View File

@ -1,63 +1,162 @@
ifeq (,$(BUNDLE_NAME))
BUNDLE_NAME = $(SHORT_BOARD_NAME)
endif
ifneq (,$(findstring NT,$(UNAME_S)))
H2D = ../misc/encedo_hex2dfu/hex2dfu.exe
else
H2D = ../misc/encedo_hex2dfu/hex2dfu.bin
endif
DFUS = deliver/$(PROJECT).dfu
DFU = $(DELIVER)/$(PROJECT).dfu
DBIN = $(DELIVER)/$(PROJECT).bin
OUTBIN = $(FOLDER)/$(PROJECT).bin
BUNDLEFILES = \
$(DFUS) \
$(OUTS) \
$(BOUTS) \
$(OUTBIN)
ifeq ($(LTS),true)
ifneq (,$(REF))
FOLDER = rusefi.$(REF).$(BUNDLE_NAME)
else
FOLDER = rusefi.snapshot.$(BUNDLE_NAME)
endif
else
FOLDER = rusefi.snapshot.$(BUNDLE_NAME)
endif
INI_FILE = $(META_OUTPUT_ROOT_FOLDER)tunerstudio/generated/rusefi_$(SHORT_BOARD_NAME).ini
DELIVER = deliver
ARTIFACTS = ../artifacts
BUNDLE_FULL_NAME = rusefi_bundle_$(BUNDLE_NAME)
CONSOLE_FOLDER = $(FOLDER)/console
DRIVERS_FOLDER = $(FOLDER)/drivers
CACERTS_FOLDER = $(FOLDER)/update-ts-cacerts
UPDATE_FOLDER_SOURCES = \
$(RUSEFI_CONSOLE_SETTINGS) \
$(INI_FILE) \
../misc/console_launcher/readme.html
# ../misc/console_launcher/rusefi_updater.exe
FOLDER_SOURCES = \
../java_console/bin
UPDATE_CONSOLE_FOLDER_SOURCES = \
../java_console_binary/rusefi_autoupdate.jar \
../java_console_binary/rusefi_console.jar
ifneq ($(BUNDLE_SIMULATOR),no)
SIMULATOR = ../simulator/build/rusefi_simulator.exe
endif
CONSOLE_FOLDER_SOURCES = \
../misc/console_launcher/rusefi_autoupdate.exe \
../misc/console_launcher/rusefi_console.exe \
../misc/install/openocd \
../misc/install/STM32_Programmer_CLI \
$(wildcard ../java_console/*.dll) \
../firmware/ext/openblt/Host/libopenblt.dll \
../firmware/ext/openblt/Host/libopenblt.so \
../firmware/ext/openblt/Host/libopenblt.dylib \
../firmware/ext/openblt/Host/openblt_jni.dll \
../firmware/ext/openblt/Host/libopenblt_jni.so \
../firmware/ext/openblt/Host/libopenblt_jni.dylib \
$(SIMULATOR)
CACERTS_FOLDER_SOURCES = $(wildcard ../misc/console_launcher/update-ts-cacerts/*)
ifeq ($(USE_OPENBLT),yes)
BOOTLOADER_BIN = bootloader/blbuild/openblt_$(PROJECT_BOARD).bin
BOOTLOADER_HEX = bootloader/blbuild/openblt_$(PROJECT_BOARD).hex
BOUTS = deliver/openblt.bin
OUTBIN = deliver/$(PROJECT).bin
OUTBIN_IN = .hex
BOUTS = $(FOLDER)/openblt.bin
SREC_TARGET = $(FOLDER)/rusefi_update.srec
else
OUTBIN = deliver/$(PROJECT).bin
OUTBIN_IN = .bin
OUTS = deliver/$(PROJECT).hex
OUTS = $(FOLDER)/$(PROJECT).hex
BINSRC = $(BUILDDIR)/$(PROJECT).bin
ifeq ($(INCLUDE_ELF),yes)
OUTS += deliver/$(PROJECT).elf deliver/$(PROJECT).map deliver/$(PROJECT).list
OUTS += $(FOLDER)/$(PROJECT).elf $(FOLDER)/$(PROJECT).map $(FOLDER)/$(PROJECT).list
endif
endif
ST_DRIVERS = $(DRIVERS_FOLDER)/silent_st_drivers2.exe
UPDATE_FOLDER_TARGETS = $(addprefix $(FOLDER)/,$(notdir $(UPDATE_FOLDER_SOURCES)))
UPDATE_CONSOLE_FOLDER_TARGETS = $(addprefix $(CONSOLE_FOLDER)/,$(notdir $(UPDATE_CONSOLE_FOLDER_SOURCES)))
CACERTS_FOLDER_TARGETS = $(addprefix $(CACERTS_FOLDER)/,$(notdir $(CACERTS_FOLDER_SOURCES)))
UPDATE_BUNDLE_FILES = \
$(OUTS) \
$(BOUTS) \
$(OUTBIN) \
$(SREC_TARGET) \
$(UPDATE_FOLDER_TARGETS) \
$(UPDATE_CONSOLE_FOLDER_TARGETS) \
$(CACERTS_FOLDER_TARGETS)
FOLDER_TARGETS = $(addprefix $(FOLDER)/,$(notdir $(FOLDER_SOURCES)))
CONSOLE_FOLDER_TARGETS = $(addprefix $(CONSOLE_FOLDER)/,$(notdir $(CONSOLE_FOLDER_SOURCES)))
BUNDLE_FILES = \
$(UPDATE_BUNDLE_FILES) \
$(ST_DRIVERS) \
$(FOLDER_TARGETS) \
$(CONSOLE_FOLDER_TARGETS)
$(BOOTLOADER_HEX) $(BOOTLOADER_BIN) &:
BOARD_DIR=../$(BOARD_DIR) BOARD_META_PATH=../$(BOARD_META_PATH) $(MAKE) -C bootloader -r
$(BUILDDIR)/$(PROJECT).map: $(BUILDDIR)/$(PROJECT).elf
$(OUTBIN): deliver/%.bin: $(BUILDDIR)/%$(OUTBIN_IN) $(BOOTLOADER_HEX) | deliver
ifeq ($(USE_OPENBLT),yes)
$(H2D) -i $(BOOTLOADER_HEX) -i $< -C 0x1C -b $@
else
$(SREC_TARGET): $(BUILDDIR)/rusefi.srec
ln -rfs $< $@
endif
$(OUTS): deliver/%: $(BUILDDIR)/%
cp $< $@
$(OUTS): $(FOLDER)/%: $(BUILDDIR)/% | $(FOLDER)
ln -rfs $< $@
$(BOUTS): deliver/openblt%: bootloader/blbuild/openblt_$(PROJECT_BOARD)%
cp $< $@
$(BOUTS): $(FOLDER)/openblt%: bootloader/blbuild/openblt_$(PROJECT_BOARD)% | $(FOLDER)
ln -rfs $< $@
$(DFUS): deliver/%.dfu: $(BUILDDIR)/%.hex $(BOOTLOADER_HEX) deliver
$(OUTBIN) $(FOLDER)/$(PROJECT).dfu: $(FOLDER)/%: $(DELIVER)/% | $(FOLDER)
ln -rfs $< $@
$(DFU) $(DBIN) &: $(BUILDDIR)/$(PROJECT).hex $(BOOTLOADER_HEX) $(BINSRC) | $(DELIVER)
ifeq ($(USE_OPENBLT),yes)
$(H2D) -i $(BOOTLOADER_HEX) -i $< -C 0x1C -o $@ -b deliver/$(PROJECT).bin
$(H2D) -i $(BOOTLOADER_HEX) -i $(BUILDDIR)/$(PROJECT).hex -C 0x1C -o $(DFU) -b $(DBIN)
else
$(H2D) -i $< -C 0x1C -o $@
$(H2D) -i $(BUILDDIR)/$(PROJECT).hex -C 0x1C -o $(DFU)
cp $(BUILDDIR)/$(PROJECT).bin $(DBIN)
endif
deliver:
mkdir -p deliver
$(ST_DRIVERS): | $(DRIVERS_FOLDER)
wget https://rusefi.com/build_server/st_files/silent_st_drivers2.exe -P $(dir $@)
bundle: $(BUNDLEFILES) all
$(DELIVER) $(ARTIFACTS) $(FOLDER) $(CONSOLE_FOLDER) $(DRIVERS_FOLDER) $(CACERTS_FOLDER):
mkdir -p $@
$(ARTIFACTS)/$(BUNDLE_FULL_NAME).zip: $(BUNDLE_FILES) | $(ARTIFACTS)
zip -r $@ $(BUNDLE_FILES)
$(ARTIFACTS)/$(BUNDLE_FULL_NAME)_autoupdate.zip: $(UPDATE_BUNDLE_FILES) | $(ARTIFACTS)
cd $(FOLDER) && zip -r ../$@ $(subst $(FOLDER)/,,$(UPDATE_BUNDLE_FILES))
.PHONY: bundle
bundle: $(ARTIFACTS)/$(BUNDLE_FULL_NAME)_autoupdate.zip $(ARTIFACTS)/$(BUNDLE_FULL_NAME).zip all
CLEAN_BUNDLE_HOOK:
@echo Cleaning bundle
BOARD_DIR=../$(BOARD_DIR) BOARD_META_PATH=../$(BOARD_META_PATH) $(MAKE) -C bootloader clean
rm -rf $(FOLDER)
PERCENT = %
.SECONDEXPANSION:
$(FOLDER_TARGETS) $(UPDATE_FOLDER_TARGETS): $(FOLDER)/%: $$(filter $$(PERCENT)$$*,$(FOLDER_SOURCES) $(UPDATE_FOLDER_SOURCES)) | $(FOLDER)
ln -rfs $< $@
$(CONSOLE_FOLDER_TARGETS) $(UPDATE_CONSOLE_FOLDER_TARGETS): $(CONSOLE_FOLDER)/%: $$(filter $$(PERCENT)$$*,$(CONSOLE_FOLDER_SOURCES) $(UPDATE_CONSOLE_FOLDER_SOURCES)) | $(CONSOLE_FOLDER)
ln -rfs $< $@
$(CACERTS_FOLDER_TARGETS): $(CACERTS_FOLDER)/%: $$(filter $$(PERCENT)$$*,$(CACERTS_FOLDER_SOURCES)) | $(CACERTS_FOLDER)
ln -rfs $< $@

View File

@ -1,169 +0,0 @@
#!/bin/bash
#
# file build_working_folder.sh
#
# LTS: at some we had a dream of Long-term support branches. As of Jan 2024 this is not being used
#
# BUNDLE_NAME="uaefi" LTS="true" REF="ltsbranch" bash misc/jenkins/build_working_folder.sh
#
set -e
if [ -z "$BUNDLE_NAME" ]; then
echo "BUNDLE_NAME variable not defined"
exit -1
fi
if [ "$LTS" = "true" -a -n "$REF" ]; then
FOLDER="temp/rusefi.${REF}.${BUNDLE_NAME}"
else
FOLDER="temp/rusefi.snapshot.${BUNDLE_NAME}"
fi
if [ -z "$META_OUTPUT_ROOT_FOLDER" ]; then
META_OUTPUT_ROOT_FOLDER="firmware/"
fi
INI_FILE_OVERRIDE="${META_OUTPUT_ROOT_FOLDER}tunerstudio/generated/rusefi_$SHORT_BOARD_NAME.ini"
# technical debt: more than one file uses magic 'rusefi_bundle_' constant, can we extract constant?
BUNDLE_FULL_NAME="rusefi_bundle_${BUNDLE_NAME}"
echo "$SCRIPT_NAME: Will use $INI_FILE_OVERRIDE"
if [ ! -f $INI_FILE_OVERRIDE ]; then
echo "$INI_FILE_OVERRIDE does not exist"
exit -1
fi
FULL_BUNDLE_SHORT_FILE="${BUNDLE_FULL_NAME}.zip"
UPDATE_BUNDLE_SHORT_FILE="${BUNDLE_FULL_NAME}_autoupdate.zip"
FULL_BUNDLE_FILE="artifacts/${FULL_BUNDLE_SHORT_FILE}"
UPDATE_BUNDLE_FILE="artifacts/${UPDATE_BUNDLE_SHORT_FILE}"
echo "${BUNDLE_FULL_NAME}: Packaging $FULL_BUNDLE_FILE file"
rm -rf temp
mkdir temp
SCRIPT_NAME=build_working_folder.sh
echo "Entering $SCRIPT_NAME"
echo "Exploring build content"
ls -l firmware/build
echo "Exploring deliver content"
ls -l firmware/deliver
pwd
# This working folder name starts with 'temp/'
echo "$SCRIPT_NAME: Working folder [$FOLDER]"
mkdir $FOLDER
CONSOLE_FOLDER="$FOLDER/console"
DRIVERS_FOLDER="$FOLDER/drivers"
update_ts_cacerts_FOLDER="$FOLDER/update-ts-cacerts"
mkdir $CONSOLE_FOLDER
mkdir -p artifacts
rm -rf artifacts/*
mkdir $update_ts_cacerts_FOLDER
if [ -z $RUSEFI_CONSOLE_SETTINGS ]; then
echo "$SCRIPT_NAME: No rusefi_console_settings"
else
echo "Using rusefi_console_settings [$RUSEFI_CONSOLE_SETTINGS]"
cp $RUSEFI_CONSOLE_SETTINGS $CONSOLE_FOLDER
fi
cp $INI_FILE_OVERRIDE $FOLDER
cp java_console_binary/rusefi_autoupdate.jar $CONSOLE_FOLDER
cp java_console_binary/rusefi_console.jar $CONSOLE_FOLDER
# todo: uncomment line below once https://github.com/rusefi/rusefi/issues/5577
# cp misc/console_launcher/rusefi_updater.exe $FOLDER
cp misc/console_launcher/update-ts-cacerts/* $update_ts_cacerts_FOLDER
cp misc/console_launcher/readme.html $FOLDER
# Unsetting since would not be used anywhere else
INI_FILE_OVERRIDE=""
RUSEFI_CONSOLE_SETTINGS=""
pwd
cp firmware/deliver/rusefi.bin $FOLDER
if [ -e firmware/deliver/rusefi.elf ]; then
# ELF is useful for debug bundles
cp firmware/deliver/rusefi.elf $FOLDER
fi
# bootloader
[ -e firmware/deliver/openblt.bin ] && { cp firmware/deliver/openblt.bin $FOLDER ; }
# USE_OPENBLT is not available this script is invoked as a separate GHA step
if [ -f firmware/deliver/openblt.bin ]; then
echo "Taking .srec under different name"
# srec is the only format used by OpenBLT host tools
cp firmware/build/rusefi.srec $FOLDER/rusefi_update.srec
else
echo "Do not need .srec"
fi
ls -l $FOLDER
[ -e firmware/deliver/rusefi.bin ] || { echo "$SCRIPT_NAME: rusefi.bin not found"; exit 1; }
# for autoupdate we do not want the unique folder name with timestamp
cd $FOLDER
pwd
zip -r ../../$UPDATE_BUNDLE_FILE *
cd ../..
echo "$SCRIPT_NAME: We are back in root directory. Now let's add files to make full bundle!"
mkdir $DRIVERS_FOLDER
# this magic file is created manually using 'make_package2.bat'
wget https://rusefi.com/build_server/st_files/silent_st_drivers2.exe -P $DRIVERS_FOLDER
[ -e $DRIVERS_FOLDER/silent_st_drivers2.exe ] || { echo "$SCRIPT_NAME: ERROR DOWNLOADING silent_st_drivers2.exe"; exit 1; }
if [ -f simulator/build/rusefi_simulator.exe ]; then
cp simulator/build/rusefi_simulator.exe $CONSOLE_FOLDER
fi
cp misc/console_launcher/rusefi_autoupdate.exe $CONSOLE_FOLDER
cp misc/console_launcher/rusefi_console.exe $CONSOLE_FOLDER
cp -r misc/install/openocd $CONSOLE_FOLDER
cp -r misc/install/STM32_Programmer_CLI $CONSOLE_FOLDER
cp java_console/*.dll $CONSOLE_FOLDER
cp -r java_console/bin $FOLDER
cp firmware/ext/openblt/Host/libopenblt.dll $CONSOLE_FOLDER
# todo: proper build of build-libopenblt #5866 instead of having magic pre-compiled artifacts?
cp firmware/ext/openblt/Host/libopenblt.so $CONSOLE_FOLDER
# *.dylib are Mac OS dynamic library files
cp firmware/ext/openblt/Host/libopenblt.dylib $CONSOLE_FOLDER
cp firmware/ext/openblt/Host/openblt_jni.dll $CONSOLE_FOLDER
cp firmware/ext/openblt/Host/libopenblt_jni.so $CONSOLE_FOLDER
cp firmware/ext/openblt/Host/libopenblt_jni.dylib $CONSOLE_FOLDER
# this is a bit dead cp java_tools/ts_plugin_launcher/build/jar/rusefi_ts_plugin_launcher.jar $FOLDER
cd temp
echo "Building bundle inside 'temp' folder"
pwd
zip -r ../$FULL_BUNDLE_FILE *
[ $? -eq 0 ] || (echo "$SCRIPT_NAME: ERROR INVOKING zip"; exit 1)
echo "$SCRIPT_NAME: Bundle $FULL_BUNDLE_FILE ready"
cd ..
ls -l $FULL_BUNDLE_FILE
[ -e $FULL_BUNDLE_FILE ] || { echo "$SCRIPT_NAME: ERROR not found $FULL_BUNDLE_FILE"; exit 1; }
ls -l $UPDATE_BUNDLE_FILE
echo "$SCRIPT_NAME: We are back in root directory"
pwd
ls -l artifacts
echo "Exiting $SCRIPT_NAME"