2024-03-03 06:29:04 -08:00
|
|
|
#
|
|
|
|
# see https://github.com/rusefi/fw-Paralela/blob/master/.github/workflows/compile-board.yaml as an example of how to build custom board firmware
|
|
|
|
#
|
|
|
|
|
|
|
|
name: Build Custom Board Firmware
|
|
|
|
|
|
|
|
inputs:
|
|
|
|
rusefi_dir:
|
|
|
|
description: 'Path to rusefi submodule'
|
|
|
|
required: false
|
|
|
|
default: ext/rusefi
|
|
|
|
meta_info:
|
|
|
|
description: 'Path to meta info file'
|
|
|
|
required: false
|
|
|
|
default: meta-info.env
|
|
|
|
meta_output:
|
|
|
|
description: 'Path to meta output directory'
|
|
|
|
required: false
|
|
|
|
default: ./generated/
|
2024-03-11 18:52:08 -07:00
|
|
|
sim_output:
|
|
|
|
required: false
|
|
|
|
default: ./generated/
|
2024-03-03 06:29:04 -08:00
|
|
|
lts:
|
|
|
|
description: 'LTS Build'
|
|
|
|
required: false
|
2024-03-11 19:34:14 -07:00
|
|
|
default: 'false'
|
2024-03-03 06:29:04 -08:00
|
|
|
bundle_simulator:
|
|
|
|
description: 'Include Simulator in Bundle'
|
|
|
|
required: false
|
2024-03-11 19:34:14 -07:00
|
|
|
default: 'false'
|
2024-03-11 18:52:08 -07:00
|
|
|
run_simulator:
|
|
|
|
description: 'Build and Run Simulator'
|
|
|
|
required: false
|
|
|
|
default: 'false'
|
2024-03-03 06:29:04 -08:00
|
|
|
push:
|
|
|
|
description: 'Push generated configs'
|
|
|
|
required: false
|
2024-03-11 19:34:14 -07:00
|
|
|
default: 'true'
|
2024-03-03 06:29:04 -08:00
|
|
|
artifacts:
|
|
|
|
required: false
|
|
|
|
default: bin hex dfu map elf list srec bundle autoupdate
|
|
|
|
uploads:
|
|
|
|
required: false
|
|
|
|
default: ini bundles
|
|
|
|
MY_REPO_PAT:
|
|
|
|
description: 'Token for accessing private repos'
|
|
|
|
required: false
|
|
|
|
RUSEFI_ONLINE_FTP_USER:
|
|
|
|
required: false
|
|
|
|
RUSEFI_ONLINE_FTP_PASS:
|
|
|
|
required: false
|
|
|
|
RUSEFI_FTP_SERVER:
|
|
|
|
required: false
|
|
|
|
RUSEFI_SSH_SERVER:
|
|
|
|
required: false
|
|
|
|
RUSEFI_SSH_USER:
|
|
|
|
required: false
|
|
|
|
RUSEFI_SSH_PASS:
|
|
|
|
required: false
|
|
|
|
ADDITIONAL_ENV:
|
|
|
|
required: false
|
|
|
|
|
|
|
|
runs:
|
|
|
|
using: "composite"
|
|
|
|
steps:
|
|
|
|
- name: Mask Secrets
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
[ -z "${{inputs.MY_REPO_PAT}}" ] || echo "::add-mask::${{inputs.MY_REPO_PAT}}"
|
|
|
|
[ -z "${{inputs.RUSEFI_ONLINE_FTP_USER}}" ] || echo "::add-mask::${{inputs.RUSEFI_ONLINE_FTP_USER}}"
|
|
|
|
[ -z "${{inputs.RUSEFI_ONLINE_FTP_PASS}}" ] || echo "::add-mask::${{inputs.RUSEFI_ONLINE_FTP_PASS}}"
|
|
|
|
[ -z "${{inputs.RUSEFI_FTP_SERVER}}" ] || echo "::add-mask::${{inputs.RUSEFI_FTP_SERVER}}"
|
|
|
|
[ -z "${{inputs.RUSEFI_SSH_SERVER}}" ] || echo "::add-mask::${{inputs.RUSEFI_SSH_SERVER}}"
|
|
|
|
[ -z "${{inputs.RUSEFI_SSH_USER}}" ] || echo "::add-mask::${{inputs.RUSEFI_SSH_USER}}"
|
|
|
|
[ -z "${{inputs.RUSEFI_SSH_PASS}}" ] || echo "::add-mask::${{inputs.RUSEFI_SSH_PASS}}"
|
|
|
|
[ -z "${{inputs.ADDITIONAL_ENV}}" ] || echo "::add-mask::${{inputs.ADDITIONAL_ENV}}"
|
|
|
|
|
|
|
|
- name: Set Token
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
if [ -n "${{ inputs.MY_REPO_PAT }}" ]; then
|
|
|
|
echo "Using current secret"
|
|
|
|
echo "TOKEN=${{ inputs.MY_REPO_PAT }}" >> "$GITHUB_ENV"
|
|
|
|
else
|
|
|
|
echo "Using current token"
|
|
|
|
echo "TOKEN=${{ github.token }}" >> "$GITHUB_ENV"
|
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Echo
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo "rusefi_dir=${{inputs.rusefi_dir}}"
|
|
|
|
echo "meta_info=${{inputs.meta_info}}"
|
|
|
|
|
|
|
|
- name: Checkout Submodules
|
|
|
|
working-directory: ${{inputs.rusefi_dir}}
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
git submodule update --init --depth=1 firmware/ChibiOS
|
|
|
|
git submodule update --init --depth=1 firmware/ChibiOS-Contrib
|
|
|
|
git submodule update --init --depth=1 firmware/libfirmware
|
|
|
|
git submodule update --init --depth=1 firmware/ext/lua
|
|
|
|
git submodule update --init --depth=1 firmware/ext/uzlib
|
|
|
|
git submodule update --init --depth=1 firmware/ext/openblt
|
|
|
|
git submodule update --init --depth=1 firmware/controllers/lua/luaaa
|
|
|
|
git submodule update --init --depth=1 firmware/controllers/can/wideband_firmware
|
|
|
|
git submodule update --init --depth=1 java_console/luaformatter
|
|
|
|
git submodule update --init --depth=1 java_console/peak-can-basic
|
|
|
|
|
|
|
|
- name: Invoking Post-Checkout Action
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
if [ -f .github/workflows/actions/post-checkout.sh ]; then
|
|
|
|
bash .github/workflows/actions/post-checkout.sh
|
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Set Env Variables
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo "RUSEFI_SSH_SERVER=${{inputs.RUSEFI_SSH_SERVER}}" >> $GITHUB_ENV
|
|
|
|
echo "RUSEFI_SSH_USER=${{inputs.RUSEFI_SSH_USER}}" >> $GITHUB_ENV
|
|
|
|
echo "RUSEFI_SSH_PASS=${{inputs.RUSEFI_SSH_PASS}}" >> $GITHUB_ENV
|
|
|
|
echo "LTS=${{toJSON(inputs.lts)}}" >> $GITHUB_ENV
|
|
|
|
echo "BUNDLE_SIMULATOR=${{toJSON(inputs.bundle_simulator)}}" >> $GITHUB_ENV
|
2024-03-11 18:52:08 -07:00
|
|
|
echo "RUN_SIMULATOR=${{toJSON(inputs.run_simulator)}}" >> $GITHUB_ENV
|
2024-03-03 06:29:04 -08:00
|
|
|
echo "REF=${{github.ref_name}}" >> $GITHUB_ENV
|
|
|
|
echo "${{ inputs.ADDITIONAL_ENV }}" >> $GITHUB_ENV
|
|
|
|
which realpath >/dev/null 2>&1 || (which grealpath >/dev/null 2>&1 && alias realpath='grealpath')
|
2024-03-18 14:34:46 -07:00
|
|
|
echo "META_OUTPUT_ROOT_FOLDER=$(realpath --relative-to=${{inputs.rusefi_dir}}/firmware ${{inputs.meta_output}})/" >> $GITHUB_ENV
|
|
|
|
echo "SIM_OUTPUT_ROOT_FOLDER=$(realpath --relative-to=${{inputs.rusefi_dir}}/firmware ${{inputs.sim_output}})/" >> $GITHUB_ENV
|
2024-03-03 06:29:04 -08:00
|
|
|
source ${{inputs.rusefi_dir}}/firmware/config/boards/common_script_read_meta_env.inc "${{inputs.meta_info}}"
|
|
|
|
cd ${{inputs.rusefi_dir}}/firmware
|
|
|
|
BOARD_DIR=$(realpath --relative-to=. "${{github.workspace}}/$BOARD_DIR")
|
|
|
|
BOARD_META_PATH=$(realpath --relative-to=. "${{github.workspace}}/$BOARD_META_PATH")
|
|
|
|
echo "BOARD_DIR=$BOARD_DIR" >> $GITHUB_ENV
|
|
|
|
echo "BOARD_META_PATH=$BOARD_META_PATH" >> $GITHUB_ENV
|
|
|
|
echo "SHORT_BOARD_NAME=$SHORT_BOARD_NAME" >> $GITHUB_ENV
|
|
|
|
echo "BUNDLE_NAME=$BUNDLE_NAME" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Install Arm GNU Toolchain (arm-none-eabi-gcc)
|
|
|
|
uses: carlosperate/arm-none-eabi-gcc-action@v1
|
|
|
|
with:
|
|
|
|
release: '12.3.Rel1'
|
|
|
|
|
|
|
|
- uses: actions/setup-java@v4
|
|
|
|
with:
|
|
|
|
distribution: 'zulu'
|
|
|
|
java-version: '11'
|
|
|
|
|
|
|
|
- name: Test Compiler
|
|
|
|
shell: bash
|
|
|
|
run: javac -version
|
|
|
|
|
|
|
|
- name: Install Tools
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2024-03-11 18:52:08 -07:00
|
|
|
if [ "$BUNDLE_SIMULATOR" == "true" -o "$RUN_SIMULATOR" == "true" ]; then
|
|
|
|
SIM_REQS="gcc-multilib g++-multilib"
|
|
|
|
fi
|
2024-03-03 06:29:04 -08:00
|
|
|
if [ "$BUNDLE_SIMULATOR" == "true" ]; then
|
2024-03-11 18:52:08 -07:00
|
|
|
SIM_REQS+=" g++-mingw-w64 gcc-mingw-w64 zip dosfstools"
|
2024-03-03 06:29:04 -08:00
|
|
|
fi
|
|
|
|
sudo bash ${{inputs.rusefi_dir}}/misc/actions/add-ubuntu-latest-apt-mirrors.sh
|
|
|
|
sudo apt-get install sshpass mtools $SIM_REQS
|
|
|
|
|
|
|
|
- name: Repo Status
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
git status
|
|
|
|
|
|
|
|
- name: rusefi_dir Status
|
|
|
|
working-directory: ${{inputs.rusefi_dir}}
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
if [ "$(git rev-parse --is-inside-work-tree 2>&1)" == "true" ]; then
|
|
|
|
git status
|
|
|
|
else
|
|
|
|
echo "Not a repository"
|
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Build Firmware
|
|
|
|
working-directory: ${{inputs.rusefi_dir}}/firmware
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
ARTIFACTS=(${{inputs.artifacts}} ${{inputs.uploads}})
|
|
|
|
TARGETS=()
|
|
|
|
shopt -s expand_aliases
|
|
|
|
alias ac="printf '%s\0' "${ARTIFACTS[@]}" | grep -F -x -z --"
|
|
|
|
if ac 'ini'; then TARGETS+=("config"); fi
|
|
|
|
if ac 'bin'; then TARGETS+=("deliver/rusefi.bin"); fi
|
|
|
|
if ac 'dfu'; then TARGETS+=("deliver/rusefi.dfu"); fi
|
|
|
|
if ac 'hex'; then TARGETS+=("build/rusefi.hex"); fi
|
|
|
|
if ac 'map'; then TARGETS+=("build/rusefi.map"); fi
|
|
|
|
if ac 'elf'; then TARGETS+=("build/rusefi.elf"); fi
|
|
|
|
if ac 'list'; then TARGETS+=("build/rusefi.list"); fi
|
|
|
|
if ac 'srec'; then TARGETS+=("build/rusefi.srec"); fi
|
|
|
|
if ac 'bundles' || ac 'bundle'; then TARGETS+=("../artifacts/rusefi_bundle_${SHORT_BOARD_NAME}.zip"); fi
|
|
|
|
if ac 'bundles' || ac 'autoupdate'; then TARGETS+=("../artifacts/rusefi_bundle_${SHORT_BOARD_NAME}_autoupdate.zip"); fi
|
2024-03-18 18:24:01 -07:00
|
|
|
if ac 'obfuscated'; then TARGETS+=("../artifacts/rusefi_bundle_${SHORT_BOARD_NAME}_obfuscated_public.zip"); fi
|
2024-03-11 18:52:08 -07:00
|
|
|
if [ "$RUN_SIMULATOR" == "true" ]; then
|
|
|
|
TARGETS+=("../simulator/build/rusefi_simulator" "../java_tools/tune-tools/build/libs/tune-tools-all.jar")
|
|
|
|
fi
|
2024-03-03 06:29:04 -08:00
|
|
|
bash bin/compile.sh $BOARD_META_PATH ${TARGETS[@]}
|
|
|
|
|
|
|
|
- name: Upload Bundle
|
|
|
|
if: ${{ contains(inputs.uploads, 'bundles') }}
|
|
|
|
working-directory: ${{inputs.rusefi_dir}}/artifacts
|
|
|
|
shell: bash
|
|
|
|
run: bash ../firmware/bin/upload_bundle.sh
|
|
|
|
|
2024-03-11 18:52:08 -07:00
|
|
|
- name: Run Simulator
|
|
|
|
if: ${{ inputs.run_simulator == 'true' }}
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
cd ${{inputs.rusefi_dir}}/simulator/
|
|
|
|
./build/rusefi_simulator 10
|
|
|
|
./write_tune.sh
|
|
|
|
cd $OLDPWD
|
2024-03-18 14:34:46 -07:00
|
|
|
if [ ! "${{inputs.sim_output}}" -ef "${{inputs.rusefi_dir}}/simulator/generated" ]; then
|
|
|
|
mkdir -p ${{inputs.sim_output}}canned-tunes
|
|
|
|
cp ${{inputs.rusefi_dir}}/simulator/generated/*.msq ${{inputs.sim_output}}
|
|
|
|
cp ${{inputs.rusefi_dir}}/simulator/generated/canned-tunes/*.md ${{inputs.sim_output}}canned-tunes
|
2024-03-11 18:52:08 -07:00
|
|
|
fi
|
|
|
|
|
|
|
|
- name: Git Config
|
2024-03-03 06:29:04 -08:00
|
|
|
if: ${{ inputs.push == 'true' }}
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
git config --local user.email "action@github.com"
|
|
|
|
git config --local user.name "GitHub git update Action"
|
2024-03-11 18:52:08 -07:00
|
|
|
|
|
|
|
- name: Add Tune to Commit
|
|
|
|
if: ${{ inputs.run_simulator == 'true' && inputs.push == 'true' }}
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2024-03-18 14:34:46 -07:00
|
|
|
git add "${{inputs.sim_output}}*msq"
|
|
|
|
git add "${{inputs.sim_output}}canned-tunes/*md"
|
2024-03-11 18:52:08 -07:00
|
|
|
OUT=$(git commit -m "Auto-generated Default Tune" 2>&1) || echo "commit failed, finding out why"
|
|
|
|
if echo "$OUT" | grep 'nothing to commit'; then
|
|
|
|
echo "Tune: looks like nothing to commit"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
echo "[$OUT]"
|
|
|
|
|
|
|
|
- name: Add Config to Commit
|
|
|
|
if: ${{ inputs.push == 'true' }}
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2024-03-18 14:34:46 -07:00
|
|
|
git add ${{inputs.rusefi_dir}}/firmware/${META_OUTPUT_ROOT_FOLDER}*
|
2024-03-11 18:52:08 -07:00
|
|
|
OUT=$(git commit -m "Auto-generated Configs" 2>&1) || echo "commit failed, finding out why"
|
2024-03-03 06:29:04 -08:00
|
|
|
if echo "$OUT" | grep 'nothing to commit'; then
|
|
|
|
echo "Configs: looks like nothing to commit"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
git status
|
|
|
|
|
|
|
|
- name: Add Connectors to Commit
|
|
|
|
if: ${{ inputs.push == 'true' }}
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
if [ -d $BOARD_DIR/connectors ]; then
|
|
|
|
git add $BOARD_DIR/connectors/*
|
|
|
|
fi
|
2024-03-11 18:52:08 -07:00
|
|
|
OUT=$(git commit -m "Auto-generated Connectors" 2>&1) || echo "commit failed, finding out why"
|
2024-03-03 06:29:04 -08:00
|
|
|
if echo "$OUT" | grep 'nothing to commit'; then
|
|
|
|
echo "Connectors: looks like nothing to commit"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
echo "[$OUT]"
|
|
|
|
|
|
|
|
- name: Push
|
|
|
|
if: ${{ inputs.push == 'true' }}
|
|
|
|
uses: ad-m/github-push-action@master
|
|
|
|
with:
|
|
|
|
github_token: ${{env.TOKEN}}
|
|
|
|
|
|
|
|
- name: Upload .ini files to rusEFI Online server
|
|
|
|
if: ${{ contains(inputs.uploads, 'ini') }}
|
2024-03-18 14:34:46 -07:00
|
|
|
working-directory: ${{inputs.rusefi_dir}}/firmware/${{env.META_OUTPUT_ROOT_FOLDER}}tunerstudio/generated
|
2024-03-03 06:29:04 -08:00
|
|
|
shell: bash
|
|
|
|
run: ${{github.workspace}}/${{inputs.rusefi_dir}}/firmware/tunerstudio/upload_ini.sh ${{ inputs.RUSEFI_ONLINE_FTP_USER }} ${{ inputs.RUSEFI_ONLINE_FTP_PASS }} ${{ inputs.RUSEFI_FTP_SERVER }}
|
|
|
|
|
|
|
|
- name: Upload github action bin artifact
|
|
|
|
if: ${{ contains(inputs.artifacts, 'bin') }}
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: rusefi.bin
|
|
|
|
path: ${{inputs.rusefi_dir}}/firmware/deliver/rusefi*.bin
|
|
|
|
|
|
|
|
- name: Upload github action srec artifact
|
|
|
|
if: ${{ contains(inputs.artifacts, 'srec') }}
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: rusefi_update.srec
|
|
|
|
path: ${{inputs.rusefi_dir}}/firmware/build/rusefi.srec
|
|
|
|
|
|
|
|
- name: Upload github action hex artifact
|
|
|
|
if: ${{ contains(inputs.artifacts, 'hex') }}
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: rusefi.hex
|
|
|
|
path: ${{inputs.rusefi_dir}}/firmware/build/rusefi*.hex
|
|
|
|
|
|
|
|
- name: Upload github action list artifact
|
|
|
|
if: ${{ contains(inputs.artifacts, 'list') }}
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: rusefi.list
|
|
|
|
path: ${{inputs.rusefi_dir}}/firmware/build/rusefi*.list
|
|
|
|
|
|
|
|
- name: Upload github action map artifact
|
|
|
|
if: ${{ contains(inputs.artifacts, 'map') }}
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: rusefi.map
|
|
|
|
path: ${{inputs.rusefi_dir}}/firmware/build/rusefi*.map
|
|
|
|
|
|
|
|
- name: Upload github action elf artifact
|
|
|
|
if: ${{ contains(inputs.artifacts, 'elf') }}
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: rusefi.elf
|
|
|
|
path: ${{inputs.rusefi_dir}}/firmware/build/rusefi*.elf
|
|
|
|
|
|
|
|
- name: Upload github action bundle artifact
|
|
|
|
if: ${{ contains(inputs.artifacts, 'bundle') }}
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: rusefi_bundle_${{env.SHORT_BOARD_NAME}}.zip
|
|
|
|
path: ${{inputs.rusefi_dir}}/artifacts/rusefi_bundle_${{env.SHORT_BOARD_NAME}}.zip
|
|
|
|
|
|
|
|
- name: Upload github action bundle autoupdate artifact
|
|
|
|
if: ${{ contains(inputs.artifacts, 'autoupdate') }}
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
|
|
|
name: rusefi_bundle_${{env.SHORT_BOARD_NAME}}_autoupdate.zip
|
|
|
|
path: ${{inputs.rusefi_dir}}/artifacts/rusefi_bundle_${{env.SHORT_BOARD_NAME}}_autoupdate.zip
|
2024-03-18 18:04:31 -07:00
|
|
|
|
|
|
|
- name: Upload github action bundle obfuscated artifact
|
|
|
|
if: ${{ contains(inputs.artifacts, 'obfuscated') }}
|
|
|
|
uses: actions/upload-artifact@v4
|
|
|
|
with:
|
2024-03-18 18:24:01 -07:00
|
|
|
name: rusefi_bundle_${{env.SHORT_BOARD_NAME}}_obfuscated_public.zip
|
|
|
|
path: ${{inputs.rusefi_dir}}/artifacts/rusefi_bundle_${{env.SHORT_BOARD_NAME}}_obfuscated_public.zip
|